Skip to content
Open
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion test/junit2jira/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ permissions: {}
| [gcp-metrics](#gcp-metrics) | Whether to upload test metrics to GCS for BigQuery | `true` |
| [gcs-bucket](#gcs-bucket) | GCS bucket root used to store test metrics | `gs://stackrox-ci-artifacts` |
| [gcs-subdir](#gcs-subdir) | Subdirectory (relative to the bucket root) used to store test metrics | `test-metrics/upload` |
| [version](#version) | `junit2jira` release version to download | `v0.0.27` |
| [version](#version) | `junit2jira` release version to download | `v0.0.28` |

## Outputs

Expand Down
28 changes: 25 additions & 3 deletions test/junit2jira/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ inputs:
version:
description: junit2jira release version to download.
required: false
default: v0.0.27
default: v0.0.28
Comment thread
coderabbitai[bot] marked this conversation as resolved.

outputs:
new-jiras:
Expand All @@ -65,15 +65,37 @@ runs:
shell: bash
env:
VERSION: ${{ inputs.version }}
RUNNER_ARCH: ${{ runner.arch }}
run: |
set -euo pipefail
BIN_DIR="${RUNNER_TEMP}/junit2jira/${VERSION}"
# Map the GitHub Actions runner architecture to its Go equivalent.
case "$RUNNER_ARCH" in
X64) goarch=amd64 ;;
ARM64) goarch=arm64 ;;
PPC64LE) goarch=ppc64le ;;
S390X) goarch=s390x ;;
*)
echo "::error::Unsupported runner.arch '${RUNNER_ARCH}' - no junit2jira binary is published for this architecture." >&2
exit 1
;;
esac

BIN_DIR="${RUNNER_TEMP}/junit2jira/${VERSION}/${goarch}"
BIN_PATH="${BIN_DIR}/junit2jira"
ASSET="junit2jira-linux-${goarch}"
Comment thread
coderabbitai[bot] marked this conversation as resolved.
# v0.0.27 predates architecture-specific release assets.
if [[ "$VERSION" == "v0.0.27" ]]; then
if [[ "$goarch" != "amd64" ]]; then
echo "::error::junit2jira ${VERSION} only provides an amd64 binary. Select a release with a junit2jira-linux-${goarch} asset." >&2
exit 1
fi
ASSET="junit2jira"
fi
# Skip downloading release if downloaded already, e.g. when the action is used multiple times.
if [[ ! -x "$BIN_PATH" ]]; then
mkdir -p "$BIN_DIR"
curl --retry 5 --retry-connrefused --silent --show-error --fail --location \
--output "$BIN_PATH" "https://github.com/stackrox/junit2jira/releases/download/${VERSION}/junit2jira"
--output "$BIN_PATH" "https://github.com/stackrox/junit2jira/releases/download/${VERSION}/${ASSET}"
chmod +x "$BIN_PATH"
fi
echo "JUNIT2JIRA_BIN=${BIN_PATH}" >> "$GITHUB_ENV"
Expand Down
3 changes: 3 additions & 0 deletions test/junit2jira/junit2jira.sh
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,9 @@ capture_job_failure_as_junit() {

export ARTIFACT_DIR="${directory}"

# junit2jira treats a missing reports directory as an error.
mkdir -p "${directory}"

# Only process failures.
if [[ "$job_status" != "failure" ]]; then
gh_log debug "Job status: ${job_status} - no failure record needed"
Expand Down
Loading