-
Notifications
You must be signed in to change notification settings - Fork 29
89 lines (79 loc) · 2.93 KB
/
nightly-quality-gate.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
name: "Nightly Quality Gate"
on:
# allow for kicking off quality gate check manually
workflow_dispatch:
# run 5 AM (UTC) daily
schedule:
- cron: '0 5 * * *'
jobs:
select-providers:
runs-on: ubuntu-22.04
outputs:
providers: ${{ steps.determine-providers.outputs.providers }}
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 #v4.1.1
with:
# in order to properly resolve the version from git
fetch-depth: 0
- name: Bootstrap environment
uses: ./.github/actions/bootstrap
with:
tools: false
- name: Determine providers
id: determine-providers
run: |
# select all providers as test subjects (this populates the matrix downstream)
content=`cd tests/quality && poetry run make all-providers`
echo $content
echo "providers=$content" >> $GITHUB_OUTPUT
validate-provider:
runs-on: ubuntu-22.04
needs: select-providers
strategy:
matrix:
provider: ${{fromJson(needs.select-providers.outputs.providers)}}
fail-fast: false
permissions:
contents: read
packages: read
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 #v4.1.1
with:
# in order to properly resolve the version from git
fetch-depth: 0
# we need submodules for the quality gate to work (requires vulnerability-match-labels repo)
submodules: true
- name: Bootstrap environment
uses: ./.github/actions/bootstrap
with:
go: true
- name: Run quality gate
uses: ./.github/actions/quality-gate
with:
provider: ${{ matrix.provider }}
env:
# needed as a secret for the github provider
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# note: the name for this check is referenced in release.yaml, do not change here without changing there
Nightly-Quality-Gate:
runs-on: ubuntu-22.04
needs: validate-provider
if: ${{ always() && !cancelled() }}
steps:
# based on https://docs.github.com/en/actions/learn-github-actions/contexts#job-context
# the valid result values are: success, failure, cancelled
- run: |
echo "Validations Status: ${{ needs.validate-provider.result }}"
if [ "${{ needs.validate-provider.result }}" != "success" ]; then
echo "🔴 Quality gate FAILED! 😭"
exit 1
fi
echo "🟢 Quality gate passed!"
- uses: 8398a7/action-slack@fbd6aa58ba854a740e11a35d0df80cb5d12101d8 #v3.15.1
if: ${{ failure() }}
with:
status: ${{ job.status }}
fields: repo,workflow,action,eventName
text: "Vunnel nightly quality gate has failed: https://github.com/anchore/vunnel/actions/workflows/nightly-quality-gate.yaml"
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_TOOLBOX_WEBHOOK_URL }}