47
47
PROWLERCLOUD_DOCKERHUB_IMAGE : prowler
48
48
49
49
jobs :
50
- # Build Prowler OSS container
51
- container-build-push :
52
- # needs: dockerfile-linter
50
+ setup :
51
+ name : Setup common variables
53
52
runs-on : ubuntu-latest
54
53
outputs :
55
54
prowler_version_major : ${{ steps.get-prowler-version.outputs.PROWLER_VERSION_MAJOR }}
56
55
prowler_version : ${{ steps.get-prowler-version.outputs.PROWLER_VERSION }}
56
+ latest_tag : ${{ steps.get-prowler-version.outputs.LATEST_TAG }}
57
+ stable_tag : ${{ steps.get-prowler-version.outputs.STABLE_TAG }}
58
+ latest_commit_hash : ${{ steps.commit-info.outputs.LATEST_COMMIT_HASH }}
57
59
env :
58
60
POETRY_VIRTUALENVS_CREATE : " false"
59
61
@@ -85,28 +87,81 @@ jobs:
85
87
86
88
case ${PROWLER_VERSION_MAJOR} in
87
89
3)
88
- echo " LATEST_TAG=v3-latest" >> "${GITHUB_ENV} "
89
- echo " STABLE_TAG=v3-stable" >> "${GITHUB_ENV} "
90
+ LATEST_TAG=" v3-latest"
91
+ STABLE_TAG=" v3-stable"
90
92
;;
91
-
92
-
93
93
4)
94
- echo " LATEST_TAG=v4-latest" >> "${GITHUB_ENV} "
95
- echo " STABLE_TAG=v4-stable" >> "${GITHUB_ENV} "
94
+ LATEST_TAG=" v4-latest"
95
+ STABLE_TAG=" v4-stable"
96
96
;;
97
-
98
97
5)
99
- echo " LATEST_TAG=latest" >> "${GITHUB_ENV} "
100
- echo " STABLE_TAG=stable" >> "${GITHUB_ENV} "
98
+ LATEST_TAG="latest "
99
+ STABLE_TAG="stable "
101
100
;;
102
-
103
101
*)
104
102
# Fallback if any other version is present
105
103
echo "Releasing another Prowler major version, aborting..."
106
104
exit 1
107
105
;;
108
106
esac
107
+
108
+ echo "LATEST_TAG=${LATEST_TAG}" >> "${GITHUB_OUTPUT}"
109
+ echo "STABLE_TAG=${STABLE_TAG}" >> "${GITHUB_OUTPUT}"
110
+
111
+ - name : Get latest commit info
112
+ id : commit-info
113
+ if : github.event_name == 'push'
114
+ run : |
115
+ LATEST_COMMIT_HASH=$(echo ${{ github.event.after }} | cut -b -7)
116
+ echo "LATEST_COMMIT_HASH=${LATEST_COMMIT_HASH}" >> "${GITHUB_OUTPUT}"
117
+
118
+ # Build Prowler OSS container for each architecture
119
+ container-build-push :
120
+ needs : setup
121
+ runs-on : ${{ matrix.runner }}
122
+ strategy :
123
+ matrix :
124
+ include :
125
+ - platform : linux/amd64
126
+ runner : ubuntu-latest
127
+ arch : amd64
128
+ - platform : linux/arm64
129
+ runner : ubuntu-24.04-arm
130
+ arch : arm64
131
+
132
+ steps :
133
+ - name : Checkout
134
+ uses : actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
135
+
136
+ - name : Login to DockerHub (ProwlerCloud)
137
+ uses : docker/login-action@74a5d142397b4f367a81961eba4e8cd7edddf772 # v3.4.0
138
+ with :
139
+ username : ${{ secrets.DOCKERHUB_USERNAME }}
140
+ password : ${{ secrets.DOCKERHUB_TOKEN }}
141
+
142
+ - name : Set up Docker Buildx
143
+ uses : docker/setup-buildx-action@e468171a9de216ec08956ac3ada2f0791b6bd435 # v3.11.1
144
+
145
+ - name : Build and push container image for ${{ matrix.arch }}
146
+ if : github.event_name == 'push' || github.event_name == 'release'
147
+ uses : docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83 # v6.18.0
148
+ with :
149
+ context : .
150
+ push : true
151
+ platforms : ${{ matrix.platform }}
152
+ tags : |
153
+ ${{ env.PROWLERCLOUD_DOCKERHUB_REPOSITORY }}/${{ env.PROWLERCLOUD_DOCKERHUB_IMAGE }}:${{ needs.setup.outputs.prowler_version }}-${{ matrix.arch }}
154
+ file : ${{ env.DOCKERFILE_PATH }}
155
+ cache-from : type=gha
156
+ cache-to : type=gha,mode=max
109
157
158
+ # Create and push multi-architecture manifests
159
+ create-manifest :
160
+ needs : [setup, container-build-push]
161
+ if : github.event_name == 'push' || github.event_name == 'release'
162
+ runs-on : ubuntu-latest
163
+
164
+ steps :
110
165
- name : Login to DockerHub
111
166
uses : docker/login-action@74a5d142397b4f367a81961eba4e8cd7edddf772 # v3.4.0
112
167
with :
@@ -125,62 +180,84 @@ jobs:
125
180
- name : Set up Docker Buildx
126
181
uses : docker/setup-buildx-action@e468171a9de216ec08956ac3ada2f0791b6bd435 # v3.11.1
127
182
128
- - name : Build and push container image ( latest)
183
+ - name : Create and push latest manifests
129
184
if : github.event_name == 'push'
130
- uses : docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83 # v6.18.0
131
- with :
132
- push : true
133
- tags : |
134
- ${{ secrets.DOCKER_HUB_REPOSITORY }}/${{ env.IMAGE_NAME }}:${{ env.LATEST_TAG }}
135
- ${{ secrets.PUBLIC_ECR_REPOSITORY }}/${{ env.IMAGE_NAME }}:${{ env.LATEST_TAG }}
136
- ${{ env.PROWLERCLOUD_DOCKERHUB_REPOSITORY }}/${{ env.PROWLERCLOUD_DOCKERHUB_IMAGE }}:${{ env.LATEST_TAG }}
137
- file : ${{ env.DOCKERFILE_PATH }}
138
- cache-from : type=gha
139
- cache-to : type=gha,mode=max
185
+ run : |
186
+ # DockerHub latest manifest (using ProwlerCloud images as source)
187
+ docker buildx imagetools create -t \
188
+ ${{ secrets.DOCKER_HUB_REPOSITORY }}/${{ env.IMAGE_NAME }}:${{ needs.setup.outputs.latest_tag }} \
189
+ ${{ env.PROWLERCLOUD_DOCKERHUB_REPOSITORY }}/${{ env.PROWLERCLOUD_DOCKERHUB_IMAGE }}:${{ needs.setup.outputs.prowler_version }}-amd64 \
190
+ ${{ env.PROWLERCLOUD_DOCKERHUB_REPOSITORY }}/${{ env.PROWLERCLOUD_DOCKERHUB_IMAGE }}:${{ needs.setup.outputs.prowler_version }}-arm64
191
+
192
+ # Public ECR latest manifest (using ProwlerCloud images as source)
193
+ docker buildx imagetools create -t \
194
+ ${{ secrets.PUBLIC_ECR_REPOSITORY }}/${{ env.IMAGE_NAME }}:${{ needs.setup.outputs.latest_tag }} \
195
+ ${{ env.PROWLERCLOUD_DOCKERHUB_REPOSITORY }}/${{ env.PROWLERCLOUD_DOCKERHUB_IMAGE }}:${{ needs.setup.outputs.prowler_version }}-amd64 \
196
+ ${{ env.PROWLERCLOUD_DOCKERHUB_REPOSITORY }}/${{ env.PROWLERCLOUD_DOCKERHUB_IMAGE }}:${{ needs.setup.outputs.prowler_version }}-arm64
140
197
141
- - name : Build and push container image (release)
198
+ # ProwlerCloud DockerHub latest manifest
199
+ docker buildx imagetools create -t \
200
+ ${{ env.PROWLERCLOUD_DOCKERHUB_REPOSITORY }}/${{ env.PROWLERCLOUD_DOCKERHUB_IMAGE }}:${{ needs.setup.outputs.latest_tag }} \
201
+ ${{ env.PROWLERCLOUD_DOCKERHUB_REPOSITORY }}/${{ env.PROWLERCLOUD_DOCKERHUB_IMAGE }}:${{ needs.setup.outputs.prowler_version }}-amd64 \
202
+ ${{ env.PROWLERCLOUD_DOCKERHUB_REPOSITORY }}/${{ env.PROWLERCLOUD_DOCKERHUB_IMAGE }}:${{ needs.setup.outputs.prowler_version }}-arm64
203
+
204
+ - name : Create and push release manifests
142
205
if : github.event_name == 'release'
143
- uses : docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83 # v6.18.0
144
- with :
145
- # Use local context to get changes
146
- # https://github.com/docker/build-push-action#path-context
147
- context : .
148
- push : true
149
- tags : |
150
- ${{ secrets.DOCKER_HUB_REPOSITORY }}/${{ env.IMAGE_NAME }}:${{ env.PROWLER_VERSION }}
151
- ${{ secrets.DOCKER_HUB_REPOSITORY }}/${{ env.IMAGE_NAME }}:${{ env.STABLE_TAG }}
152
- ${{ secrets.PUBLIC_ECR_REPOSITORY }}/${{ env.IMAGE_NAME }}:${{ env.PROWLER_VERSION }}
153
- ${{ secrets.PUBLIC_ECR_REPOSITORY }}/${{ env.IMAGE_NAME }}:${{ env.STABLE_TAG }}
154
- ${{ env.PROWLERCLOUD_DOCKERHUB_REPOSITORY }}/${{ env.PROWLERCLOUD_DOCKERHUB_IMAGE }}:${{ env.PROWLER_VERSION }}
155
- ${{ env.PROWLERCLOUD_DOCKERHUB_REPOSITORY }}/${{ env.PROWLERCLOUD_DOCKERHUB_IMAGE }}:${{ env.STABLE_TAG }}
156
- file : ${{ env.DOCKERFILE_PATH }}
157
- cache-from : type=gha
158
- cache-to : type=gha,mode=max
206
+ run : |
207
+ # DockerHub version manifest (using ProwlerCloud images as source)
208
+ docker buildx imagetools create -t \
209
+ ${{ secrets.DOCKER_HUB_REPOSITORY }}/${{ env.IMAGE_NAME }}:${{ needs.setup.outputs.prowler_version }} \
210
+ ${{ env.PROWLERCLOUD_DOCKERHUB_REPOSITORY }}/${{ env.PROWLERCLOUD_DOCKERHUB_IMAGE }}:${{ needs.setup.outputs.prowler_version }}-amd64 \
211
+ ${{ env.PROWLERCLOUD_DOCKERHUB_REPOSITORY }}/${{ env.PROWLERCLOUD_DOCKERHUB_IMAGE }}:${{ needs.setup.outputs.prowler_version }}-arm64
212
+
213
+ # DockerHub stable manifest (using ProwlerCloud images as source)
214
+ docker buildx imagetools create -t \
215
+ ${{ secrets.DOCKER_HUB_REPOSITORY }}/${{ env.IMAGE_NAME }}:${{ needs.setup.outputs.stable_tag }} \
216
+ ${{ env.PROWLERCLOUD_DOCKERHUB_REPOSITORY }}/${{ env.PROWLERCLOUD_DOCKERHUB_IMAGE }}:${{ needs.setup.outputs.prowler_version }}-amd64 \
217
+ ${{ env.PROWLERCLOUD_DOCKERHUB_REPOSITORY }}/${{ env.PROWLERCLOUD_DOCKERHUB_IMAGE }}:${{ needs.setup.outputs.prowler_version }}-arm64
218
+
219
+ # Public ECR version manifest (using ProwlerCloud images as source)
220
+ docker buildx imagetools create -t \
221
+ ${{ secrets.PUBLIC_ECR_REPOSITORY }}/${{ env.IMAGE_NAME }}:${{ needs.setup.outputs.prowler_version }} \
222
+ ${{ env.PROWLERCLOUD_DOCKERHUB_REPOSITORY }}/${{ env.PROWLERCLOUD_DOCKERHUB_IMAGE }}:${{ needs.setup.outputs.prowler_version }}-amd64 \
223
+ ${{ env.PROWLERCLOUD_DOCKERHUB_REPOSITORY }}/${{ env.PROWLERCLOUD_DOCKERHUB_IMAGE }}:${{ needs.setup.outputs.prowler_version }}-arm64
224
+
225
+ # Public ECR stable manifest (using ProwlerCloud images as source)
226
+ docker buildx imagetools create -t \
227
+ ${{ secrets.PUBLIC_ECR_REPOSITORY }}/${{ env.IMAGE_NAME }}:${{ needs.setup.outputs.stable_tag }} \
228
+ ${{ env.PROWLERCLOUD_DOCKERHUB_REPOSITORY }}/${{ env.PROWLERCLOUD_DOCKERHUB_IMAGE }}:${{ needs.setup.outputs.prowler_version }}-amd64 \
229
+ ${{ env.PROWLERCLOUD_DOCKERHUB_REPOSITORY }}/${{ env.PROWLERCLOUD_DOCKERHUB_IMAGE }}:${{ needs.setup.outputs.prowler_version }}-arm64
230
+
231
+ # ProwlerCloud DockerHub version manifest
232
+ docker buildx imagetools create -t \
233
+ ${{ env.PROWLERCLOUD_DOCKERHUB_REPOSITORY }}/${{ env.PROWLERCLOUD_DOCKERHUB_IMAGE }}:${{ needs.setup.outputs.prowler_version }} \
234
+ ${{ env.PROWLERCLOUD_DOCKERHUB_REPOSITORY }}/${{ env.PROWLERCLOUD_DOCKERHUB_IMAGE }}:${{ needs.setup.outputs.prowler_version }}-amd64 \
235
+ ${{ env.PROWLERCLOUD_DOCKERHUB_REPOSITORY }}/${{ env.PROWLERCLOUD_DOCKERHUB_IMAGE }}:${{ needs.setup.outputs.prowler_version }}-arm64
236
+
237
+ # ProwlerCloud DockerHub stable manifest
238
+ docker buildx imagetools create -t \
239
+ ${{ env.PROWLERCLOUD_DOCKERHUB_REPOSITORY }}/${{ env.PROWLERCLOUD_DOCKERHUB_IMAGE }}:${{ needs.setup.outputs.stable_tag }} \
240
+ ${{ env.PROWLERCLOUD_DOCKERHUB_REPOSITORY }}/${{ env.PROWLERCLOUD_DOCKERHUB_IMAGE }}:${{ needs.setup.outputs.prowler_version }}-amd64 \
241
+ ${{ env.PROWLERCLOUD_DOCKERHUB_REPOSITORY }}/${{ env.PROWLERCLOUD_DOCKERHUB_IMAGE }}:${{ needs.setup.outputs.prowler_version }}-arm64
159
242
160
243
dispatch-action :
161
- needs : container-build-push
244
+ needs : [setup, create-manifest]
162
245
runs-on : ubuntu-latest
163
246
steps :
164
- - name : Get latest commit info (latest)
165
- if : github.event_name == 'push'
166
- run : |
167
- LATEST_COMMIT_HASH=$(echo ${{ github.event.after }} | cut -b -7)
168
- echo "LATEST_COMMIT_HASH=${LATEST_COMMIT_HASH}" >> $GITHUB_ENV
169
-
170
247
- name : Dispatch event (latest)
171
- if : github.event_name == 'push' && needs.container-build-push .outputs.prowler_version_major == '3'
248
+ if : github.event_name == 'push' && needs.setup .outputs.prowler_version_major == '3'
172
249
run : |
173
250
curl https://api.github.com/repos/${{ secrets.DISPATCH_OWNER }}/${{ secrets.DISPATCH_REPO }}/dispatches \
174
251
-H "Accept: application/vnd.github+json" \
175
252
-H "Authorization: Bearer ${{ secrets.PROWLER_BOT_ACCESS_TOKEN }}" \
176
253
-H "X-GitHub-Api-Version: 2022-11-28" \
177
- --data '{"event_type":"dispatch","client_payload":{"version":"v3-latest", "tag": "${{ env.LATEST_COMMIT_HASH }}"}}'
254
+ --data '{"event_type":"dispatch","client_payload":{"version":"v3-latest", "tag": "${{ needs.setup.outputs.latest_commit_hash }}"}}'
178
255
179
256
- name : Dispatch event (release)
180
- if : github.event_name == 'release' && needs.container-build-push .outputs.prowler_version_major == '3'
257
+ if : github.event_name == 'release' && needs.setup .outputs.prowler_version_major == '3'
181
258
run : |
182
259
curl https://api.github.com/repos/${{ secrets.DISPATCH_OWNER }}/${{ secrets.DISPATCH_REPO }}/dispatches \
183
260
-H "Accept: application/vnd.github+json" \
184
261
-H "Authorization: Bearer ${{ secrets.PROWLER_BOT_ACCESS_TOKEN }}" \
185
262
-H "X-GitHub-Api-Version: 2022-11-28" \
186
- --data '{"event_type":"dispatch","client_payload":{"version":"release", "tag":"${{ needs.container-build-push .outputs.prowler_version }}"}}'
263
+ --data '{"event_type":"dispatch","client_payload":{"version":"release", "tag":"${{ needs.setup .outputs.prowler_version }}"}}'
0 commit comments