# Pastebin xUfDvuRo --- /tmp/jc-zzz-5x/zzz-test-release-maven-stage-master 2024-02-09 09:45:06.974908680 +1000 +++ /tmp/jc-zzz-6x/zzz-test-release-maven-stage-master 2024-02-09 09:46:01.903703804 +1000 @@ -1217,7 +1217,7 @@ cp "$SYSSTAT_PATH/"* "$_" # convert sar data to ascii format while IFS="" read -r sarfilenum; do - [ -f "$sarfilenum" ] && LC_TIME=POSIX sar -A -f "$sarfilenum" > "$SAR_DIR/sar${{sarfilenum//[!0-9]/}}" + [ -f "$sarfilenum" ] && LC_TIME=POSIX sar -A -f "$sarfilenum" > "$SAR_DIR/sar${sarfilenum//[!0-9]/}" done < <(find "$SYSSTAT_PATH" -name "sa[0-9]*" || true) # DON'T fail build if script fails. @@ -1246,7 +1246,7 @@ OS_FAMILY=$(facter osfamily | tr '[:upper:]' '[:lower:]') # Capture the CI WORKSPACE safely in the case that it doesn't exist -workspace="${{WORKSPACE:-}}" +workspace="${WORKSPACE:-}" START_PACKAGES=/tmp/packages_start.txt END_PACKAGES=/tmp/packages_end.txt @@ -1254,35 +1254,35 @@ # Swap to creating END_PACKAGES if we are running in a CI job (determined by if # we have a workspace env) or if the starting packages listing already exists. -PACKAGES="${{START_PACKAGES}}" -if [ "${{workspace}}" ] || [ -f "${{START_PACKAGES}}" ]; then - PACKAGES="${{END_PACKAGES}}" +PACKAGES="${START_PACKAGES}" +if [ "${workspace}" ] || [ -f "${START_PACKAGES}" ]; then + PACKAGES="${END_PACKAGES}" fi -case "${{OS_FAMILY}}" in +case "${OS_FAMILY}" in redhat|suse) # RedHat and Suse flavors all use rpm at the package level - rpm -qa | sort > "${{PACKAGES}}" + rpm -qa | sort > "${PACKAGES}" ;; debian) # Debian derived flavors all use dpkg at the package level - dpkg -l | grep '^ii' > "${{PACKAGES}}" + dpkg -l | grep '^ii' > "${PACKAGES}" ;; *) # nothing to do ;; esac -if [ -f "${{START_PACKAGES}}" ] && [ -f "${{END_PACKAGES}}" ]; then +if [ -f "${START_PACKAGES}" ] && [ -f "${END_PACKAGES}" ]; then # ` || true` Ignore exit code because diff exits 1 when there is a diff - diff "${{START_PACKAGES}}" "${{END_PACKAGES}}" > "${{DIFF_PACKAGES}}" || true + diff "${START_PACKAGES}" "${END_PACKAGES}" > "${DIFF_PACKAGES}" || true fi # If running in a Jenkins job, then copy the created files to the archives # location -if [ "${{workspace}}" ]; then - mkdir -p "${{workspace}}/archives/" - cp -f /tmp/packages_*.txt "${{workspace}}/archives/" +if [ "${workspace}" ]; then + mkdir -p "${workspace}/archives/" + cp -f /tmp/packages_*.txt "${workspace}/archives/" fi @@ -1303,7 +1303,7 @@ # shellcheck disable=SC1090 source ~/lf-env.sh -if [[ "${{PYTHON:-}}" -ne "" ]]; then +if [[ "${PYTHON:-}" -ne "" ]]; then lf-activate-venv --python "$PYTHON" lftools elif python3; then lf-activate-venv --python python3 lftools @@ -1312,7 +1312,7 @@ fi # detect if we're in EC2 -if [ -n "${{NOMAD_DC}}" ]; then +if [ -n "${NOMAD_DC}" ]; then echo "INFO: Running in Nomad, no metadata" exit 0 fi @@ -1545,7 +1545,7 @@ set -eu -o pipefail -o noglob # Copy/Generate 'sudo' log and copy to archive directory -copy_log () {{ +copy_log () { case $os in fedora|centos|redhat|ubuntu|debian) if ! sudo cp "$sudo_log" /tmp; then @@ -1567,7 +1567,7 @@ mkdir -p "$WORKSPACE/archives/sudo" mv "/tmp/$sudo_log" "$WORKSPACE/archives/sudo/$sudo_log" -}} # End copy_log() +} # End copy_log() echo "Archiving 'sudo' log.." os=$(facter operatingsystem | tr '[:upper:]' '[:lower:]') @@ -1617,7 +1617,7 @@ lf-activate-venv zipp==1.1.0 python-openstackclient urllib3~=1.26.15 -if [[ -z ${{JOB_NAME:-}} ]]; then +if [[ -z ${JOB_NAME:-} ]]; then lf-echo-error "Required Env Variable Unset/Empty: JOB_NAME" exit 1 fi @@ -1629,7 +1629,7 @@ if [[ -f stack-cost ]]; then echo "DEBUG: $(cat stack-cost)" echo "INFO: Retrieving Stack Cost..." - if ! stack_cost=$(grep -F "total: " stack-cost | awk '{{print $2}}'); then + if ! stack_cost=$(grep -F "total: " stack-cost | awk '{print $2}'); then echo "ERROR: Unable to retrieve Stack Cost, continuing anyway" stack_cost=0 fi @@ -1640,7 +1640,7 @@ # Retrieve the current uptime (in seconds) # And Convert to integer by truncating fractional part' and round up by one -uptime=$(awk '{{print int($1 + 1)}}' /proc/uptime) +uptime=$(awk '{print int($1 + 1)}' /proc/uptime) # EC2 and OpenStack have simiar instace metadata APIs at this IP # AWS docs: https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instancedata-data-retrieval.html @@ -1669,7 +1669,7 @@ fi # Archive the cost date -mkdir -p "${{WORKSPACE}}/archives/cost" +mkdir -p "${WORKSPACE}/archives/cost" echo "INFO: Archiving Costs" @@ -1678,8 +1678,8 @@ date=$(TZ=GMT date +'%Y-%m-%d %H:%M:%S') # Format the uptime, cost & stack_cost fields -printf "%s,%s,%s,%s,%d,%.2f,%.2f,%s\n" "${{JOB_NAME:-}}" "${{BUILD_NUMBER:-}}" "$date" \ - "$resource" "$uptime" "$cost" "$stack_cost" "${{BUILD_RESULT:-}}" > "${{WORKSPACE}}/archives/cost.csv" +printf "%s,%s,%s,%s,%d,%.2f,%.2f,%s\n" "${JOB_NAME:-}" "${BUILD_NUMBER:-}" "$date" \ + "$resource" "$uptime" "$cost" "$stack_cost" "${BUILD_RESULT:-}" > "${WORKSPACE}/archives/cost.csv" @@ -1709,34 +1709,34 @@ # self-contained, we ensure it exists here. mkdir -p "$WORKSPACE/archives" -get_pattern_opts () {{ +get_pattern_opts () { opts=() - for arg in ${{ARCHIVE_ARTIFACTS:-}}; do + for arg in ${ARCHIVE_ARTIFACTS:-}; do opts+=("-p" "$arg") done - echo "${{opts[@]-}}" -}} + echo "${opts[@]-}" +} pattern_opts=$(get_pattern_opts) -if [[ -z ${{LOGS_SERVER:-}} ]]; then +if [[ -z ${LOGS_SERVER:-} ]]; then echo "WARNING: Nexus logging server not set" else - nexus_url="${{NEXUSPROXY:-$NEXUS_URL}}" - nexus_path="${{SILO}}/${{JENKINS_HOSTNAME}}/${{JOB_NAME}}/${{BUILD_NUMBER}}" + nexus_url="${NEXUSPROXY:-$NEXUS_URL}" + nexus_path="${SILO}/${JENKINS_HOSTNAME}/${JOB_NAME}/${BUILD_NUMBER}" echo "INFO: Nexus URL $nexus_url path $nexus_path" - echo "INFO: archiving workspace using pattern(s): ${{pattern_opts:-}}" + echo "INFO: archiving workspace using pattern(s): ${pattern_opts:-}" # shellcheck disable=SC2086 - lftools deploy archives ${{pattern_opts:-}} "$nexus_url" "$nexus_path" "$WORKSPACE" + lftools deploy archives ${pattern_opts:-} "$nexus_url" "$nexus_path" "$WORKSPACE" echo "INFO: archiving logs to Nexus" - lftools deploy logs "$nexus_url" "$nexus_path" "${{BUILD_URL:-}}" + lftools deploy logs "$nexus_url" "$nexus_path" "${BUILD_URL:-}" echo "Nexus build logs: <a href=\"$LOGS_SERVER/$nexus_path\">$LOGS_SERVER/$nexus_path</a>" fi -if [[ -z ${{S3_BUCKET:-}} ]]; then +if [[ -z ${S3_BUCKET:-} ]]; then echo "WARNING: S3 logging server not set" else s3_path="logs/$SILO/$JENKINS_HOSTNAME/$JOB_NAME/$BUILD_NUMBER/" @@ -1744,7 +1744,7 @@ echo "INFO: archiving logs to S3" # shellcheck disable=SC2086 - lftools deploy s3 ${{pattern_opts:-}} "$S3_BUCKET" "$s3_path" \ + lftools deploy s3 ${pattern_opts:-} "$S3_BUCKET" "$s3_path" \ "$BUILD_URL" "$WORKSPACE" echo "S3 build logs: <a href=\"https://$CDN_URL/$s3_path\">https://$CDN_URL/$s3_path</a>" [