-
Notifications
You must be signed in to change notification settings - Fork 13
170 lines (166 loc) · 6.53 KB
/
cross_version_test.yml
File metadata and controls
170 lines (166 loc) · 6.53 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
name: Cross-Version Tests and Upload
on:
schedule:
- cron: "0 0,19 * * *" # 12PM, 5PM Pacific; daily
- cron: "0 15 * * *" # 8AM Pacific; daily (separate trigger for uploading release candidate)
workflow_dispatch:
inputs:
batfish_repo:
description: "GitHub repo containing Batfish"
type: string
required: false
default: "batfish/batfish"
batfish_ref:
description: "Batfish ref to build a container from"
type: string
required: false
default: "master"
pybatfish_repo:
description: "GitHub repo containing Pybatfish"
type: string
required: false
default: "batfish/pybatfish"
pybatfish_ref:
description: "Pybatfish ref to build a wheel from"
type: string
required: false
default: "master"
jobs:
# Initial checks and build artifacts
precommit:
uses: ./.github/workflows/reusable-precommit.yml
with:
BATFISH_GITHUB_BATFISH_REPO: "${{ github.event.inputs.batfish_repo || 'batfish/batfish' }}"
BATFISH_GITHUB_BATFISH_REF: "${{ github.event.inputs.batfish_ref || 'master' }}"
BATFISH_GITHUB_PYBATFISH_REPO: "${{ github.event.inputs.pybatfish_repo || 'batfish/pybatfish' }}"
BATFISH_GITHUB_PYBATFISH_REF: "${{ github.event.inputs.pybatfish_ref || 'master' }}"
# Integration tests
test:
needs: precommit
uses: ./.github/workflows/reusable-integration-tests.yml
with:
bf_version: ${{ needs.precommit.outputs.bf_version }}
bf_test_artifact_age: "90"
bf_min_release_test_count: "2"
pybf_min_release_test_count: "2" # todo: bump to 3 once we have 3 releases with new API support
run_cross_version_tests: true
# Push test/dev artifacts
upload_dev:
needs:
- precommit
- test
uses: ./.github/workflows/reusable-upload.yml
with:
bf_version: ${{ needs.precommit.outputs.bf_version }}
# Only upload dev/test artifacts, not production
queue_prod_release: false
test_tag: "test-${{ needs.precommit.outputs.bf_version }}"
release_tag: "${{ needs.precommit.outputs.bf_version }}"
BATFISH_GITHUB_BATFISH_REPO: "${{ needs.precommit.outputs.batfish_repo }}"
BATFISH_GITHUB_PYBATFISH_REPO: "${{ needs.precommit.outputs.pybatfish_repo }}"
BATFISH_GITHUB_PYBATFISH_REF: "${{ needs.precommit.outputs.pybatfish_resolved_sha }}"
secrets:
PYBATFISH_TEST_PYPI_TOKEN: ${{ secrets.PYBATFISH_TEST_PYPI_TOKEN }}
PYBATFISH_PYPI_TOKEN: ${{ secrets.PYBATFISH_PYPI_TOKEN }}
BATFISH_DOCKER_LOGIN_TOKEN: ${{ secrets.BATFISH_DOCKER_LOGIN_TOKEN }}
OPEN_SOURCE_BUILDKITEBOT_PUBLIC_REPO_TOKEN: ${{ secrets.OPEN_SOURCE_BUILDKITEBOT_PUBLIC_REPO_TOKEN }}
# Validate the uploaded test artifacts with lab-validation
lab_validation:
needs:
- precommit
- upload_dev
uses: batfish/lab-validation/.github/workflows/reusable-lab-validation.yml@main
with:
batfish_docker: "batfish/batfish:test-${{ needs.precommit.outputs.bf_version }}"
pybatfish_version: "${{ needs.precommit.outputs.bf_version }}"
pybatfish_pypi_repo: "test"
# Push production artifacts only if lab validation passes
upload_prod:
needs:
- precommit
- test
- lab_validation
# Only run production uploads if this is a release candidate AND lab validation passed
if: github.event_name == 'workflow_dispatch' || github.event.schedule == '0 15 * * *'
uses: ./.github/workflows/reusable-upload.yml
with:
bf_version: ${{ needs.precommit.outputs.bf_version }}
# Only upload production artifacts
queue_prod_release: true
test_tag: "test-${{ needs.precommit.outputs.bf_version }}"
release_tag: "${{ needs.precommit.outputs.bf_version }}"
BATFISH_GITHUB_BATFISH_REPO: "${{ needs.precommit.outputs.batfish_repo }}"
BATFISH_GITHUB_PYBATFISH_REPO: "${{ needs.precommit.outputs.pybatfish_repo }}"
BATFISH_GITHUB_PYBATFISH_REF: "${{ needs.precommit.outputs.pybatfish_resolved_sha }}"
secrets:
PYBATFISH_TEST_PYPI_TOKEN: ${{ secrets.PYBATFISH_TEST_PYPI_TOKEN }}
PYBATFISH_PYPI_TOKEN: ${{ secrets.PYBATFISH_PYPI_TOKEN }}
BATFISH_DOCKER_LOGIN_TOKEN: ${{ secrets.BATFISH_DOCKER_LOGIN_TOKEN }}
OPEN_SOURCE_BUILDKITEBOT_PUBLIC_REPO_TOKEN: ${{ secrets.OPEN_SOURCE_BUILDKITEBOT_PUBLIC_REPO_TOKEN }}
# Send Slack notification on failure for scheduled or post-merge jobs on master branch
notify_slack_on_failure:
needs:
- precommit
- test
- upload_dev
- lab_validation
- upload_prod
if: |
failure() &&
github.ref == 'refs/heads/master' &&
(github.event_name == 'schedule' || github.event_name == 'push') &&
!(github.event_name == 'workflow_dispatch' || github.event.schedule == '0 15 * * *')
runs-on: ubuntu-latest
steps:
- name: Send Slack notification
uses: slackapi/slack-github-action@v3.0.3
with:
webhook: ${{ secrets.SLACK_WEBHOOK_URL }}
webhook-type: incoming-webhook
payload: |
{
"text": "*Docker cross-version tests and upload workflow failed*",
"blocks": [
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "*Docker cross-version tests and upload workflow failed*"
}
},
{
"type": "section",
"fields": [
{
"type": "mrkdwn",
"text": "*Workflow:*\n${{ github.workflow }}"
},
{
"type": "mrkdwn",
"text": "*Status:*\nFailed"
},
{
"type": "mrkdwn",
"text": "*Trigger:*\n${{ github.event_name }}"
},
{
"type": "mrkdwn",
"text": "*Branch:*\nmaster"
}
]
},
{
"type": "actions",
"elements": [
{
"type": "button",
"text": {
"type": "plain_text",
"text": "View in GitHub Actions"
},
"url": "https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}"
}
]
}
]
}