Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WX-983 Prototype Azure e2e workflow test #7202

Draft
wants to merge 24 commits into
base: develop
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
fdca4a2
WX-983 initial skeleton of workflow, checking if test call works and …
JVThomas Aug 14, 2023
27b4031
WX-983 fully commented out github context action
JVThomas Aug 14, 2023
5445798
WX-983 updated branch ref to point to testing/ticket branch
JVThomas Aug 14, 2023
69914ca
WX-983 swapping workflow_dispatch for push just to test workflow skel…
JVThomas Aug 14, 2023
474f485
WX-983 additional workflow updates
JVThomas Aug 22, 2023
cca2f44
WX-983 added basic e2e script, updated workflow script, need to test
JVThomas Aug 28, 2023
3cfd3ad
WX-983 adjusted print statement
JVThomas Aug 28, 2023
98031a3
WX-983 added branches attribute to workflow file
JVThomas Aug 28, 2023
ce6a0e9
WX-983 removed old comments, added push attribute
JVThomas Aug 28, 2023
98b9786
WX-983 added needs attribute to create-bee step, input reference update
JVThomas Aug 28, 2023
49ced65
WX-983 removed push attribute, changed needs and if conditions on som…
JVThomas Aug 29, 2023
82f6904
WX-983 syntax corrections, removed invalid branches attribute
JVThomas Aug 29, 2023
06596c1
WX-983 updates to env and action input variables
JVThomas Aug 29, 2023
d9b135f
WX-983 masked echoed token, step rearrangement, gitignore update
JVThomas Aug 29, 2023
1987a6f
WX-983 adjustments to variable assignment, sleep calls in workflow an…
JVThomas Sep 6, 2023
fd98f28
WX-983 minor updates
JVThomas Sep 11, 2023
a111fa9
WX-983 ref updates, use dev for bee template testing
JVThomas Sep 11, 2023
3dbd77f
WX-983 json correction, env variable renaming, still debugging workflow
JVThomas Sep 12, 2023
e5bb442
WX-983 added if conditional to attach step to check on access_token
JVThomas Sep 12, 2023
4ea80f6
WX-983 updated workflow to match new expectations from terra-github-w…
JVThomas Sep 12, 2023
e5f0b10
WX-983 adding always() condition to see if cleanup jobs still run on …
JVThomas Sep 15, 2023
970d24d
WX-983 going to just use always() just to test if condition
JVThomas Sep 15, 2023
b1f0276
WX-983 added missing comma
JVThomas Sep 15, 2023
06f7724
WX-983 path correction on workflow
JVThomas Sep 18, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
163 changes: 163 additions & 0 deletions .github/workflows/run_workflow.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,163 @@
name: 'Azure e2e - Run Workflow'
on:
workflow_dispatch:
inputs:
target-branch:
description: 'Branch of Cromwell to run tests on'
required: true
default: 'develop'
type: string
# Replace user data with seeded data provided by devOps (once available)
owner-subject:
description: 'Owner of billing project'
required: true
default: '[email protected]'
type: string
service-account:
description: 'Email address or unique identifier of the Google Cloud service account for which to generate credentials'
required: true
default: '[email protected]'
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 }}
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 || 'develop' }}" >> "$GITHUB_OUTPUT"

# This job provisions useful parameters for e2e tests, including access tokens.
# Please note: access tokens are for use in the same workflow, they cannot be dispatched to remote workflows.
params-gen:
runs-on: ubuntu-latest
permissions:
contents: 'read'
id-token: 'write'
outputs:
project-name: ${{ steps.gen.outputs.project_name }}
steps:
- name: Generate a random billing project name
id: 'gen'
run: |
project_name=$(echo "tmp-billing-project-$(uuidgen)" | cut -c -30)
echo "project_name=${project_name}" >> $GITHUB_OUTPUT

create-bee-workflow:
runs-on: ubuntu-latest
needs: [init-github-context, params-gen]
permissions:
contents: 'read'
id-token: 'write'
steps:
- name: Dispatch to terra-github-workflows
uses: broadinstitute/workflow-dispatch@v3
with:
workflow: bee-create
repo: broadinstitute/terra-github-workflows
ref: refs/heads/main
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 purposes I'm using dev
inputs: '{ "bee-name": "${{ env.BEE_NAME }}", "version-template": "dev" }'

