Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create Process/Tool to Validate Upload Of Release Artifacts To Artifactory #722

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 49 additions & 0 deletions linux/scripts/artifacts.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
#!/bin/bash

TYPE=("jdk" "jre" "src")
VERS=("$@") # Accept the VERS array as arguments
DIST=("apk" "deb" "rpm")
DEBDISTS=("bookworm" "bullseye" "buster" "kinetic" "jammy" "focal" "bionic")
RPMDISTS=("centos/7" "rocky/8" "rhel/7" "opensuse/15.3")

if [ $# -eq 0 ]; then

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Such a script should have a documentation that is printed to the Command-line. The documentation should contain the functionality of the script and possible parameters with documentation.

Example

usage="$(basename "$0") [-h] [-s n] -- program to calculate the answer to life, the universe and everything

where:
    -h  show this help text
    -s  set the seed value (default: 42)"

seed=42
while getopts ':hs:' option; do
  case "$option" in
    h) echo "$usage"
       exit
       ;;
    s) seed=$OPTARG
       ;;
    :) printf "missing argument for -%s\n" "$OPTARG" >&2
       echo "$usage" >&2
       exit 1
       ;;
   \?) printf "illegal option: -%s\n" "$OPTARG" >&2
       echo "$usage" >&2
       exit 1
       ;;
  esac
done
shift $((OPTIND - 1))

Copied from https://stackoverflow.com/questions/5474732/how-can-i-add-a-help-method-to-a-shell-script

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Such a script should have a documentation that is printed to the Command-line. The documentation should contain the functionality of the script and possible parameters with documentation.

Example

usage="$(basename "$0") [-h] [-s n] -- program to calculate the answer to life, the universe and everything

where:
    -h  show this help text
    -s  set the seed value (default: 42)"

seed=42
while getopts ':hs:' option; do
  case "$option" in
    h) echo "$usage"
       exit
       ;;
    s) seed=$OPTARG
       ;;
    :) printf "missing argument for -%s\n" "$OPTARG" >&2
       echo "$usage" >&2
       exit 1
       ;;
   \?) printf "illegal option: -%s\n" "$OPTARG" >&2
       echo "$usage" >&2
       exit 1
       ;;
  esac
done
shift $((OPTIND - 1))

Copied from https://stackoverflow.com/questions/5474732/how-can-i-add-a-help-method-to-a-shell-script

Thannks for the pointer @hendrikebbers. Actually there is still more work to this script. I think we can consider this as well

echo "Please provide the VERS array as arguments"
exit 1
fi

for EACHTYPE in "${TYPE[@]}"; do
for EACHVERS in "${VERS[@]}"; do
for EACHDIST in "${DIST[@]}"; do
## Limit APK To Only x86_64
if [ "$EACHDIST" = "apk" ]; then
ARCH=("x86_64")
else
# Exclude specific architectures based on conditions
ARCH=("x86_64" "aarch64" "ppc64le")
if [ "$EACHDIST" = "deb" ]; then
if [ "$EACHVERS" != "8.0.382.0.0.5-1" ]; then
ARCH+=("armv7l")
fi
for EACHDEB in "${DEBDISTS[@]}"; do
echo TYPE = $EACHTYPE, $EACHVERS, $EACHDIST, $EACHARCH, $EACHDEB
done
fi

if [ "$EACHDIST" = "rpm" ]; then
if [ "$EACHVERS" != "8.0.382.0.0.5-1" ]; then
ARCH+=("armv7hl")
fi
for EACHRPM in "${RPMDISTS[@]}"; do
echo TYPE = $EACHTYPE, $EACHVERS, $EACHDIST, $EACHARCH, $EACHRPM
done
fi
fi

for EACHARCH in "${ARCH[@]}"; do
if [ "$EACHDIST" = "apk" ]; then
echo TYPE = $EACHTYPE, $EACHVERS, $EACHDIST, $EACHARCH
fi
done
done
done
done