REPOS_DIR="$WORKSPACE/.repos"
-IFS=" " read -r -a PATCHES <<< "$(echo "$GERRIT_EVENT_COMMENT_TEXT" | grep -E '(recheck:|reverify:)' | awk -F: '{print $2}')"
+IFS=" " read -r -a PATCHES <<< \
+ "$(echo "$GERRIT_EVENT_COMMENT_TEXT" | \
+ grep -E '(recheck:|reverify:)' | awk -F: '{print $2}')"
# shellcheck disable=SC1090
source ~/lf-env.sh
if [ ! -f "$WORKSPACE/jenkins-config/global-vars-$silo.sh" ]; then
echo "WARN: jenkins-config/global-vars-$silo.sh does not exist. Skipping cloud management..."
echo "We highly recommend setting up global-vars-$silo.sh to manage the Jenkins global variables."
- echo "Refer to https://docs.releng.linuxfoundation.org/projects/global-jjb/en/latest/jjb/lf-ci-jobs.html#global-environment-variables for details."
+ # shellcheck disable=SC2140
+ echo "Refer to https://docs.releng.linuxfoundation.org/"\
+"projects/global-jjb/en/latest/jjb/lf-ci-jobs.html"\
+"#global-environment-variables for details."
continue
fi
else
echo "License Header Checker is not installed. Installing..."
mkdir "$WORKSPACE/bin"
- wget -nv -O "/tmp/lhc.tar.gz" "https://nexus.opendaylight.org/content/repositories/hosted_installers/org/linuxfoundation/lhc/${lhc_version}/lhc-${lhc_version}.tar.gz"
+ NEXUS_BASEURL="https://nexus.opendaylight.org/"
+ NEXUS_PATH="content/repositories/hosted_installers/org/linuxfoundation/"
+ NEXUS_LHC="lhc/${lhc_version}/lhc-${lhc_version}.tar.gz"
+ NEXUS_URL="${NEXUS_BASEURL}${NEXUS_PATH}${NEXUS_LHC}"
+ wget -nv -O "/tmp/lhc.tar.gz" "$NEXUS_URL"
tar -zxvf /tmp/lhc.tar.gz -C "$WORKSPACE/bin"
chmod +x "$WORKSPACE/bin/lhc"
export PATH="$WORKSPACE/bin:$PATH"
mc_staging_repo=$(sed -n -e 's/Staging repository \(.*\) created\./\1/p' "$MC_TMP_FILE")
rm -f "$MC_TMP_FILE"
-echo "$mc_staging_repo https://oss.sonatype.org/content/repositories/$mc_staging_repo" | tee -a "$WORKSPACE/archives/staging-repo.txt"
+# shellcheck disable=SC2140
+echo "$mc_staging_repo "\
+"https://oss.sonatype.org/content/repositories/$mc_staging_repo" | \
+ tee -a "$WORKSPACE/archives/staging-repo.txt"
echo "${NEXUS_IQ_USER}:${NEXUS_IQ_PASSWORD}" >> cli-auth.txt
echo "INFO: running nexus-iq-cli on project $NEXUS_IQ_PROJECT_NAME and file $REQUIREMENTS_FILE"
# result.json is a mystery
-java -jar "${CLI_LOCATION}" @cli-auth.txt -s https://nexus-iq.wl.linuxfoundation.org -i "${NEXUS_IQ_PROJECT_NAME}" -t build -r result.json "${REQUIREMENTS_FILE}"
+java -jar "${CLI_LOCATION}" @cli-auth.txt \
+ -s https://nexus-iq.wl.linuxfoundation.org -i "${NEXUS_IQ_PROJECT_NAME}" \
+ -t build -r result.json "${REQUIREMENTS_FILE}"
rm cli-auth.txt
rm "${CLI_LOCATION}"
builds=()
for jenkins in "${@:2}"; do
- JENKINS_URL="$jenkins/computer/api/json?tree=computer[executors[currentExecutable[url]],oneOffExecutors[currentExecutable[url]]]&xpath=//url&wrapper=builds"
+ PARAMS="tree=computer[executors[currentExecutable[url]],"
+ PARAMS=$PARAMS"oneOffExecutors[currentExecutable[url]]]"
+ PARAMS=$PARAMS"&xpath=//url&wrapper=builds"
+ JENKINS_URL="$jenkins/computer/api/json?$PARAMS"
resp=$(curl -s -w "\\n\\n%{http_code}" --globoff -H "Content-Type:application/json" "$JENKINS_URL")
json_data=$(echo "$resp" | head -n1)
status=$(echo "$resp" | awk 'END {print $NF}')
elif [[ "${GIT_BASE:-}" =~ https://github.com ]]; then
LAST_CHANGE_SHA=$(git log --no-merges -1 --format=%H)
API_BASE=$(echo "$GIT_BASE" | sed -E 's#(www.)?github.com#api.github.com/repos#')
- STATUS=$(curl "${API_BASE}/statuses/${LAST_CHANGE_SHA}" \
- | jq ".[] | select(.state == \"success\" and .context == \"Packer ${PACKER_PLATFORM}-${PACKER_TEMPLATE} Verify Build\")")
+ CONTEXT_VALUE="\"Packer ${PACKER_PLATFORM}-${PACKER_TEMPLATE} Verify Build\""
+ JQ_QUERY=".[] | select(.state == \"success\" and .context == ${CONTEXT_VALUE})"
+ STATUS=$(curl "${API_BASE}/statuses/${LAST_CHANGE_SHA}" | jq "${JQ_QUERY}")
if [[ -n ${STATUS} ]]; then
echo "Build already successful for this patch set. Skipping merge build..."
exit
echo "Packer version $CURRENT_VERSION installed is less than $PACKER_VERSION available, updating Packer."
packer_install
else
- echo "Packer version installed $CURRENT_VERSION is greater than or equal to the required minimum version $PACKER_VERSION."
+ echo "Packer version installed $CURRENT_VERSION is greater than or equal to"\
+ "the required minimum version $PACKER_VERSION."
fi
else
echo "Packer binary not available, installing Packer version $PACKER_VERSION."
python3 -m pip install --user --quiet --upgrade pip
python3 -m pip install --user --quiet --no-warn-script-location --upgrade setuptools
- python3 -m pip install --user --quiet --no-warn-script-location --upgrade --upgrade-strategy eager -r "$requirements_file"
+ python3 -m pip install --user --quiet --no-warn-script-location --upgrade \
+ --upgrade-strategy eager -r "$requirements_file"
# installs are silent, show version details in log
python3 --version
python3 -m pip --version
OVERRIDE_SEMVER_REGEX="${OVERRIDE_SEMVER_REGEX:-None}"
if [[ $OVERRIDE_SEMVER_REGEX == "None" ]]; then
# Use the semver regex taken from https://github.com/fsaintjacques/semver-tool
- semver_regex="^[vV]?(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)(\-(0|[1-9][0-9]*|[0-9]*[A-Za-z-][0-9A-Za-z-]*)(\.(0|[1-9][0-9]*|[0-9]*[A-Za-z-][0-9A-Za-z-]*))*)?(\+[0-9A-Za-z-]+(\.[0-9A-Za-z-]+)*)?$"
+ pat1="(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)"
+ pat2="(0|[1-9][0-9]*|[0-9]*[A-Za-z-][0-9A-Za-z-]*)"
+ pat3="(\+[0-9A-Za-z-]+(\.[0-9A-Za-z-]+)*)"
+ semver_regex="^[vV]?${pat1}(\-${pat2}(\.${pat2})*)?${pat3}?$"
else
semver_regex="${OVERRIDE_SEMVER_REGEX}"
fi
wget "${path}"/"${name}" -o artifacts/"${name}"
if [[ "$JOB_NAME" =~ "merge" ]] && [[ "$DRY_RUN" = false ]]; then
#lftools sign sigul artifacts
- curl -v -u <NEXUSUSER>:<NEXUSPASS> --upload-file "${NEXUS_URL}"/content/repositories/releases/org/"${ORG}"/"${VERSION}"/"${name}" \;
+ curl -v -u <NEXUSUSER>:<NEXUSPASS> --upload-file \
+ "${NEXUS_URL}"/content/repositories/releases/org/"${ORG}"/"${VERSION}"/"${name}" \;
fi
echo "#########################"
fi