create-and-attach-billing-project-to-landing-zone-workflow:
runs-on: ubuntu-latest
needs: [create-bee-workflow, params-gen]
steps:
- name: dispatch to terra-github-workflows
uses: broadinstitute/workflow-dispatch@v3
with:
workflow: attach-billing-project-to-landing-zone.yaml
repo: broadinstitute/terra-github-workflows
ref: refs/heads/main
token: ${{ env.BROADBOT_TOKEN }}
inputs: '{
"run-name": "attach-billing-project-to-landing-zone-${{ env.RUN_NAME_SUFFIX }}",
"bee-name": "${{ env.BEE_NAME }}",
"billing-project": "${{ needs.params-gen.outputs.project-name }}",
"billing-project-creator": "${{ inputs.owner-subject }}",
"service-account": "${{inputs.service-account}}" }'

run-cromwell-az-e2e:
runs-on: ubuntu-latest
needs: [params-gen, create-and-attach-billing-project-to-landing-zone-workflow]
permissions:
contents: 'read'
id-token: 'write'
steps:
- uses: 'actions/checkout@v3'
- name: Generate OAuth2 2.0 access token for owner
id: 'owner_auth'
uses: google-github-actions/auth@v1
with:
token_format: 'access_token'
workload_identity_provider: 'projects/1038484894585/locations/global/workloadIdentityPools/github-wi-pool/providers/github-wi-provider'
service_account: ${{ inputs.service-account }}
access_token_scopes: 'profile, email, openid'
access_token_subject: ${{ inputs.owner-subject }}
export_environment_variables: false
create_credentials_file: false
- uses: actions/checkout@v3
with:
#NOTE: replace with ${{inputs.target-branch}} before merge
ref: refs/heads/WX-983
- name: Install poetry
uses: snok/install-poetry@v1
- name: Run e2e test
env:
BEE_NAME: ${{env.BEE_NAME}}
BILLING_PROJECT_NAME: ${{needs.params-gen.outputs.project-name}}
BEARER_TOKEN: ${{ steps.owner_auth.outputs.access_token }}
run: |
poetry run python server/src/test/python/cromwell-az-e2e/tests/az-e2e.py

delete-billing-project-v2-from-bee-workflow:
runs-on: ubuntu-latest
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
uses: broadinstitute/workflow-dispatch@v3
with:
workflow: .github/workflows/delete-billing-project-v2-from-bee.yaml
repo: broadinstitute/terra-github-workflows
ref: refs/heads/main
token: ${{ env.BROADBOT_TOKEN }}
inputs: '{
"run-name": "delete-billing-project-v2-from-bee-${{ env.RUN_NAME_SUFFIX }}",
"bee-name": "${{ env.BEE_NAME }}",
"billing-project": "${{ needs.params-gen.outputs.project-name }}",
"billing-project-owner": "${{ inputs.owner-subject }}",
"service-account": "${{ inputs.service-account }}",
"silent-on-failure": "false" }'

destroy-bee-workflow:
runs-on: ubuntu-latest
# QUESTION: Can a billing project be deleted if the bee is deleted?
# QUESTION: Can a billing project be deleted if the bee is still tied to it?
needs: [create-bee-workflow, delete-billing-project-v2-from-bee-workflow]
if: always()
permissions:
contents: 'read'
id-token: 'write'
steps:
- name: dispatch to terra-github-workflows
uses: broadinstitute/workflow-dispatch@v3
with:
workflow: bee-destroy.yaml
repo: broadinstitute/terra-github-workflows
ref: refs/heads/main
token: ${{ env.BROADBOT_TOKEN }}
inputs: '{ "bee-name": "${{ env.BEE_NAME }}" }'
wait-for-completion: true
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ console_output.txt
expected.json
run_mode_metadata.json

#bloop files
/.bloop

# custom config
cromwell-executions
cromwell-test-executions
Expand Down Expand Up @@ -55,3 +58,6 @@ tesk_application.conf
**/venv/
exome_germline_single_sample_v1.3/
**/*.pyc

# GHA credentials
gha-creds-*.json
Empty file.
Loading
Loading