Skip to content

Commit

Permalink
Merge pull request #101 from nextstrain/pathogen-repo-build-grab-bag
Browse files Browse the repository at this point in the history
`pathogen-repo-build` improvements
  • Loading branch information
joverlee521 authored Jun 21, 2024
2 parents 18e3f79 + e5d5d4f commit 2e5550a
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 1 deletion.
33 changes: 32 additions & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ jobs:
id-token: write
strategy:
matrix:
runtime: [docker, conda, aws-batch]
runtime: [docker, conda]
uses: ./.github/workflows/pathogen-repo-build.yaml
with:
repo: nextstrain/zika-tutorial
Expand All @@ -60,6 +60,37 @@ jobs:
BOGUS_ENVVAR: BOGUS_ENVVAR
secrets: inherit

# This job has to be separate from the matrix above because we want
# to check the aws-batch-job-id output from the workflow but matrix outputs
# currently will overwrite each other.
# See <https://github.com/orgs/community/discussions/26639>
test-pathogen-repo-build-aws-batch:
permissions:
id-token: write
uses: ./.github/workflows/pathogen-repo-build.yaml
with:
repo: nextstrain/zika-tutorial
runtime: aws-batch
run: nextstrain build --env BOGUS_ENVVAR .
artifact-name: build-output-aws-batch
env: |
BOGUS_ENVVAR: BOGUS_ENVVAR
secrets: inherit

test-pathogen-repo-build-aws-batch-id-output:
needs: [test-pathogen-repo-build-aws-batch]
permissions:
id-token: write
uses: ./.github/workflows/pathogen-repo-build.yaml
with:
repo: nextstrain/zika-tutorial
runtime: aws-batch
run: nextstrain build --attach "$AWS_BATCH_JOB_ID" .
artifact-name: build-output-aws-batch-reattached
env: |
AWS_BATCH_JOB_ID: ${{ needs.test-pathogen-repo-build-aws-batch.outputs.aws-batch-job-id }}
secrets: inherit

lint:
runs-on: ubuntu-latest
steps:
Expand Down
11 changes: 11 additions & 0 deletions .github/workflows/pathogen-repo-build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,16 @@ on:
This is not supported for builds on AWS Batch because the workflow detaches from the build. Please use the `nextstrain build` command locally to reattach to AWS Batch builds to download outputs.
type: string
required: false
outputs:
aws-batch-job-id:
description: >-
AWS Batch job id of the build if it was run with the `aws-batch` runtime. This can be used to re-attach to the AWS Batch job with:
nextstrain build --aws-batch --attach <aws-batch-job-id>
This can be useful to download results from the build and use them in subsequent jobs.
value: ${{ jobs.run-build.outputs.AWS_BATCH_JOB_ID }}
workflow_dispatch:
inputs:
runtime:
Expand Down Expand Up @@ -287,6 +297,7 @@ jobs:
"$NEXTSTRAIN_GITHUB_DIR"/bin/write-envdir "$NEXTSTRAIN_RUNTIME_ENVDIR" \
AWS_ACCESS_KEY_ID \
AWS_SECRET_ACCESS_KEY \
AWS_DEFAULT_REGION \
${AWS_SESSION_TOKEN:+AWS_SESSION_TOKEN}
# This will overwrite the runtime AWS credential envvars configured above
# so if the build is using the aws-batch runtime, the Nextstrain CLI will
Expand Down
14 changes: 14 additions & 0 deletions .github/workflows/pathogen-repo-build.yaml.in
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,19 @@ on:
type: string
required: false

outputs:
aws-batch-job-id:
description: >-
AWS Batch job id of the build if it was run with the `aws-batch` runtime.
This can be used to re-attach to the AWS Batch job with:

nextstrain build --aws-batch --attach <aws-batch-job-id>

This can be useful to download results from the build and use them
in subsequent jobs.

value: ${{ jobs.run-build.outputs.AWS_BATCH_JOB_ID }}

workflow_dispatch:
inputs:
<<: *inputs
Expand Down Expand Up @@ -256,6 +269,7 @@ jobs:
"$NEXTSTRAIN_GITHUB_DIR"/bin/write-envdir "$NEXTSTRAIN_RUNTIME_ENVDIR" \
AWS_ACCESS_KEY_ID \
AWS_SECRET_ACCESS_KEY \
AWS_DEFAULT_REGION \
${AWS_SESSION_TOKEN:+AWS_SESSION_TOKEN}

# This will overwrite the runtime AWS credential envvars configured above
Expand Down

0 comments on commit 2e5550a

Please sign in to comment.