77 - " main"
88 tags :
99 - " v*.*.*"
10-
10+
11+ concurrency :
12+ group : ${{ github.workflow }}-${{ github.ref }}
13+ cancel-in-progress : true
14+
1115jobs :
12- build :
16+ test :
1317 runs-on : ubuntu-18.04
1418 steps :
1519 - uses : actions/setup-go@v1
@@ -24,11 +28,10 @@ jobs:
2428
2529 - uses : actions/checkout@v2
2630
27- - run : make
28-
31+ - run : make test
32+
2933 compile-preflight :
3034 runs-on : ubuntu-latest
31- needs : build
3235 steps :
3336 - uses : actions/setup-go@v1
3437 with :
@@ -39,22 +42,25 @@ jobs:
3942 echo "$(go env GOPATH)/bin" >> $GITHUB_PATH
4043 shell : bash
4144 - uses : actions/checkout@master
42- - run : make preflight
45+ - run : make generate preflight
4346 - uses : actions/upload-artifact@v1
4447 with :
4548 name : preflight
4649 path : bin/preflight
47-
50+
4851 validate-preflight :
4952 runs-on : ubuntu-latest
5053 needs : compile-preflight
5154 steps :
55+ - uses : replicatedhq/action-k3s@main
56+ id : k3s
57+ with :
58+ version : v1.23.6-k3s1
5259 - name : Download preflight binary
5360 uses : actions/download-artifact@v1
5461 with :
5562 name : preflight
5663 path : bin/
57- -
uses :
engineerd/[email protected] 5864 - run : chmod +x bin/preflight
5965 - run : |
6066 ./bin/preflight --interactive=false --format=json https://preflight.replicated.com > result.json
8389
8490 exit $EXIT_STATUS
8591
92+ validate-preflight-e2e :
93+ runs-on : ubuntu-latest
94+ needs : compile-preflight
95+ steps :
96+ - uses : actions/checkout@master
97+ - uses : replicatedhq/action-k3s@main
98+ id : k3s
99+ with :
100+ version : v1.23.6-k3s1
101+ - name : Download preflight binary
102+ uses : actions/download-artifact@v1
103+ with :
104+ name : preflight
105+ path : bin/
106+ - run : chmod +x bin/preflight
107+ - run : |
108+ ./bin/preflight --interactive=false --format=json examples/preflight/e2e.yaml > result.json
109+ cat result.json
110+
111+ EXIT_STATUS=0
112+ if grep -q "was not collected" result.json; then
113+ echo "Some files were not collected"
114+ EXIT_STATUS=1
115+ fi
116+
117+ if (( `jq '.pass | length' result.json` < 1 )); then
118+ echo "No passing preflights found"
119+ EXIT_STATUS=1
120+ fi
121+
122+ if (( `jq '.warn | length' result.json` > 0 )); then
123+ echo "Warnings found"
124+ EXIT_STATUS=1
125+ fi
126+
127+ if (( `jq '.fail | length' result.json` > 0 )); then
128+ echo "Failed preflights found"
129+ EXIT_STATUS=1
130+ fi
131+
132+ exit $EXIT_STATUS
133+
86134 compile-supportbundle :
87135 runs-on : ubuntu-latest
88- needs : build
89136 steps :
90137 - uses : actions/setup-go@v1
91138 with :
96143 echo "$(go env GOPATH)/bin" >> $GITHUB_PATH
97144 shell : bash
98145 - uses : actions/checkout@master
99- - run : make support-bundle
146+ - run : make generate support-bundle
100147 - uses : actions/upload-artifact@v1
101148 with :
102149 name : support-bundle
@@ -107,27 +154,48 @@ jobs:
107154 needs : compile-supportbundle
108155 steps :
109156 - uses : actions/checkout@v1
157+ - uses : replicatedhq/action-k3s@main
158+ id : k3s
159+ with :
160+ version : v1.23.6-k3s1
110161 - name : Download support-bundle binary
111162 uses : actions/download-artifact@v1
112163 with :
113164 name : support-bundle
114165 path : bin/
115- -
uses :
engineerd/[email protected] 116166 - run : chmod +x bin/support-bundle
117167 - run : ./bin/support-bundle ./examples/support-bundle/sample-collectors.yaml
118168 - run : ./bin/support-bundle ./examples/support-bundle/sample-supportbundle.yaml
119169 - run : ./bin/support-bundle https://kots.io
120170
171+ compile-collect :
172+ runs-on : ubuntu-latest
173+ steps :
174+ - uses : actions/setup-go@v1
175+ with :
176+ go-version : ' 1.17'
177+ - name : setup env
178+ run : |
179+ echo "GOPATH=$(go env GOPATH)" >> $GITHUB_ENV
180+ echo "$(go env GOPATH)/bin" >> $GITHUB_PATH
181+ shell : bash
182+ - uses : actions/checkout@master
183+ - run : make generate collect
184+ - uses : actions/upload-artifact@v1
185+ with :
186+ name : collect
187+ path : bin/collect
188+
121189 goreleaser-test :
122190 runs-on : ubuntu-latest
123191 if : startsWith(github.ref, 'refs/tags/v') != true
124192 steps :
125193 - name : Checkout
126194 uses : actions/checkout@v2
127-
195+
128196 - name : Unshallow
129197 run : git fetch --prune --unshallow
130-
198+
131199 - uses : actions/setup-go@v1
132200 with :
133201 go-version : " 1.17"
@@ -142,20 +210,21 @@ jobs:
142210 runs-on : ubuntu-latest
143211 needs :
144212 - validate-preflight
213+ - validate-preflight-e2e
145214 - validate-supportbundle
146215 if : startsWith(github.ref, 'refs/tags/v')
147216 steps :
148217 - name : Checkout
149218 uses : actions/checkout@v2
150-
219+
151220 - uses : azure/docker-login@v1
152221 with :
153222 username : repldeploy2
154223 password : ${{ secrets.DOCKERHUB_PASSWORD }}
155224
156225 - name : Unshallow
157226 run : git fetch --prune --unshallow
158-
227+
159228 - uses : actions/setup-go@v1
160229 with :
161230 go-version : " 1.17"
@@ -169,14 +238,14 @@ jobs:
169238 echo $COSIGN_KEY | base64 -d > ./cosign.key
170239 env :
171240 COSIGN_KEY : ${{secrets.COSIGN_KEY}}
172-
241+
173242 - name : Generate SBOM
174243 run : |
175244 make sbom
176245 env :
177246 COSIGN_PASSWORD : ${{ secrets.COSIGN_PASSWORD }}
178247 COSIGN_KEY : ${{ secrets.COSIGN_KEY }}
179-
248+
180249 - name : Run GoReleaser
181250 uses : goreleaser/goreleaser-action@v2
182251 with :
0 commit comments