-
Notifications
You must be signed in to change notification settings - Fork 23
616 lines (522 loc) · 19.6 KB
/
main.yml
File metadata and controls
616 lines (522 loc) · 19.6 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
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
name: Validate SecureSign
on:
push:
branches: [ "main", "release*" ]
tags: [ "*" ]
pull_request:
branches: [ "main", "release*" ]
env:
GO_VERSION: 1.25
REGISTRY: ghcr.io
CONTAINER_TOOL: podman
IMG: ghcr.io/securesign/secure-sign-operator:dev-${{ github.sha }}
BUNDLE_IMG: ghcr.io/securesign/secure-sign-operator-bundle:dev-${{ github.sha }}
CATALOG_IMG: ghcr.io/securesign/secure-sign-operator-fbc:dev-${{ github.sha }}
NEW_OLM_CHANNEL: rhtas-operator.v1.5.0
OCP_VERSION: ${{ vars.OLM_INDEX_VERSION }}
jobs:
build-operator:
name: Build-operator
runs-on: ubuntu-24.04
permissions:
contents: read
packages: write
steps:
- name: Checkout source
uses: actions/checkout@v4
- name: Install Go
uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
- name: Log in to GitHub Container Registry
uses: redhat-actions/podman-login@v1
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
auth_file_path: /tmp/config.json
- name: Replace images
run: make dev-images && cat config/default/images.env
- name: Build operator container
run: make docker-build docker-push
build-bundle:
name: Build-bundle-image
runs-on: ubuntu-24.04
permissions:
contents: read
packages: write
steps:
- name: Checkout source
uses: actions/checkout@v4
- name: Log in to GitHub Container Registry
uses: redhat-actions/podman-login@v1
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
auth_file_path: /tmp/config.json
- name: Log in to registry.redhat.io
uses: redhat-actions/podman-login@v1
with:
username: ${{ secrets.REGISTRY_USER }}
password: ${{ secrets.REGISTRY_PASSWORD }}
registry: registry.redhat.io
auth_file_path: /tmp/config.json
- name: Replace images
run: make dev-images && cat config/default/images.env
- name: Build operator bundle
run: make bundle-build bundle-push
build-fbc:
name: Build-fbc
runs-on: ubuntu-24.04
permissions:
contents: read
packages: write
needs: build-bundle
steps:
- name: Checkout source
uses: actions/checkout@v4
- name: Log in to GitHub Container Registry
uses: redhat-actions/podman-login@v1
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
auth_file_path: /tmp/config.json
- name: Log in to registry.redhat.io
uses: redhat-actions/podman-login@v1
with:
username: ${{ secrets.REGISTRY_USER }}
password: ${{ secrets.REGISTRY_PASSWORD }}
registry: registry.redhat.io
auth_file_path: /tmp/config.json
- name: Log in to registry.redhat.io
uses: redhat-actions/podman-login@v1
with:
username: ${{ secrets.REGISTRY_USER }}
password: ${{ secrets.REGISTRY_PASSWORD }}
registry: brew.registry.redhat.io
auth_file_path: /tmp/config.json
- name: Install OPM
uses: redhat-actions/openshift-tools-installer@v1
with:
source: "github"
github_pat: ${{ github.token }}
opm: 1.61.0
- name: Checkout FBC source
uses: actions/checkout@v4
with:
repository: "securesign/fbc"
ref: main
path: fbc
- name: Build catalog
env:
BUNDLE_IMAGE: ${{ env.BUNDLE_IMG }}
BUNDLE_NAME: ${{ env.NEW_OLM_CHANNEL }}
FBC_DIR: rhtas-operator
GRAPH: ${{ env.OCP_VERSION }}/rhtas-operator/graph.yaml
CHANNELS: "stable,stable-v1.5"
CATALOG_FILE: ${{ env.OCP_VERSION }}/rhtas-operator/catalog/rhtas-operator/catalog.json
run: |
cd fbc
utils/configure_bundles.sh
utils/configure_channels.sh
utils/render_catalog.sh
cat ${{ env.GRAPH }}
opm validate ${{ env.OCP_VERSION }}/rhtas-operator/catalog/rhtas-operator
podman build ${{ env.OCP_VERSION }}/rhtas-operator -f catalog.Dockerfile -t $CATALOG_IMG
podman push $CATALOG_IMG
build-tuftool:
name: Build-tuftool
runs-on: ubuntu-24.04
steps:
- name: Checkout tough source
uses: actions/checkout@v4
with:
repository: "securesign/tough"
path: tough
- uses: actions/cache@v4
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
/tmp/tuftool
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Build
run: cd tough && cargo build --release --target-dir /tmp/tuftool
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: tuftool
path: /tmp/tuftool/release/tuftool
retention-days: 1
if-no-files-found: error
test-kind:
name: Test kind deployment
runs-on: ubuntu-24.04
permissions:
contents: read
packages: read
needs:
- build-operator
- build-tuftool
steps:
- name: Checkout source
uses: actions/checkout@v4
- name: Install Go
uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
- name: Download tuftool
uses: actions/download-artifact@v4
with:
name: tuftool
path: /tmp/tuftool
- run: echo "/tmp/tuftool" >> $GITHUB_PATH
- name: Log in to GitHub Container Registry
uses: redhat-actions/podman-login@v1
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
auth_file_path: /tmp/config.json
- name: Log in to registry.redhat.io
uses: redhat-actions/podman-login@v1
with:
username: ${{ secrets.REGISTRY_USER }}
password: ${{ secrets.REGISTRY_PASSWORD }}
registry: registry.redhat.io
auth_file_path: /tmp/config.json
- name: Install Cluster
uses: ./.github/actions/kind-cluster
with:
config: ./ci/config.yaml
prometheus: 'true'
keycloak: 'true'
olm: 'true'
- name: Pull Container image from GHCR
run: podman pull ${{ env.IMG }}
- name: Load Docker image into Kind cluster
run: |
podman save ${{ env.IMG }} -o operator-oci.tar
kind load image-archive operator-oci.tar
- name: Replace images
run: make dev-images && cat config/default/images.env
- name: Deploy operator container
run: make deploy
- name: Wait for operator to be ready
run: |
kubectl wait --for=condition=available deployment/rhtas-operator-controller-manager --timeout=120s -n openshift-rhtas-operator
- name: Add service hosts to /etc/hosts
run: |
sudo echo "127.0.0.1 fulcio-server.local tuf.local rekor-server.local keycloak-internal.keycloak-system.svc rekor-search-ui.local cli-server.local tsa-server.local" | sudo tee -a /etc/hosts
- name: Install cosign
run: go install github.com/sigstore/cosign/v3/cmd/cosign@v3.0.5
- name: Run tests
run: make test-e2e
- name: Archive test artifacts
uses: actions/upload-artifact@v4
if: always()
with:
name: test-kind
path: test/**/k8s-dump-*.tar.gz
if-no-files-found: ignore
- name: dump the logs of the operator
run: kubectl logs -n openshift-rhtas-operator deployment/rhtas-operator-controller-manager
if: always()
test-upgrade:
name: Test upgrade operator
runs-on:
labels: ubuntu-4core
permissions:
contents: read
packages: read
needs:
- build-operator
- build-bundle
- build-fbc
steps:
- name: Checkout source
uses: actions/checkout@v4
- name: Install Go
uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
- name: Log in to GitHub Container Registry
uses: redhat-actions/podman-login@v1
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
auth_file_path: /tmp/config.json
- name: Log in to registry.redhat.io
uses: redhat-actions/podman-login@v1
with:
username: ${{ secrets.REGISTRY_USER }}
password: ${{ secrets.REGISTRY_PASSWORD }}
registry: registry.redhat.io
auth_file_path: /tmp/config.json
- name: Install Cluster
uses: ./.github/actions/kind-cluster
with:
config: ./ci/config.yaml
prometheus: 'true'
keycloak: 'true'
olm: 'true'
- name: Pull Container image from GHCR
run: |
podman pull ${{ env.IMG }}
podman pull ${{ env.BUNDLE_IMG }}
podman pull ${{ env.CATALOG_IMG }}
- name: Load Docker image into Kind cluster
run: |
podman save ${{ env.IMG }} -o operator-oci.tar
podman save ${{ env.BUNDLE_IMG }} -o operator-bundle-oci.tar
podman save ${{ env.CATALOG_IMG }} -o operator-fbc-oci.tar
kind load image-archive operator-oci.tar
kind load image-archive operator-bundle-oci.tar
kind load image-archive operator-fbc-oci.tar
- name: Add service hosts to /etc/hosts
run: |
sudo echo "127.0.0.1 fulcio-server.local tuf.local rekor-server.local keycloak-internal.keycloak-system.svc rekor-search-ui.local cli-server.local tsa-server.local" | sudo tee -a /etc/hosts
- name: Install cosign
#keep upgrade scenario on cosign v2 (latest released version does not support cosign v3)
run: go install github.com/sigstore/cosign/v2/cmd/cosign@v2.4.0
- name: Replace images
run: make dev-images generate && cat config/default/images.env
- name: Run tests
env:
TEST_BASE_CATALOG: registry.redhat.io/redhat/redhat-operator-index:${{ vars.OLM_INDEX_VERSION }}
TEST_TARGET_CATALOG: ${{ env.CATALOG_IMG }}
run: go test -p 1 ./test/e2e/... -tags=upgrade -timeout 20m
- name: Archive test artifacts
uses: actions/upload-artifact@v4
if: always()
with:
name: test-upgrade
path: test/**/k8s-dump-*.tar.gz
if-no-files-found: ignore
test-ha-install:
name: Test with High Availability
runs-on: ubuntu-24.04
permissions:
contents: read
packages: read
needs:
- build-operator
steps:
- name: Checkout source
uses: actions/checkout@v4
- name: Install Go
uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
- name: Log in to GitHub Container Registry
uses: redhat-actions/podman-login@v1
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
auth_file_path: /tmp/config.json
- name: Log in to registry.redhat.io
uses: redhat-actions/podman-login@v1
with:
username: ${{ secrets.REGISTRY_USER }}
password: ${{ secrets.REGISTRY_PASSWORD }}
registry: registry.redhat.io
auth_file_path: /tmp/config.json
- name: Install Cluster
uses: ./.github/actions/kind-cluster
with:
config: ./ci/config.yaml
prometheus: 'true'
keycloak: 'true'
olm: 'true'
nfs-csi: 'true'
- name: Pull Container image from GHCR
run: podman pull ${{ env.IMG }}
- name: Load Docker image into Kind cluster
run: |
podman save ${{ env.IMG }} -o operator-oci.tar
kind load image-archive operator-oci.tar
- name: Replace images
run: make dev-images && cat config/default/images.env
- name: Deploy operator container
run: make deploy
- name: Wait for operator to be ready
run: |
kubectl wait --for=condition=available deployment/rhtas-operator-controller-manager --timeout=120s -n openshift-rhtas-operator
- name: Add service hosts to /etc/hosts
run: |
sudo echo "127.0.0.1 fulcio-server.local tuf.local rekor-server.local keycloak-internal.keycloak-system.svc rekor-search-ui.local cli-server.local tsa-server.local" | sudo tee -a /etc/hosts
- name: Install cosign
run: go install github.com/sigstore/cosign/v3/cmd/cosign@v3.0.5
- name: Run tests
run: |
make generate && go test -p 1 ./test/e2e/... -tags=ha -timeout 20m
- name: Archive test artifacts
uses: actions/upload-artifact@v4
if: always()
with:
name: test-ha-install
path: test/**/k8s-dump-*.tar.gz
if-no-files-found: ignore
- name: dump the logs of the operator
run: kubectl logs -n openshift-rhtas-operator deployment/rhtas-operator-controller-manager
if: always()
- name: Cleanup Cluster
uses: ./.github/actions/kind-cluster-cleanup
if: always()
with:
nfs-csi: true
test-custom-install:
name: Test with custom operator installation
runs-on: ubuntu-24.04
permissions:
contents: read
packages: read
needs:
- build-operator
steps:
- name: Checkout source
uses: actions/checkout@v4
- name: Install Go
uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
- name: Log in to GitHub Container Registry
uses: redhat-actions/podman-login@v1
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
auth_file_path: /tmp/config.json
- name: Log in to registry.redhat.io
uses: redhat-actions/podman-login@9184318aae1ee5034fbfbacc0388acf12669171f # v1
with:
username: ${{ secrets.REGISTRY_USER }}
password: ${{ secrets.REGISTRY_PASSWORD }}
registry: registry.redhat.io
auth_file_path: /tmp/config.json
- name: Install Cluster
uses: ./.github/actions/kind-cluster
with:
config: ./ci/config.yaml
nfs-csi: true
keycloak: 'false' # keycloak use a lot of resources and is not needed for custom_intall tests
- name: Pull Container image from GHCR
run: |
podman pull ${{ env.IMG }}
- name: Load Docker image into Kind cluster
run: |
podman save ${{ env.IMG }} -o operator-oci.tar
kind load image-archive operator-oci.tar
- name: Add service hosts to /etc/hosts
run: |
sudo echo "127.0.0.1 fulcio-server.local tuf.local rekor-server.local rekor-search-ui.local cli-server.local" | sudo tee -a /etc/hosts
- name: Replace images
run: make dev-images generate && cat config/default/images.env
- name: Run tests
env:
TEST_MANAGER_IMAGE: ${{ env.IMG }}
run: make install && go test ./test/e2e/... -tags=custom_install -p 1 -timeout 20m
- name: Archive test artifacts
uses: actions/upload-artifact@v4
if: always()
with:
name: test-custom-install
path: test/**/k8s-dump-*.tar.gz
if-no-files-found: ignore
- name: Cleanup Cluster
uses: ./.github/actions/kind-cluster-cleanup
if: always()
with:
nfs-csi: true
test-e2e:
name: Execute securesign/sigstore-e2e
runs-on: ubuntu-24.04
permissions:
contents: read
packages: read
needs:
- build-operator
env:
TEST_NAMESPACE: test
steps:
- name: Checkout source
uses: actions/checkout@v4
- name: Checkout test source repository
uses: actions/checkout@v4
with:
repository: "securesign/sigstore-e2e"
path: e2e
- name: Install Go
uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
- name: Log in to GitHub Container Registry
uses: redhat-actions/podman-login@v1
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
auth_file_path: /tmp/config.json
- name: Log in to registry.redhat.io
uses: redhat-actions/podman-login@9184318aae1ee5034fbfbacc0388acf12669171f # v1
with:
username: ${{ secrets.REGISTRY_USER }}
password: ${{ secrets.REGISTRY_PASSWORD }}
registry: registry.redhat.io
auth_file_path: /tmp/config.json
- name: Install Cluster
id: kind
uses: ./.github/actions/kind-cluster
with:
config: ./ci/config.yaml
keycloak: 'true'
olm: 'true'
prometheus: 'true'
- name: Pull Container image from GHCR
run: |
podman pull ${{ env.IMG }}
- name: Load Docker image into Kind cluster
run: |
podman save ${{ env.IMG }} -o operator-oci.tar
kind load image-archive operator-oci.tar
- name: Add service hosts to /etc/hosts
run: |
sudo echo "127.0.0.1 fulcio-server.local tuf.local rekor-server.local rekor-search-ui.local tsa-server.local cli-server.local ${{ steps.kind.outputs.oidc_host }}" | sudo tee -a /etc/hosts
- name: Replace images
run: make dev-images generate && cat config/default/images.env
- name: Deploy operator container
run: make deploy
- name: Wait for operator to be ready
run: |
kubectl wait --for=condition=available deployment/rhtas-operator-controller-manager --timeout=120s -n openshift-rhtas-operator
- name: Install securesign
run: |
sed -i 's#https://your-oidc-issuer-url#http://${{ steps.kind.outputs.oidc_host }}/realms/trusted-artifact-signer#' config/samples/rhtas_v1alpha1_securesign.yaml
kubectl create ns ${{ env.TEST_NAMESPACE }}
kubectl create -f config/samples/rhtas_v1alpha1_securesign.yaml -n ${{ env.TEST_NAMESPACE }}
sleep 1
kubectl wait --for=condition=Ready securesign/securesign-sample --timeout=5m -n ${{ env.TEST_NAMESPACE }}
- name: Run tests
run: |
export OIDC_ISSUER_URL="http://${{ steps.kind.outputs.oidc_host }}/realms/trusted-artifact-signer"
export REKOR_UI_URL=$(kubectl get rekor -o jsonpath='{.items[0].status.rekorSearchUIUrl}' -n ${{ env.TEST_NAMESPACE }})
export TUF_URL=$(kubectl get tuf -o jsonpath='{.items[0].status.url}' -n ${{ env.TEST_NAMESPACE }})
export REKOR_URL=$(kubectl get rekor -o jsonpath='{.items[0].status.url}' -n ${{ env.TEST_NAMESPACE }})
export FULCIO_URL=$(kubectl get fulcio -o jsonpath='{.items[0].status.url}' -n ${{ env.TEST_NAMESPACE }})
export CLI_STRATEGY=cli_server
export CLI_SERVER_URL="http://cli-server.local"
cd e2e
source ./tas-env-variables.sh
# Install Playwright with dependencies for UI tests
go run github.com/playwright-community/playwright-go/cmd/playwright install --with-deps
go test -v ./test/...
- name: dump the logs of the operator
run: |
kubectl logs -n openshift-rhtas-operator deployment/rhtas-operator-controller-manager
if: failure()