From 99b830efb70846b0ade1feb23bdc6c89aa8305b4 Mon Sep 17 00:00:00 2001 From: Jover Date: Wed, 13 Sep 2023 10:40:25 -0700 Subject: [PATCH] ingest workflow: Add trial_name input Allow trial runs to be uploaded to the S3 bucket with the additional `/trial/` prefix and do not trigger rebuilds when doing a trial run. This was easily done because the `s3_dst` has been made a top level config param in the previous commit. --- .github/workflows/fetch-and-ingest.yaml | 37 +++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/.github/workflows/fetch-and-ingest.yaml b/.github/workflows/fetch-and-ingest.yaml index 035e3e0..c190244 100644 --- a/.github/workflows/fetch-and-ingest.yaml +++ b/.github/workflows/fetch-and-ingest.yaml @@ -26,9 +26,40 @@ on: # Manually triggered using GitHub's UI workflow_dispatch: + inputs: + trial_name: + description: 'Short name for a trial run. WARNING: without this we will overwrite files in s3://nextstrain-data/files/workflows/rsv' jobs: + set_config_overrides: + runs-on: ubuntu-latest + steps: + - id: s3_dst + run: | + S3_DST=s3://nextstrain-data/files/workflows/rsv + + if [[ -n "$TRIAL_NAME" ]]; then + S3_DST+=/trial/"$TRIAL_NAME" + fi + + echo "s3_dst=$S3_DST" >> "$GITHUB_OUTPUT" + env: + TRIAL_NAME: ${{ inputs.trial_name }} + - id: trigger_rebuild + run: | + TRIGGER_REBUILD=true + + if [[ -n "$TRIAL_NAME" ]]; then + TRIGGER_REBUILD=false + fi + + echo "trigger_rebuild=$TRIGGER_REBUILD" >> "$GITHUB_OUTPUT" + outputs: + s3_dst: ${{ steps.s3_dst.outputs.s3_dst }} + trigger_rebuild: ${{ steps.trigger_rebuild.outputs.trigger_rebuild }} + fetch-and-ingest: + needs: [set_config_overrides] permissions: id-token: write uses: nextstrain/.github/.github/workflows/pathogen-repo-build.yaml@master @@ -45,6 +76,12 @@ jobs: --env AWS_ACCESS_KEY_ID \ --env AWS_SECRET_ACCESS_KEY \ --env PAT_GITHUB_DISPATCH="$GH_TOKEN_NEXTSTRAIN_BOT_WORKFLOW_DISPATCH" \ + --env S3_DST \ + --env TRIGGER_REBUILD \ ingest \ --configfiles config/config.yaml config/optional.yaml \ + --config s3_dst="$S3_DST" trigger_rebuild="$TRIGGER_REBUILD" \ --printshellcmds + env: | + S3_DST: ${{ needs.set_config_overrides.outputs.s3_dst }} + TRIGGER_REBUILD: ${{ needs.set_config_overrides.outputs.trigger_rebuild }}