From f4c292c2d3f9c32f6e0e0e0d94e31b9c94de97df Mon Sep 17 00:00:00 2001 From: Jover Lee Date: Thu, 15 Feb 2024 12:08:59 -0800 Subject: [PATCH 1/2] Fix trial builds for rebuild workflows MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @tsibley flagged internally¹ that a trial build for mpxv² did not work as expected. The trial build did not work for a couple reasons: 1. the `TRIAL_NAME` envvar was not ported over to be provided as an env input when we switched to the pathogen-repo-build workflow³ 2. the default deploy_url was updated to "s3://nextstrain-data" in the nextstrain_automation.yaml⁴ but was not configured for the trial builds This commit fixes both by creating a separate job to configure the config overrides needed for trial builds. ¹ https://bedfordlab.slack.com/archives/C03J4JG4ZE0/p1707781980142229?thread_ts=1707780683.405599&cid=C03J4JG4ZE0 ² https://github.com/nextstrain/mpox/actions/runs/7879309419 ³ https://github.com/nextstrain/mpox/commit/7e5cc6746244c4cd68451c801fcbf1fdf5be76c4 ⁴ https://github.com/nextstrain/mpox/commit/4017f513d7b74de039153ffa3551d131458b2785 --- .github/workflows/rebuild-hmpxv1-big.yaml | 29 ++++++++++++++++++----- .github/workflows/rebuild-hmpxv1.yaml | 29 ++++++++++++++++++----- .github/workflows/rebuild-mpxv.yaml | 29 ++++++++++++++++++----- 3 files changed, 69 insertions(+), 18 deletions(-) diff --git a/.github/workflows/rebuild-hmpxv1-big.yaml b/.github/workflows/rebuild-hmpxv1-big.yaml index e8f3f23c..eb32cb28 100644 --- a/.github/workflows/rebuild-hmpxv1-big.yaml +++ b/.github/workflows/rebuild-hmpxv1-big.yaml @@ -9,18 +9,34 @@ on: workflow_dispatch: inputs: trial_name: - description: "If set, result will be at nextstrain.org/staging/trial/trial_name/mpox/mpxv" + description: "If set, result will be at nextstrain.org/staging/trial/${trial_name}/${auspice_name}" required: false image: description: 'Specific container image to use for build (will override the default of "nextstrain build")' required: false -env: - TRIAL_NAME: ${{ github.event.inputs.trial_name }} - NEXTSTRAIN_DOCKER_IMAGE: ${{ github.event.inputs.image }} - jobs: + set_config_overrides: + runs-on: ubuntu-latest + steps: + - id: config + name: Set config overrides + env: + TRIAL_NAME: ${{ inputs.trial_name }} + run: | + config="" + if [[ "$TRIAL_NAME" ]]; then + config+="--config" + config+=" deploy_url='s3://nextstrain-staging/'" + config+=" auspice_prefix='"$TRIAL_NAME"'" + fi + + echo "config=$config" >> "$GITHUB_OUTPUT" + outputs: + config_overrides: ${{ steps.config.outputs.config }} + rebuild_hmpxv1_big: + needs: [set_config_overrides] permissions: id-token: write uses: nextstrain/.github/.github/workflows/pathogen-repo-build.yaml@master @@ -29,6 +45,7 @@ jobs: runtime: aws-batch env: | NEXTSTRAIN_DOCKER_IMAGE: ${{ inputs.image }} + CONFIG_OVERRIDES: ${{ needs.set_config_overrides.outputs.config_overrides }} GITHUB_RUN_ID: ${{ github.run_id }} SLACK_CHANNELS: ${{ vars.SLACK_CHANNELS }} BUILD_DIR: phylogenetic @@ -47,4 +64,4 @@ jobs: . \ notify_on_deploy \ --configfiles $BUILD_DIR/config/$BUILD_NAME/config.yaml $BUILD_DIR/config/nextstrain_automation.yaml \ - --config auspice_prefix=$TRIAL_NAME --directory $BUILD_DIR --snakefile $BUILD_DIR/Snakefile + $CONFIG_OVERRIDES --directory $BUILD_DIR --snakefile $BUILD_DIR/Snakefile diff --git a/.github/workflows/rebuild-hmpxv1.yaml b/.github/workflows/rebuild-hmpxv1.yaml index 75c931ef..72948508 100644 --- a/.github/workflows/rebuild-hmpxv1.yaml +++ b/.github/workflows/rebuild-hmpxv1.yaml @@ -9,18 +9,34 @@ on: workflow_dispatch: inputs: trial_name: - description: "If set, result will be at nextstrain.org/staging/trial/trial_name/mpox/mpxv" + description: "If set, result will be at nextstrain.org/staging/trial/${trial_name}/${auspice_name}" required: false image: description: 'Specific container image to use for build (will override the default of "nextstrain build")' required: false -env: - TRIAL_NAME: ${{ github.event.inputs.trial_name }} - NEXTSTRAIN_DOCKER_IMAGE: ${{ github.event.inputs.image }} - jobs: + set_config_overrides: + runs-on: ubuntu-latest + steps: + - id: config + name: Set config overrides + env: + TRIAL_NAME: ${{ inputs.trial_name }} + run: | + config="" + if [[ "$TRIAL_NAME" ]]; then + config+="--config" + config+=" deploy_url='s3://nextstrain-staging/'" + config+=" auspice_prefix='"$TRIAL_NAME"'" + fi + + echo "config=$config" >> "$GITHUB_OUTPUT" + outputs: + config_overrides: ${{ steps.config.outputs.config }} + rebuild_hmpxv1: + needs: [set_config_overrides] permissions: id-token: write uses: nextstrain/.github/.github/workflows/pathogen-repo-build.yaml@master @@ -29,6 +45,7 @@ jobs: runtime: aws-batch env: | NEXTSTRAIN_DOCKER_IMAGE: ${{ inputs.image }} + CONFIG_OVERRIDES: ${{ needs.set_config_overrides.outputs.config_overrides }} GITHUB_RUN_ID: ${{ github.run_id }} SLACK_CHANNELS: ${{ vars.SLACK_CHANNELS }} BUILD_DIR: phylogenetic @@ -47,4 +64,4 @@ jobs: . \ notify_on_deploy \ --configfiles $BUILD_DIR/config/$BUILD_NAME/config.yaml $BUILD_DIR/config/nextstrain_automation.yaml \ - --config auspice_prefix=$TRIAL_NAME --directory $BUILD_DIR --snakefile $BUILD_DIR/Snakefile + $CONFIG_OVERRIDES --directory $BUILD_DIR --snakefile $BUILD_DIR/Snakefile diff --git a/.github/workflows/rebuild-mpxv.yaml b/.github/workflows/rebuild-mpxv.yaml index 4650af3b..4e799b70 100644 --- a/.github/workflows/rebuild-mpxv.yaml +++ b/.github/workflows/rebuild-mpxv.yaml @@ -9,18 +9,34 @@ on: workflow_dispatch: inputs: trial_name: - description: "If set, result will be at nextstrain.org/staging/trial/trial_name/mpox/mpxv" + description: "If set, result will be at nextstrain.org/staging/trial/${trial_name}/${auspice_name}" required: false image: description: 'Specific container image to use for build (will override the default of "nextstrain build")' required: false -env: - TRIAL_NAME: ${{ github.event.inputs.trial_name }} - NEXTSTRAIN_DOCKER_IMAGE: ${{ github.event.inputs.image }} - jobs: + set_config_overrides: + runs-on: ubuntu-latest + steps: + - id: config + name: Set config overrides + env: + TRIAL_NAME: ${{ inputs.trial_name }} + run: | + config="" + if [[ "$TRIAL_NAME" ]]; then + config+="--config" + config+=" deploy_url='s3://nextstrain-staging/'" + config+=" auspice_prefix='"$TRIAL_NAME"'" + fi + + echo "config=$config" >> "$GITHUB_OUTPUT" + outputs: + config_overrides: ${{ steps.config.outputs.config }} + rebuild_mpxv: + needs: [set_config_overrides] permissions: id-token: write uses: nextstrain/.github/.github/workflows/pathogen-repo-build.yaml@master @@ -29,6 +45,7 @@ jobs: runtime: aws-batch env: | NEXTSTRAIN_DOCKER_IMAGE: ${{ inputs.image }} + CONFIG_OVERRIDES: ${{ needs.set_config_overrides.outputs.config_overrides }} GITHUB_RUN_ID: ${{ github.run_id }} SLACK_CHANNELS: ${{ vars.SLACK_CHANNELS }} BUILD_DIR: phylogenetic @@ -47,4 +64,4 @@ jobs: . \ notify_on_deploy \ --configfiles $BUILD_DIR/config/$BUILD_NAME/config.yaml $BUILD_DIR/config/nextstrain_automation.yaml \ - --config auspice_prefix=$TRIAL_NAME --directory $BUILD_DIR --snakefile $BUILD_DIR/Snakefile + $CONFIG_OVERRIDES --directory $BUILD_DIR --snakefile $BUILD_DIR/Snakefile From 85e3364ddc8f64f29f70368cfb5a0246973102b1 Mon Sep 17 00:00:00 2001 From: Jover Lee Date: Thu, 15 Feb 2024 12:09:38 -0800 Subject: [PATCH 2/2] rebuilds: Use TEST_SLACK_CHANNEL for trial builds MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Instead of mixing in trial builds Slack messages with the automated builds, send the Slack messages to the `TEST_SLACK_CHANNEL` set in the repo's action variables¹ (currently the #scratch channel). ¹ https://github.com/nextstrain/mpox/settings/variables/actions --- .github/workflows/rebuild-hmpxv1-big.yaml | 2 +- .github/workflows/rebuild-hmpxv1.yaml | 2 +- .github/workflows/rebuild-mpxv.yaml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/rebuild-hmpxv1-big.yaml b/.github/workflows/rebuild-hmpxv1-big.yaml index eb32cb28..717532ab 100644 --- a/.github/workflows/rebuild-hmpxv1-big.yaml +++ b/.github/workflows/rebuild-hmpxv1-big.yaml @@ -47,7 +47,7 @@ jobs: NEXTSTRAIN_DOCKER_IMAGE: ${{ inputs.image }} CONFIG_OVERRIDES: ${{ needs.set_config_overrides.outputs.config_overrides }} GITHUB_RUN_ID: ${{ github.run_id }} - SLACK_CHANNELS: ${{ vars.SLACK_CHANNELS }} + SLACK_CHANNELS: ${{ inputs.trial_name && vars.TEST_SLACK_CHANNEL || vars.SLACK_CHANNELS }} BUILD_DIR: phylogenetic BUILD_NAME: hmpxv1_big run: | diff --git a/.github/workflows/rebuild-hmpxv1.yaml b/.github/workflows/rebuild-hmpxv1.yaml index 72948508..0802f522 100644 --- a/.github/workflows/rebuild-hmpxv1.yaml +++ b/.github/workflows/rebuild-hmpxv1.yaml @@ -47,7 +47,7 @@ jobs: NEXTSTRAIN_DOCKER_IMAGE: ${{ inputs.image }} CONFIG_OVERRIDES: ${{ needs.set_config_overrides.outputs.config_overrides }} GITHUB_RUN_ID: ${{ github.run_id }} - SLACK_CHANNELS: ${{ vars.SLACK_CHANNELS }} + SLACK_CHANNELS: ${{ inputs.trial_name && vars.TEST_SLACK_CHANNEL || vars.SLACK_CHANNELS }} BUILD_DIR: phylogenetic BUILD_NAME: hmpxv1 run: | diff --git a/.github/workflows/rebuild-mpxv.yaml b/.github/workflows/rebuild-mpxv.yaml index 4e799b70..f07f77b7 100644 --- a/.github/workflows/rebuild-mpxv.yaml +++ b/.github/workflows/rebuild-mpxv.yaml @@ -47,7 +47,7 @@ jobs: NEXTSTRAIN_DOCKER_IMAGE: ${{ inputs.image }} CONFIG_OVERRIDES: ${{ needs.set_config_overrides.outputs.config_overrides }} GITHUB_RUN_ID: ${{ github.run_id }} - SLACK_CHANNELS: ${{ vars.SLACK_CHANNELS }} + SLACK_CHANNELS: ${{ inputs.trial_name && vars.TEST_SLACK_CHANNEL || vars.SLACK_CHANNELS }} BUILD_DIR: phylogenetic BUILD_NAME: mpxv run: |