-
Notifications
You must be signed in to change notification settings - Fork 360
146 lines (138 loc) · 6.35 KB
/
run_workflow.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
name: 'Azure e2e - Run Workflow'
on:
schedule:
- cron: '0 16 * * *' # UTC 4pm, EST 11am, EDT 12pm
workflow_dispatch:
inputs:
target-branch:
description: 'Branch name of Cromwell repo 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: 'cromwell-6591295034-1-dev' #'${{ 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: 'cromwell-6591295034-1-dev' #'${{ 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 || '[email protected]' }}" >> "$GITHUB_OUTPUT"
echo "service-account=${{ inputs.service-account || '[email protected]' }}" >> "$GITHUB_OUTPUT"
# This job provisions useful parameters for e2e tests
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/development purposes I'm using dev
# inputs: '{ "bee-name": "${{ env.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: [init-github-context, 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": "${{ needs.init-github-context.outputs.owner-subject }}",
"service-account": "${{needs.init-github-context.outputs.service-account}}" }'
run-cromwell-az-e2e:
needs: [init-github-context, 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 }}"
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]
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": "${{ needs.init-github-context.outputs.owner-subject }}",
"service-account": "${{ needs.init-github-context.outputs.service-account }}",
"silent-on-failure": "false" }'
# destroy-bee-workflow:
# runs-on: ubuntu-latest
# 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