-
Notifications
You must be signed in to change notification settings - Fork 171
118 lines (97 loc) · 4.47 KB
/
test-upgrade.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
name: Test Upgrade
on:
pull_request:
paths-ignore:
- "**.md"
- "**.jpg"
- "**.png"
- "**.gif"
- "**.svg"
- "adr/**"
- "docs/**"
- "CODEOWNERS"
permissions:
contents: read
# Abort prior jobs in the same workflow / PR
concurrency:
group: e2e-upgrade-${{ github.ref }}
cancel-in-progress: true
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- name: Setup golang
uses: ./.github/actions/golang
- name: Build PR binary and zarf init package
uses: ./.github/actions/packages
with:
build-examples: "false"
# Upload the contents of the build directory for later stages to use
- name: Upload build artifacts
uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1
with:
name: build-artifacts
path: build/
retention-days: 1
validate:
runs-on: ubuntu-latest
needs: build
steps:
- name: Checkout
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- name: Download build artifacts
uses: actions/download-artifact@eaceaf801fd36c7dee90939fad912460b18a1ffe # v4.1.2
with:
name: build-artifacts
path: build/
- name: Setup golang
uses: ./.github/actions/golang
- name: Make Zarf executable
run: |
chmod +x build/zarf
- name: Install release version of Zarf
uses: defenseunicorns/setup-zarf@f95763914e20e493bb5d45d63e30e17138f981d6 # v1.0.0
with:
download-init-package: true
- name: Initialize the cluster with the release version
# NOTE: "PATH=$PATH" preserves the default user $PATH. This is needed to maintain the version of zarf installed
# in a previous step. This test run will the current release to create a K3s cluster.
run: |
sudo env "PATH=$PATH" CI=true zarf init --components k3s,git-server,logging --nodeport 31337 --confirm
# Before we run the regular tests we need to aggressively cleanup files to reduce disk pressure
- name: Cleanup files
uses: ./.github/actions/cleanup-files
- name: Create and deploy the upgrade test packages
# NOTE: "PATH=$PATH" preserves the default user $PATH. This is needed to maintain the version of zarf installed
# in a previous step. This test run will the current release to create a K3s cluster.
run: |
zarf package create src/test/upgrade --set PODINFO_VERSION=6.3.3 --confirm
sudo env "PATH=$PATH" CI=true zarf package deploy zarf-package-test-upgrade-package-amd64-6.3.3.tar.zst --confirm
sudo env "PATH=$PATH" CI=true zarf tools kubectl describe deployments -n=podinfo-upgrade
sudo env "PATH=$PATH" CI=true zarf tools kubectl describe pods -n=podinfo-upgrade
- name: Run tests
# NOTE: "PATH=$PATH" preserves the default user $PATH. This is needed to maintain the version of go installed
# in a previous step. This test run will use this PR's Zarf to create a K3s cluster.
run: |
sudo env "PATH=$PATH" CI=true APPLIANCE_MODE=true APPLIANCE_MODE_KEEP=true make test-e2e-with-cluster ARCH=amd64
- name: "Describe nodes, pods and deployments"
# NOTE: We describe nodes, pods and deployments here to help understand failures
run: |
sudo env "PATH=$PATH" CI=true zarf tools kubectl describe nodes
sudo env "PATH=$PATH" CI=true zarf tools kubectl describe deployments -n=podinfo-upgrade
sudo env "PATH=$PATH" CI=true zarf tools kubectl describe pods -n=podinfo-upgrade
# Before we run the upgrade tests we need to aggressively cleanup files to reduce disk pressure
- name: Cleanup files
uses: ./.github/actions/cleanup-files
- name: Run the upgrade tests
# NOTE: "PATH=$PATH" preserves the default user $PATH. This is needed to maintain the version of zarf installed
# in a previous step. This test run will the current release to create a K3s cluster.
run: |
sudo env "PATH=$PATH" CI=true zarf tools kubectl describe nodes
zarf package create src/test/upgrade --set PODINFO_VERSION=6.3.4 --confirm
sudo env "PATH=$PATH" CI=true make test-upgrade ARCH=amd64
- name: Save logs
if: always()
uses: ./.github/actions/save-logs