-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Expand file tree
/
Copy pathpreview-env-check-regressions.yml
More file actions
187 lines (175 loc) · 7.02 KB
/
preview-env-check-regressions.yml
File metadata and controls
187 lines (175 loc) · 7.02 KB
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
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
name: "Preview environment regression check"
permissions:
id-token: write # This is required for requesting the JWT
contents: read # This is required for actions/checkout
on:
workflow_run:
workflows: ["Build"]
types: [completed]
branches: ["main"]
workflow_dispatch:
inputs:
name:
required: true
description: "The name of the preview environment"
version:
required: true
description: "The version of Gitpod to install"
image_repo_base:
type: choice
required: false
description: "The base repo of image"
options:
- "eu.gcr.io/gitpod-core-dev/build"
- "eu.gcr.io/gitpod-dev-artifact/build"
default: "eu.gcr.io/gitpod-core-dev/build"
jobs:
configuration:
name: Configuration
runs-on: ubuntu-latest
outputs:
skip: ${{ steps.configuration.outputs.skip }}
name: ${{ steps.configuration.outputs.name }}
version: ${{ steps.configuration.outputs.version }}
image_repo_base: ${{ steps.configuration.outputs.image_repo_base }}
steps:
- name: "Set outputs"
id: configuration
run: |
if [[ '${{ github.event.inputs.name }}' != '' ]]; then
# The workflow was triggered by workflow_dispatch
{
echo "version=${{ github.event.inputs.version }}"
echo "name=${{ github.event.inputs.name }}"
echo "image_repo_base=${{ github.event.inputs.image_repo_base }}"
echo "skip=false"
} >> $GITHUB_OUTPUT
else
# The workflow was triggered by workflow_run
{
echo "version=main-gha.${{ github.event.workflow_run.run_number }}"
echo "name=preview-regression-check-main-${{ github.run_id }}-${{ github.run_attempt }}"
echo "image_repo_base=eu.gcr.io/gitpod-core-dev/build"
echo "skip=${{ github.event.workflow_run.conclusion == 'failure' }}"
} >> $GITHUB_OUTPUT
fi
infrastructure:
name: Create preview environment infrastructure
needs: [configuration]
runs-on: ubuntu-latest
container:
image: eu.gcr.io/gitpod-dev-artifact/dev/dev-environment:gpl-npm-oidc-support-gha.42
options: --user root
concurrency:
group: ${{ needs.configuration.outputs.name }}-infrastructure
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # pin@v4
- name: Setup Environment
uses: ./.github/actions/setup-environment
with:
identity_provider: ${{ secrets.DEV_PREVIEW_PROVIDER }}
service_account: ${{ secrets.DEV_PREVIEW_SA }}
leeway_segment_key: ${{ secrets.LEEWAY_SEGMENT_KEY }}
- name: Create preview environment infrastructure
id: create
uses: ./.github/actions/preview-create
with:
name: ${{ needs.configuration.outputs.name }}
large_vm: false
preemptible: true
- name: Deploy Gitpod to the preview environment
id: deploy-gitpod
uses: ./.github/actions/deploy-gitpod
with:
name: ${{ needs.configuration.outputs.name }}
version: ${{ needs.configuration.outputs.version}}
image_repo_base: ${{ needs.configuration.outputs.image_repo_base }}
check:
name: Check for regressions
needs: [configuration, infrastructure]
if: ${{ needs.configuration.outputs.skip == 'false' }}
runs-on: ubuntu-latest
container:
image: eu.gcr.io/gitpod-dev-artifact/dev/dev-environment:gpl-npm-oidc-support-gha.42
options: --user root
volumes:
- /var/tmp:/var/tmp
- /tmp:/tmp
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # pin@v4
- name: Setup Environment
uses: ./.github/actions/setup-environment
with:
identity_provider: ${{ secrets.DEV_PREVIEW_PROVIDER }}
service_account: ${{ secrets.DEV_PREVIEW_SA }}
leeway_segment_key: ${{ secrets.LEEWAY_SEGMENT_KEY }}
- name: Check
shell: bash
env:
ROBOQUAT_TOKEN: ${{ secrets.GITHUB_TOKEN }}
USERNAME: ${{ secrets.IDE_INTEGRATION_TEST_USERNAME }}
USER_TOKEN: ${{ secrets.IDE_INTEGRATION_TEST_USER_TOKEN }}
PREVIEW_NAME: ${{ needs.configuration.outputs.name }}
run: |
set -euo pipefail
export LEEWAY_WORKSPACE_ROOT="$(pwd)"
export HOME="/home/gitpod"
leeway run dev/preview/previewctl:install
previewctl install-context --branch "${PREVIEW_NAME}" --log-level debug --timeout 1m
# start integration test
args=()
args+=( "-kubeconfig=/home/gitpod/.kube/config" )
args+=( "-namespace=default" )
[[ "$USERNAME" != "" ]] && args+=( "-username=$USERNAME" )
args+=( "-timeout=60m" )
TESTS_DIR="$GITHUB_WORKSPACE/test/tests/smoke-test"
go install github.com/jstemmer/go-junit-report/v2@latest
echo "running integration for smoke test"
cd "${TESTS_DIR}"
set +e
go test -v ./... "${args[@]}" 2>&1 | go-junit-report -subtest-mode=exclude-parents -set-exit-code -out "TEST.xml" -iocopy
RC=${PIPESTATUS[0]}
set -e
if [ "${RC}" -ne "0" ]; then
exit ${RC}
fi
- name: Test Summary
id: test_summary
uses: test-summary/action@31493c76ec9e7aa675f1585d3ed6f1da69269a86 # pin@v2
with:
paths: "test/tests/**/TEST.xml"
if: always()
- id: auth
if: failure()
uses: google-github-actions/auth@955352c3b43196640b567e4646256d2fbb4aa1c7 # pin@v1
with:
token_format: access_token
credentials_json: "${{ secrets.GCP_CREDENTIALS }}"
- name: Slack Notification
uses: rtCamp/action-slack-notify@cdf0a2130cbcdfd82ba5fcac8e076370bf381b36 # pin@v2
if: failure()
env:
SLACK_WEBHOOK: "${{ secrets.DEVX_SLACK_WEBHOOK }}"
SLACK_COLOR: ${{ job.status }}
SLACK_MESSAGE: "`${{ needs.configuration.outputs.version}}` smoke test failed"
SLACK_FOOTER: "<https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}|Workflow logs>"
delete:
name: Delete preview environment
needs: [configuration, infrastructure, check]
if: always()
runs-on: ubuntu-latest
container:
image: eu.gcr.io/gitpod-dev-artifact/dev/dev-environment:gpl-npm-oidc-support-gha.42
options: --user root
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # pin@v4
- name: Setup Environment
uses: ./.github/actions/setup-environment
with:
identity_provider: ${{ secrets.DEV_PREVIEW_PROVIDER }}
service_account: ${{ secrets.DEV_PREVIEW_SA }}
leeway_segment_key: ${{ secrets.LEEWAY_SEGMENT_KEY }}
- name: Delete preview environment
uses: ./.github/actions/delete-preview
with:
name: ${{ needs.configuration.outputs.name }}