-
Notifications
You must be signed in to change notification settings - Fork 0
121 lines (115 loc) · 5.17 KB
/
run-e2e-tests.yaml
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
name: Run Teaspoons e2e tests with BEE using GCP workspace
on:
schedule:
# run once a day at 23:25 UTC every day of the work week
- cron: "25 23 * * 1-5"
workflow_dispatch:
inputs:
custom-app-version:
description: 'custom image tag to specify which version of teaspoons to deploy, e.g. `0.0.81-66ceced`. defaults to dev template if not specified.'
required: false
type: string
e2e-test-version-ref:
description: 'Name of branch or commit hash in the dsp-reusable-workflows repo to use. defaults to main'
required: true
default: 'main'
type: string
wdl-method-version:
description: 'Name of branch or release tag in the terra-scientific-pipelines-service repo to use for the test WDL. defaults to latest git release tag if not specified.'
required: false
type: string
env:
BEE_NAME: 'teaspoons-${{ github.run_id }}-${{ github.run_attempt}}-dev'
TOKEN: '${{ secrets.BROADBOT_TOKEN }}'
RUN_NAME_SUFFIX: ${{ github.event.repository.name }}-${{ github.run_id }}-${{github.run_attempt }}
jobs:
init-github-context-and-params-gen:
runs-on: ubuntu-latest
outputs:
delete-bee: '${{ steps.extract-inputs-and-generate-params.outputs.delete-bee }}'
custom-app-version-formatted: '${{ steps.extract-inputs-and-generate-params.outputs.custom-app-version-formatted }}'
project-name: '${{ steps.extract-inputs-and-generate-params.outputs.project_name }}'
bee-name: '${{ env.BEE_NAME }}'
wdl-method-version: '${{ steps.extract-inputs-and-generate-params.outputs.wdl-method-version }}'
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Get inputs or use defaults, generate other parameters
id: extract-inputs-and-generate-params
run: |
echo "delete-bee=${{ inputs.delete-bee || true }}" >> $GITHUB_OUTPUT
if [ -z ${{ inputs.custom-app-version }} ]; then
echo "custom-app-version-formatted={}" >> $GITHUB_OUTPUT
else
echo "custom-app-version-formatted={\\\"tsps\\\": {\\\"appVersion\\\":\\\"${{ inputs.custom-app-version }}\\\"} }" >> $GITHUB_OUTPUT
fi
project_name=$(echo "tmp-billing-project-$(uuidgen)" | cut -c -30)
echo "project_name=${project_name}" >> $GITHUB_OUTPUT
if [ -z ${{ inputs.wdl-method-version }} ]; then
echo "found latest git tag: $(git describe --tags $(git rev-list --tags --max-count=1))"
echo "wdl-method-version=$(git describe --tags $(git rev-list --tags --max-count=1))" >> $GITHUB_OUTPUT
else
echo "wdl-method-version=${{ inputs.wdl-method-version }}" >> $GITHUB_OUTPUT
fi
create-bee-workflow:
runs-on: ubuntu-latest
needs: [ init-github-context-and-params-gen ]
permissions:
contents: read
id-token: write
steps:
- name: Get actions
uses: actions/checkout@v4
- name: dispatch to terra-github-workflows
id: FirstAttemptCreateBee
continue-on-error: true
uses: ./.github/actions/create-bee
with:
run_name: "bee-create-${{ env.BEE_NAME }}"
bee_name: ${{ env.BEE_NAME }}
token: '${{ env.TOKEN }}'
custom_version_json: ${{ needs.init-github-context-and-params-gen.outputs.custom-app-version-formatted }}
- name: retry dispatch to terra-github-workflows in case of failure
if: steps.FirstAttemptCreateBee.outcome == 'failure'
uses: ./.github/actions/create-bee
with:
run_name: "bee-create-retry-${{ env.BEE_NAME }}"
bee_name: ${{ env.BEE_NAME }}
token: ${{ env.TOKEN }}
custom_version_json: ${{ needs.init-github-context-and-params-gen.outputs.custom-app-version-formatted }}
run-e2e-test-job:
needs:
- create-bee-workflow
- init-github-context-and-params-gen
permissions:
contents: read
id-token: write
uses: broadinstitute/dsp-reusable-workflows/.github/workflows/run_tsps_e2e_tests.yaml@main
with:
billing-project-name: '${{ needs.init-github-context-and-params-gen.outputs.project-name }}'
bee-name: '${{ needs.init-github-context-and-params-gen.outputs.bee-name }}'
e2e-test-version-ref: '${{ github.event.inputs.e2e-test-version-ref }}'
wdl-method-version: '${{ needs.init-github-context-and-params-gen.outputs.wdl-method-version }}'
destroy-bee-workflow:
runs-on: ubuntu-latest
needs:
- run-e2e-test-job
if: '${{ needs.init-github-context-and-params-gen.outputs.delete-bee && always() }}'
steps:
- name: dispatch to terra-github-workflows
uses: broadinstitute/workflow-dispatch@v3
with:
workflow: bee-destroy
repo: broadinstitute/terra-github-workflows
ref: refs/heads/main
wait-for-completion: false
token: '${{ env.TOKEN }}'
inputs: '{ "bee-name": "${{ env.BEE_NAME }}" }'
report-workflow:
uses: broadinstitute/sherlock/.github/workflows/client-report-workflow.yaml@main
if: github.ref == 'refs/heads/main'
with:
notify-slack-channels-upon-workflow-completion: "#terra-tsps-alerts"
permissions:
id-token: write