-
Notifications
You must be signed in to change notification settings - Fork 7
168 lines (142 loc) · 6.15 KB
/
release-promotion-tests.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
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
# This workflow will build a Java project with Gradle on promotion of WSM to the terra staging environment
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-gradle
name: Release Promotion Tests
on:
workflow_dispatch: {}
jobs:
release-promotion-tests:
runs-on: ubuntu-latest
# required for IAP authentication - see terra-helmfile-shim
permissions:
contents: 'read'
id-token: 'write'
steps:
- uses: actions/checkout@v3
- name: Set env
id: set-env-step
run: |
if ${{ github.event_name == 'workflow_dispatch' }}; then
ENV=${{ github.event.inputs.testEnv }}
else
echo ::error ::${{ github.event_name }} not supported for this workflow
exit 1
fi
echo test-env=staging >> $GITHUB_OUTPUT
#
#
# 2022-12-15 DDO-2528 terra-helmfile shim
# Release version information has been migrated to Sherlock.
# These two steps add a temporary shim to simulate the old versions file format
# until testrunner can be configured to talk to it.
#
# Set up auth to Sherlock
- name: "Authenticate to GCP"
id: 'iap_auth'
uses: google-github-actions/auth@v1
with:
workload_identity_provider: 'projects/1038484894585/locations/global/workloadIdentityPools/github-wi-pool/providers/github-wi-provider'
service_account: '[email protected]'
token_format: 'id_token'
id_token_audience: '257801540345-1gqi6qi66bjbssbv01horu9243el2r8b.apps.googleusercontent.com'
id_token_include_email: true
create_credentials_file: false
export_environment_variables: false
- name: "Generate GHA OIDC Token"
id: 'gha_auth'
uses: actions/github-script@v7
with:
script: core.setOutput('id_token', await core.getIDToken())
# Generate versions file
- name: terra-helmfile-shim
run: |
set -exo pipefail
ENV="staging"
SHERLOCK_URL="https://sherlock.dsp-devops-prod.broadinstitute.org"
OLD_TERRA_HELMFILE_DIR="integration/terra-helmfile"
VERSIONS_FILE="${OLD_TERRA_HELMFILE_DIR}/versions/app/${ENV}.yaml"
OVERRIDES_FILE="${OLD_TERRA_HELMFILE_DIR}/environments/live/${ENV}.yaml"
mkdir -p $( dirname "${VERSIONS_FILE}" )
mkdir -p $( dirname "${OVERRIDES_FILE}" )
# write an empty overrides file
echo "releases: {}" > "${OVERRIDES_FILE}"
#
# call the chart-releases endpoint to get a list of chart-releases in the target env
#
curl --fail \
-H 'Authorization: Bearer ${{ steps.iap_auth.outputs.id_token }}' \
-H 'X-GHA-OIDC-JWT: ${{ steps.gha_auth.outputs.id_token }}' \
"${SHERLOCK_URL}/api/chart-releases/v3?environment=${ENV}" \
> /tmp/.chart-releases.json
#
# use jq to massage the output into the old versions file format, which looks like:
# releases:
# workspacemanager:
# appVersion: 1.2.3
# chartVersion: 4.5.6
#
# happily, YAML is a superset of JSON so we don't need to do a format conversion
#
cat /tmp/.chart-releases.json |\
jq 'map({ (.chart): {appVersion: .appVersionExact, chartVersion: .chartVersionExact}}) | add | { releases: . }' \
> "${VERSIONS_FILE}"
echo "Wrote versions file to ${VERSIONS_FILE}:"
cat "${VERSIONS_FILE}"
- name: Set config files
id: set-config-files-step
run: |
TEST_SERVER=workspace-staging.json
TEST=suites/staging/FullIntegration.json
echo test-server=$TEST_SERVER >> $GITHUB_OUTPUT
echo test=$TEST >> $GITHUB_OUTPUT
- name: Set up JDK
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: 17
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3
- name: Write config
id: config
uses: ./.github/actions/write-credentials
with:
user-delegated-sa-b64: ${{ secrets.USER_DELEGATED_SA_STAGING }}
- name: Run the integration test suite
id: integration-test
if: ${{ always() }}
uses: ./.github/actions/integration-test
with:
test-server: ${{ steps.set-config-files-step.outputs.test-server }}
test: ${{ steps.set-config-files-step.outputs.test }}
- name: "Notify QA Slack"
if: always() && (steps.set-env-step.outputs.test-env == 'alpha' || steps.set-env-step.outputs.test-env == 'staging')
uses: broadinstitute/[email protected]
# see https://github.com/broadinstitute/action-slack
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
with:
status: ${{ job.status }}
channel: "#dsde-qa"
username: "Workspace Manager ${{ steps.set-env-step.outputs.test-env }} tests"
author_name: "Workspace Manager ${{ steps.set-env-step.outputs.test-env }} integrationTest"
fields: repo,job,workflow,commit,eventName,author,took
- name: "Notify Workspaces test failure Slack"
if: failure()
uses: broadinstitute/[email protected]
# see https://github.com/broadinstitute/action-slack
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
with:
status: ${{ job.status }}
channel: "#dsp-workspaces-test-alerts"
username: "Workspace Manager ${{ steps.set-env-step.outputs.test-env }} tests"
author_name: "Workspace Manager ${{ steps.set-env-step.outputs.test-env }} integrationTest"
fields: repo,job,workflow,commit,eventName,author,took
- name: Archive WSM and TestRunner logs
id: archive_logs
if: always()
uses: actions/upload-artifact@v3
with:
name: wsm-and-testrunner-logs
path: |
wsm.log
${{ steps.integration-test.outputs.results-dir }}