Skip to content

Commit

Permalink
Clean up inputs
Browse files Browse the repository at this point in the history
  • Loading branch information
jgainerdewar committed Oct 25, 2023
1 parent 9fffafc commit abd7372
Showing 1 changed file with 16 additions and 32 deletions.
48 changes: 16 additions & 32 deletions .github/workflows/run_workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,27 +22,10 @@ on:
type: string

env:
BEE_NAME: '${{ github.event.repository.name }}-${{ github.run_id }}-${{ github.run_attempt}}-dev'
BROADBOT_TOKEN: '${{ secrets.BROADBOT_GITHUB_TOKEN }}' # github token for access to kick off a job in the private repo
RUN_NAME_SUFFIX: '${{ github.event.repository.name }}-${{ github.run_id }}-${{ github.run_attempt }}'

jobs:
init-github-context:
runs-on: ubuntu-latest
outputs:
branch: ${{ steps.extract-inputs.outputs.branch }}
owner-subject: ${{ steps.extract-inputs.outputs.owner-subject }}
service-account: ${{ steps.extract-inputs.outputs.service-account }}
bee-name: '${{ github.event.repository.name }}-${{ github.run_id }}-${{ github.run_attempt}}-dev'
steps:
# NOTE: below was included in the rawls template but seems redundant due to defined values up on top
# Remove if it ends up being unecessary
- name: Get inputs or use defaults
id: extract-inputs
run: |
echo "branch=${{ inputs.target-branch || 'main' }}" >> "$GITHUB_OUTPUT"
echo "owner-subject=${{ inputs.owner-subject || 'hermione.owner@quality.firecloud.org' }}" >> "$GITHUB_OUTPUT"
echo "service-account=${{ inputs.service-account || 'firecloud-qa@broad-dsde-qa.iam.gserviceaccount.com' }}" >> "$GITHUB_OUTPUT"

# This job provisions useful parameters for e2e tests
params-gen:
Expand All @@ -52,6 +35,7 @@ jobs:
id-token: 'write'
outputs:
project-name: ${{ steps.gen.outputs.project_name }}
bee-name: '${{ github.event.repository.name }}-${{ github.run_id }}-${{ github.run_attempt}}-dev'
steps:
- name: Generate a random billing project name
id: 'gen'
Expand All @@ -61,7 +45,7 @@ jobs:
create-bee-workflow:
runs-on: ubuntu-latest
needs: [init-github-context, params-gen]
needs: [params-gen]
permissions:
contents: 'read'
id-token: 'write'
Expand All @@ -75,11 +59,11 @@ jobs:
token: ${{ env.BROADBOT_TOKEN }}
# NOTE: Opting to use "prod" instead of custom tag since I specifically want to test against the current prod state
# NOTE: For testing/development purposes I'm using dev
inputs: '{ "bee-name": "${{ env.BEE_NAME }}", "version-template": "dev", "bee-template-name": "rawls-e2e-azure-tests"}'
inputs: '{ "bee-name": "${{ needs.params-gen.outputs.bee-name }}", "version-template": "dev", "bee-template-name": "rawls-e2e-azure-tests"}'

create-and-attach-billing-project-to-landing-zone-workflow:
runs-on: ubuntu-latest
needs: [create-bee-workflow, init-github-context, params-gen]
needs: [create-bee-workflow, params-gen]
steps:
- name: dispatch to terra-github-workflows
uses: broadinstitute/workflow-dispatch@v3
Expand All @@ -90,26 +74,26 @@ jobs:
token: ${{ env.BROADBOT_TOKEN }}
inputs: '{
"run-name": "attach-billing-project-to-landing-zone-${{ env.RUN_NAME_SUFFIX }}",
"bee-name": "${{ env.BEE_NAME }}",
"bee-name": "${{ needs.params-gen.outputs.bee-name }}",
"billing-project": "${{ needs.params-gen.outputs.project-name }}",
"billing-project-creator": "${{ needs.init-github-context.outputs.owner-subject }}",
"service-account": "${{needs.init-github-context.outputs.service-account}}" }'
"billing-project-creator": "${{ inputs.owner-subject }}",
"service-account": "${{inputs.service-account}}" }'

run-cromwell-az-e2e:
needs: [init-github-context, params-gen, create-and-attach-billing-project-to-landing-zone-workflow]
needs: [params-gen, create-and-attach-billing-project-to-landing-zone-workflow]
permissions:
contents: read
id-token: write
uses: "broadinstitute/dsp-reusable-workflows/.github/workflows/cromwell-az-e2e-test.yaml@WX-1307-port"
with:
branch: "${{ needs.init-github-context.outputs.branch }}"
bee-name: "${{ needs.init-github-context.outputs.bee-name }}"
branch: "${{ inputs.target-branch }}"
bee-name: "${{ needs.params-gen.outputs.bee-name }}"
billing-project-name: "${{ needs.params-gen.outputs.project-name }}"

delete-billing-project-v2-from-bee-workflow:
continue-on-error: true
runs-on: ubuntu-latest
needs: [init-github-context, run-cromwell-az-e2e, create-and-attach-billing-project-to-landing-zone-workflow, params-gen]
needs: [run-cromwell-az-e2e, create-and-attach-billing-project-to-landing-zone-workflow, params-gen]
if: always()
steps:
- name: dispatch to terra-github-workflows
Expand All @@ -121,15 +105,15 @@ jobs:
token: ${{ env.BROADBOT_TOKEN }}
inputs: '{
"run-name": "delete-billing-project-v2-from-bee-${{ env.RUN_NAME_SUFFIX }}",
"bee-name": "${{ env.BEE_NAME }}",
"bee-name": "${{ needs.params-gen.outputs.bee-name }}",
"billing-project": "${{ needs.params-gen.outputs.project-name }}",
"billing-project-owner": "${{ needs.init-github-context.outputs.owner-subject }}",
"service-account": "${{ needs.init-github-context.outputs.service-account }}",
"billing-project-owner": "${{ inputs.owner-subject }}",
"service-account": "${{ inputs.service-account }}",
"silent-on-failure": "false" }'

destroy-bee-workflow:
runs-on: ubuntu-latest
needs: [create-bee-workflow, delete-billing-project-v2-from-bee-workflow]
needs: [params-gen, create-bee-workflow, delete-billing-project-v2-from-bee-workflow]
if: always()
permissions:
contents: 'read'
Expand All @@ -142,7 +126,7 @@ jobs:
repo: broadinstitute/terra-github-workflows
ref: refs/heads/main
token: ${{ env.BROADBOT_TOKEN }}
inputs: '{ "bee-name": "${{ env.BEE_NAME }}" }'
inputs: '{ "bee-name": "${{ needs.params-gen.outputs.bee-name }}" }'
wait-for-completion: true

report-workflow:
Expand Down

0 comments on commit abd7372

Please sign in to comment.