# Pastebin MHpZXOaz diff --git a/jjb/lf-macros.yaml b/jjb/lf-macros.yaml index 2d7a1fe..be757ef 100644 --- a/jjb/lf-macros.yaml +++ b/jjb/lf-macros.yaml @@ -114,7 +114,7 @@ - builder: name: lf-infra-package-listing builders: - - shell: !include-raw: + - shell: !include-raw-escape: - ../shell/package-listing.sh - builder: @@ -197,7 +197,7 @@ - builder: name: lf-infra-sysstat builders: - - shell: !include-raw: + - shell: !include-raw-escape: - ../shell/sysstat.sh - builder: diff --git a/shell/package-listing.sh b/shell/package-listing.sh index c0b5476..2449b46 100755 --- a/shell/package-listing.sh +++ b/shell/package-listing.sh @@ -19,7 +19,7 @@ set -x # Trace commands for this script to make debugging easier 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 @@ -27,33 +27,33 @@ DIFF_PACKAGES=/tmp/packages_diff.txt # 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 diff --git a/shell/sysstat.sh b/shell/sysstat.sh index eada1b3..3d4940b 100644 --- a/shell/sysstat.sh +++ b/shell/sysstat.sh @@ -53,7 +53,7 @@ mkdir -p "$SAR_DIR" 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.