forked from strimzi/strimzi-kafka-operator
-
Notifications
You must be signed in to change notification settings - Fork 0
178 lines (155 loc) · 5.68 KB
/
cve-rebuild.yml
File metadata and controls
178 lines (155 loc) · 5.68 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
name: CVE Container Rebuild
on:
workflow_dispatch:
inputs:
releaseVersion:
description: 'Release Version (e.g., 0.49.0)'
required: true
type: string
releaseSuffix:
description: 'Release Suffix (e.g., 2 for 0.49.0-2)'
required: true
type: string
sourceBuildRunId:
description: 'GitHub Actions Run ID of the source build (find in Actions tab URL)'
required: true
type: string
# Declare default permissions as read only
permissions:
contents: read
jobs:
# Pull Java artifacts from GHCR
pull-java-artifacts-from-ghcr:
name: Pull Java artifacts from GHCR
if: ${{ startsWith(github.ref, 'refs/heads/release-') }}
runs-on: ubuntu-latest
permissions:
packages: read
steps:
- uses: actions/checkout@v6
- name: Setup ORAS
uses: oras-project/setup-oras@v1
- name: Login to GHCR
run: echo "${{ github.token }}" | oras login ghcr.io -u ${{ github.actor }} --password-stdin
- name: Pull Java artifacts from GHCR
run: |
oras pull ghcr.io/${{ env.REPOSITORY }}/binaries-operators:${{ env.TAG }}
env:
TAG: ${{ inputs.releaseVersion }}-${{ inputs.sourceBuildRunId }}
REPOSITORY: "strimzi"
- name: Upload as workflow artifact
uses: actions/upload-artifact@v7
with:
name: binaries-operators.tar
path: binaries-operators.tar
# Rebuild containers using artifacts from a previous build
build-containers:
name: Build Containers
needs:
- pull-java-artifacts-from-ghcr
# Only run on release branches
if: ${{ startsWith(github.ref, 'refs/heads/release-') }}
strategy:
matrix:
architecture:
- amd64
- arm64
- s390x
- ppc64le
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Install Docker
uses: strimzi/github-actions/.github/actions/dependencies/install-docker@v1
- name: Install yq
uses: strimzi/github-actions/.github/actions/dependencies/install-yq@v1
with:
version: "v4.6.3"
- name: Install Shellcheck
uses: strimzi/github-actions/.github/actions/dependencies/install-shellcheck@v1
with:
version: "0.11.0"
- uses: strimzi/github-actions/.github/actions/build/build-containers@v1
with:
architecture: ${{ matrix.architecture }}
imagesDir: "./docker-images/container-archives"
artifactSuffix: "operators"
# Push containers with suffix (e.g., 0.49.0-1)
push-containers-with-suffix:
name: Push Containers (${{ inputs.releaseVersion }}-${{ inputs.releaseSuffix }})
needs:
- build-containers
if: ${{ startsWith(github.ref, 'refs/heads/release-') }}
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write
steps:
- uses: actions/checkout@v6
- name: Install Docker
uses: strimzi/github-actions/.github/actions/dependencies/install-docker@v1
- name: Install yq
uses: strimzi/github-actions/.github/actions/dependencies/install-yq@v1
with:
version: "v4.6.3"
- name: Install Syft
uses: strimzi/github-actions/.github/actions/dependencies/install-syft@v1
with:
version: "1.20.0"
- name: Push containers using push-containers action
uses: strimzi/github-actions/.github/actions/build/push-containers@v1
with:
registryUser: ${{ secrets.QUAY_USER }}
registryPassword: ${{ secrets.QUAY_PASS }}
containerRegistry: "quay.io"
containerOrg: "strimzi"
containerTag: "${{ inputs.releaseVersion }}-${{ inputs.releaseSuffix }}"
architectures: "amd64,arm64,ppc64le,s390x"
artifactSuffix: "operators"
# Manual validation step - waits for approval before pushing without suffix
manual-validation:
name: Wait for Manual Validation
needs:
- push-containers-with-suffix
if: ${{ startsWith(github.ref, 'refs/heads/release-') }}
runs-on: ubuntu-latest
environment:
name: cve-validation
steps:
- name: Wait for validation
run: |
echo "Container image ${{ inputs.releaseVersion }}-${{ inputs.releaseSuffix }} has been pushed."
echo "Please validate the container image before approving this step."
echo "Once approved, the image will be pushed with tag ${{ inputs.releaseVersion }}"
# Push containers without suffix (e.g., 0.49.0) after validation
push-containers:
name: Push Containers (${{ inputs.releaseVersion }})
needs:
- manual-validation
if: ${{ startsWith(github.ref, 'refs/heads/release-') }}
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write
steps:
- uses: actions/checkout@v6
- name: Install Docker
uses: strimzi/github-actions/.github/actions/dependencies/install-docker@v1
- name: Install yq
uses: strimzi/github-actions/.github/actions/dependencies/install-yq@v1
with:
version: "v4.6.3"
- name: Install Syft
uses: strimzi/github-actions/.github/actions/dependencies/install-syft@v1
with:
version: "1.20.0"
- name: Push containers using push-containers action
uses: strimzi/github-actions/.github/actions/build/push-containers@v1
with:
registryUser: ${{ secrets.QUAY_USER }}
registryPassword: ${{ secrets.QUAY_PASS }}
containerRegistry: "quay.io"
containerOrg: "strimzi"
containerTag: "${{ inputs.releaseVersion }}"
architectures: "amd64,arm64,ppc64le,s390x"
artifactSuffix: "operators"