github-action
github-action copied to clipboard
`grep` failure handling is lousy
https://github.com/coverallsapp/github-action/blob/ba6dae83310bbd6d33ff77092650dc40bd444a2a/action.yml#L199-L208
https://github.com/PowerDNS/pdns/actions/runs/19634781529/job/56223536933
2025-11-24T12:56:40.8466822Z ##[group]Run # Enable debugging if 'debug' is true
2025-11-24T12:56:40.8467217Z [36;1m# Enable debugging if 'debug' is true[0m
2025-11-24T12:56:40.8467494Z [36;1m[ "false" == "true" ] && set -x[0m
2025-11-24T12:56:40.8467733Z [36;1m[0m
2025-11-24T12:56:40.8467911Z [36;1mmkdir -p ~/bin/[0m
2025-11-24T12:56:40.8468111Z [36;1mcd ~/bin/[0m
2025-11-24T12:56:40.8468288Z [36;1m[0m
2025-11-24T12:56:40.8468539Z [36;1m# Determine which version of coverage-reporter to download[0m
2025-11-24T12:56:40.8469011Z [36;1mif [ -z "$COVERAGE_REPORTER_VERSION" ] || [ "$COVERAGE_REPORTER_VERSION" == "latest" ]; then[0m
2025-11-24T12:56:40.8469411Z [36;1m asset_path="latest/download"[0m
2025-11-24T12:56:40.8469659Z [36;1m version_message="latest"[0m
2025-11-24T12:56:40.8469875Z [36;1melse[0m
2025-11-24T12:56:40.8470103Z [36;1m asset_path="download/${COVERAGE_REPORTER_VERSION}"[0m
2025-11-24T12:56:40.8470433Z [36;1m version_message="$COVERAGE_REPORTER_VERSION"[0m
2025-11-24T12:56:40.8470695Z [36;1mfi[0m
2025-11-24T12:56:40.8470848Z [36;1m[0m
2025-11-24T12:56:40.8471035Z [36;1m# Function to compare version numbers[0m
2025-11-24T12:56:40.8471286Z [36;1mversion_ge() {[0m
2025-11-24T12:56:40.8471501Z [36;1m # Compare two version numbers[0m
2025-11-24T12:56:40.8471787Z [36;1m [ "$(printf '%s\n' "$@" | sort -V | head -n 1)" != "$1" ][0m
2025-11-24T12:56:40.8472055Z [36;1m}[0m
2025-11-24T12:56:40.8472211Z [36;1m[0m
2025-11-24T12:56:40.8472411Z [36;1m# Determine the platform-specific filename:[0m
2025-11-24T12:56:40.8472892Z [36;1m# This logic is necessary due to the introduction of multiple platform support starting from v0.6.15.[0m
2025-11-24T12:56:40.8473646Z [36;1m# It selects the correct filename based on the specified platform and version, while ensuring[0m
2025-11-24T12:56:40.8474235Z [36;1m# backward compatibility with earlier versions that only supported a generic Linux binary for x86_64.[0m
2025-11-24T12:56:40.8475078Z [36;1mif [ -z "$COVERAGE_REPORTER_PLATFORM" ] || [ "$COVERAGE_REPORTER_PLATFORM" == "auto-detect" ]; then[0m
2025-11-24T12:56:40.8475511Z [36;1m COVERAGE_REPORTER_PLATFORM="$(uname -m)"[0m
2025-11-24T12:56:40.8475762Z [36;1mfi[0m
2025-11-24T12:56:40.8475953Z [36;1mcase "$COVERAGE_REPORTER_PLATFORM" in[0m
2025-11-24T12:56:40.8476199Z [36;1m x86_64|"")[0m
2025-11-24T12:56:40.8476457Z [36;1m if version_ge "$COVERAGE_REPORTER_VERSION" "v0.6.15"; then[0m
2025-11-24T12:56:40.8476818Z [36;1m platform_filename="coveralls-linux-x86_64.tar.gz"[0m
2025-11-24T12:56:40.8477096Z [36;1m else[0m
2025-11-24T12:56:40.8477492Z [36;1m platform_filename="coveralls-linux.tar.gz"[0m
2025-11-24T12:56:40.8477766Z [36;1m fi[0m
2025-11-24T12:56:40.8477931Z [36;1m ;;[0m
2025-11-24T12:56:40.8478103Z [36;1m aarch64|arm64)[0m
2025-11-24T12:56:40.8478368Z [36;1m if version_ge "$COVERAGE_REPORTER_VERSION" "v0.6.15"; then[0m
2025-11-24T12:56:40.8478725Z [36;1m platform_filename="coveralls-linux-aarch64.tar.gz"[0m
2025-11-24T12:56:40.8479012Z [36;1m else[0m
2025-11-24T12:56:40.8479434Z [36;1m echo "Warning: The aarch64/arm64 platform is only supported from version v0.6.15 onwards. Proceeding with v0.6.15." >&2[0m
2025-11-24T12:56:40.8479933Z [36;1m asset_path="download/v0.6.15"[0m
2025-11-24T12:56:40.8480238Z [36;1m platform_filename="coveralls-linux-aarch64.tar.gz"[0m
2025-11-24T12:56:40.8480521Z [36;1m fi[0m
2025-11-24T12:56:40.8480690Z [36;1m ;;[0m
2025-11-24T12:56:40.8480846Z [36;1m *)[0m
2025-11-24T12:56:40.8481309Z [36;1m echo "Warning: Unsupported platform: $COVERAGE_REPORTER_PLATFORM. The default x86_64 version ($version_message) will be used." >&2[0m
2025-11-24T12:56:40.8481887Z [36;1m if version_ge "$COVERAGE_REPORTER_VERSION" "v0.6.15"; then[0m
2025-11-24T12:56:40.8482242Z [36;1m platform_filename="coveralls-linux-x86_64.tar.gz"[0m
2025-11-24T12:56:40.8482513Z [36;1m else[0m
2025-11-24T12:56:40.8482731Z [36;1m platform_filename="coveralls-linux.tar.gz"[0m
2025-11-24T12:56:40.8482992Z [36;1m fi[0m
2025-11-24T12:56:40.8483145Z [36;1m ;;[0m
2025-11-24T12:56:40.8483307Z [36;1mesac[0m
2025-11-24T12:56:40.8483467Z [36;1m[0m
2025-11-24T12:56:40.8483634Z [36;1m# Checksum verification:[0m
2025-11-24T12:56:40.8484025Z [36;1m# The following code was chosen to replace the more simple `sha256sum -c` because it provides[0m
2025-11-24T12:56:40.8484781Z [36;1m# clearer debugging information around our new matrix of supported coverage-reporter versions and platforms.[0m
2025-11-24T12:56:40.8485508Z [36;1m# We may drop back to `${platform_filename}" coveralls-checksums.txt | sha256sum -c` when we're more confidently handling these.[0m
2025-11-24T12:56:40.8485992Z [36;1m[0m
2025-11-24T12:56:40.8486188Z [36;1m# Try to download the binary and checksum file[0m
2025-11-24T12:56:40.8486725Z [36;1mif ! curl -sLO "https://github.com/coverallsapp/coverage-reporter/releases/${asset_path}/${platform_filename}" ||[0m
2025-11-24T12:56:40.8487466Z [36;1m ! curl -sLO "https://github.com/coverallsapp/coverage-reporter/releases/${asset_path}/coveralls-checksums.txt"; then[0m
2025-11-24T12:56:40.8488047Z [36;1m echo "Failed to download coveralls binary or checksum (Linux)."[0m
2025-11-24T12:56:40.8488374Z [36;1m [ "false" == "false" ] && exit 0[0m
2025-11-24T12:56:40.8488603Z [36;1m exit 1[0m
2025-11-24T12:56:40.8488773Z [36;1mfi[0m
2025-11-24T12:56:40.8488922Z [36;1m[0m
2025-11-24T12:56:40.8489145Z [36;1m# DEBUG: Print contents of checksum file for debugging[0m
2025-11-24T12:56:40.8489483Z [36;1mecho "Contents of coveralls-checksums.txt:"[0m
2025-11-24T12:56:40.8489907Z [36;1mcat coveralls-checksums.txt[0m
2025-11-24T12:56:40.8490137Z [36;1m[0m
2025-11-24T12:56:40.8490310Z [36;1m# Extract expected checksum[0m
2025-11-24T12:56:40.8490714Z [36;1mexpected_checksum=$(grep "${platform_filename}" coveralls-checksums.txt | awk '{print $1}')[0m
2025-11-24T12:56:40.8491138Z [36;1mif [ -z "$expected_checksum" ]; then[0m
2025-11-24T12:56:40.8491465Z [36;1m echo "Failed to extract checksum for ${platform_filename}"[0m
2025-11-24T12:56:40.8491782Z [36;1m [ "false" == "false" ] && exit 0[0m
2025-11-24T12:56:40.8492010Z [36;1m exit 1[0m
2025-11-24T12:56:40.8492183Z [36;1mfi[0m
2025-11-24T12:56:40.8492346Z [36;1m[0m
2025-11-24T12:56:40.8492514Z [36;1m# Compute actual checksum[0m
2025-11-24T12:56:40.8492856Z [36;1mactual_checksum=$(sha256sum "${platform_filename}" | awk '{print $1}')[0m
2025-11-24T12:56:40.8493187Z [36;1m[0m
2025-11-24T12:56:40.8493572Z [36;1m# Perform verification by comparing expected and actual checksums[0m
2025-11-24T12:56:40.8493982Z [36;1mif [ "$expected_checksum" != "$actual_checksum" ]; then[0m
2025-11-24T12:56:40.8494314Z [36;1m echo "Checksum verification failed (Linux)."[0m
2025-11-24T12:56:40.8494716Z [36;1m echo "Expected: $expected_checksum"[0m
2025-11-24T12:56:40.8494978Z [36;1m echo "Actual: $actual_checksum"[0m
2025-11-24T12:56:40.8495230Z [36;1m [ "false" == "false" ] && exit 0[0m
2025-11-24T12:56:40.8495458Z [36;1m exit 1[0m
2025-11-24T12:56:40.8495627Z [36;1mfi[0m
2025-11-24T12:56:40.8495777Z [36;1m[0m
2025-11-24T12:56:40.8495957Z [36;1mtar -xzf "${platform_filename}"[0m
2025-11-24T12:56:40.8496188Z [36;1m[0m
2025-11-24T12:56:40.8496352Z [36;1m# Check if the binary exists[0m
2025-11-24T12:56:40.8496600Z [36;1mif [ ! -f ~/bin/coveralls ]; then[0m
2025-11-24T12:56:40.8496916Z [36;1m echo "Coveralls binary not found after extraction (Linux)."[0m
2025-11-24T12:56:40.8497231Z [36;1m [ "false" == "false" ] && exit 0[0m
2025-11-24T12:56:40.8497469Z [36;1m exit 1[0m
2025-11-24T12:56:40.8497638Z [36;1mfi[0m
2025-11-24T12:56:40.8497786Z [36;1m[0m
2025-11-24T12:56:40.8497942Z [36;1m# Cleanup[0m
2025-11-24T12:56:40.8498143Z [36;1mrm coveralls-checksums.txt[0m
2025-11-24T12:56:40.8498387Z [36;1mecho ~/bin >> $GITHUB_PATH[0m
2025-11-24T12:56:40.8500465Z shell: bash --noprofile --norc -e -o pipefail {0}
2025-11-24T12:56:40.8500801Z env:
2025-11-24T12:56:40.8501086Z COMPILER: clang
2025-11-24T12:56:40.8501359Z CLANG_VERSION: 13
2025-11-24T12:56:40.8501679Z REPO_HOME: /__w/pdns/pdns
2025-11-24T12:56:40.8501937Z BUILDER_VERSION: 0.0.0-git1
2025-11-24T12:56:40.8502142Z COVERAGE: yes
2025-11-24T12:56:40.8502344Z LLVM_PROFILE_FILE: /tmp/code-%p.profraw
2025-11-24T12:56:40.8502593Z OPTIMIZATIONS: yes
2025-11-24T12:56:40.8502807Z INV_CMD: . ${REPO_HOME}/.venv/bin/activate && inv
2025-11-24T12:56:40.8503067Z BRANCH_NAME: 16349/merge
2025-11-24T12:56:40.8503287Z normalized-branch-name: 16349-merge
2025-11-24T12:56:40.8503546Z COVERAGE_REPORTER_VERSION: latest
2025-11-24T12:56:40.8503791Z COVERAGE_REPORTER_PLATFORM: auto-detect
2025-11-24T12:56:40.8504027Z ##[endgroup]
2025-11-24T12:56:48.8687981Z Contents of coveralls-checksums.txt:
2025-11-24T12:56:48.8695954Z <!DOCTYPE html>
2025-11-24T12:56:48.8696266Z <!--
2025-11-24T12:56:48.8696432Z
2025-11-24T12:56:48.8696791Z Hello future GitHubber! I bet you're here to remove those nasty inline styles,
2025-11-24T12:56:48.8697541Z DRY up these templates and make 'em nice and re-usable, right?
2025-11-24T12:56:48.8697960Z
2025-11-24T12:56:48.8698220Z Please, don't. https://github.com/styleguide/templates/2.0
2025-11-24T12:56:48.8698590Z
2025-11-24T12:56:48.8698698Z -->
2025-11-24T12:56:48.8698951Z <html>
2025-11-24T12:56:48.8699204Z <head>
2025-11-24T12:56:48.8699520Z <title>Unicorn! · GitHub</title>
...
2025-11-24T12:56:48.9307319Z </html>
2025-11-24T12:56:48.9317831Z ##[error]Process completed with exit code 1.
The code ran:
expected_checksum=$(grep "${platform_filename}" coveralls-checksums.txt | awk '{print $1}')
But, the grep failed because the file was broken, and thus it never reached this failure handling code:
if [ -z "$expected_checksum" ]; then
echo "Failed to extract checksum for ${platform_filename}"