From 1bcd93025a646c5a065ee235f9f9e3a09d9ac698 Mon Sep 17 00:00:00 2001 From: Jover Lee Date: Tue, 19 May 2026 11:33:24 -0700 Subject: [PATCH] pathogen-repo-build: Ensure build.log is uploaded MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Noticed while debugging workflows that the artifact did not include the expected build log.¹ This is due to the failed workflow exiting immediately before moving the build log to the expected location for the uploaded artifact. ¹ --- .github/workflows/pathogen-repo-build.yaml | 4 +++- .github/workflows/pathogen-repo-build.yaml.in | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pathogen-repo-build.yaml b/.github/workflows/pathogen-repo-build.yaml index e4511ec..140dfec 100644 --- a/.github/workflows/pathogen-repo-build.yaml +++ b/.github/workflows/pathogen-repo-build.yaml @@ -332,13 +332,15 @@ jobs: # shellcheck disable=SC2154 set -x + exit_status=0 # tee build output to .git/ to avoid # https://github.com/nextstrain/.github/issues/77#issuecomment-1998652064 # After build is complete, move .git/build.log to the working directory # so this is kept as an implementation detail - eval "$NEXTSTRAIN_BUILD_COMMAND" |& tee .git/"$NEXTSTRAIN_BUILD_LOG" + eval "$NEXTSTRAIN_BUILD_COMMAND" |& tee .git/"$NEXTSTRAIN_BUILD_LOG" || exit_status=$? mv .git/"$NEXTSTRAIN_BUILD_LOG" "$NEXTSTRAIN_BUILD_LOG" + exit $exit_status # Attempt to get the AWS Batch ID even if the run build command failed # as long as the runtime is `aws-batch` and the `NEXTSTRAIN_BUILD_LOG` file exists - if: ${{ always() && inputs.runtime == 'aws-batch' && hashFiles(env.NEXTSTRAIN_BUILD_LOG) != '' }} diff --git a/.github/workflows/pathogen-repo-build.yaml.in b/.github/workflows/pathogen-repo-build.yaml.in index cef0f5c..53cfc62 100644 --- a/.github/workflows/pathogen-repo-build.yaml.in +++ b/.github/workflows/pathogen-repo-build.yaml.in @@ -310,13 +310,15 @@ jobs: # shellcheck disable=SC2154 set -x + exit_status=0 # tee build output to .git/ to avoid # https://github.com/nextstrain/.github/issues/77#issuecomment-1998652064 # After build is complete, move .git/build.log to the working directory # so this is kept as an implementation detail - eval "$NEXTSTRAIN_BUILD_COMMAND" |& tee .git/"$NEXTSTRAIN_BUILD_LOG" + eval "$NEXTSTRAIN_BUILD_COMMAND" |& tee .git/"$NEXTSTRAIN_BUILD_LOG" || exit_status=$? mv .git/"$NEXTSTRAIN_BUILD_LOG" "$NEXTSTRAIN_BUILD_LOG" + exit $exit_status # Attempt to get the AWS Batch ID even if the run build command failed # as long as the runtime is `aws-batch` and the `NEXTSTRAIN_BUILD_LOG` file exists