Skip to content

Commit 0338c1b

Browse files
committed
feat: adds support building multiarch prowler containers
1 parent 81478df commit 0338c1b

File tree

3 files changed

+276
-110
lines changed

3 files changed

+276
-110
lines changed

.github/workflows/api-build-lint-push-containers.yml

Lines changed: 73 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,18 @@ env:
3333
PROWLERCLOUD_DOCKERHUB_IMAGE: prowler-api
3434

3535
jobs:
36+
setup:
37+
name: Setup common variables
38+
runs-on: ubuntu-latest
39+
outputs:
40+
short_sha: ${{ steps.vars.outputs.short_sha }}
41+
steps:
42+
- name: Set short git commit SHA
43+
id: vars
44+
run: |
45+
shortSha=$(echo ${{ github.sha }} | cut -c1-7)
46+
echo "short_sha=${shortSha}" >> $GITHUB_OUTPUT
47+
3648
repository-check:
3749
name: Repository check
3850
runs-on: ubuntu-latest
@@ -43,19 +55,22 @@ jobs:
4355
id: repository_check
4456
working-directory: /tmp
4557
run: |
46-
if [[ ${{ github.repository }} == "prowler-cloud/prowler" ]]
47-
then
4858
echo "is_repo=true" >> "${GITHUB_OUTPUT}"
49-
else
50-
echo "This action only runs for prowler-cloud/prowler"
51-
echo "is_repo=false" >> "${GITHUB_OUTPUT}"
52-
fi
5359
54-
# Build Prowler OSS container
60+
# Build Prowler OSS container for each architecture
5561
container-build-push:
56-
needs: repository-check
62+
needs: [repository-check, setup]
5763
if: needs.repository-check.outputs.is_repo == 'true'
58-
runs-on: ubuntu-latest
64+
runs-on: ${{ matrix.runner }}
65+
strategy:
66+
matrix:
67+
include:
68+
- platform: linux/amd64
69+
runner: ubuntu-latest
70+
arch: amd64
71+
- platform: linux/arm64
72+
runner: ubuntu-24.04-arm
73+
arch: arm64
5974
defaults:
6075
run:
6176
working-directory: ${{ env.WORKING_DIRECTORY }}
@@ -64,12 +79,6 @@ jobs:
6479
- name: Checkout
6580
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
6681

67-
- name: Set short git commit SHA
68-
id: vars
69-
run: |
70-
shortSha=$(git rev-parse --short ${{ github.sha }})
71-
echo "SHORT_SHA=${shortSha}" >> $GITHUB_ENV
72-
7382
- name: Login to DockerHub
7483
uses: docker/login-action@74a5d142397b4f367a81961eba4e8cd7edddf772 # v3.4.0
7584
with:
@@ -79,31 +88,65 @@ jobs:
7988
- name: Set up Docker Buildx
8089
uses: docker/setup-buildx-action@e468171a9de216ec08956ac3ada2f0791b6bd435 # v3.11.1
8190

82-
- name: Build and push container image (latest)
91+
- name: Build and push container image for ${{ matrix.arch }}
8392
# Comment the following line for testing
84-
if: github.event_name == 'push'
93+
if: github.event_name == 'push' || github.event_name == 'release'
8594
uses: docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83 # v6.18.0
8695
with:
8796
context: ${{ env.WORKING_DIRECTORY }}
8897
# Set push: false for testing
8998
push: true
99+
platforms: ${{ matrix.platform }}
90100
tags: |
91-
${{ env.PROWLERCLOUD_DOCKERHUB_REPOSITORY }}/${{ env.PROWLERCLOUD_DOCKERHUB_IMAGE }}:${{ env.LATEST_TAG }}
92-
${{ env.PROWLERCLOUD_DOCKERHUB_REPOSITORY }}/${{ env.PROWLERCLOUD_DOCKERHUB_IMAGE }}:${{ env.SHORT_SHA }}
101+
${{ env.PROWLERCLOUD_DOCKERHUB_REPOSITORY }}/${{ env.PROWLERCLOUD_DOCKERHUB_IMAGE }}:${{ needs.setup.outputs.short_sha }}-${{ matrix.arch }}
93102
cache-from: type=gha
94103
cache-to: type=gha,mode=max
95104

96-
- name: Build and push container image (release)
97-
if: github.event_name == 'release'
98-
uses: docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83 # v6.18.0
105+
# Create and push multi-architecture manifest
106+
create-manifest:
107+
needs: [repository-check, setup, container-build-push]
108+
if: needs.repository-check.outputs.is_repo == 'true' && (github.event_name == 'push' || github.event_name == 'release')
109+
runs-on: ubuntu-latest
110+
111+
steps:
112+
- name: Login to DockerHub
113+
uses: docker/login-action@74a5d142397b4f367a81961eba4e8cd7edddf772 # v3.4.0
99114
with:
100-
context: ${{ env.WORKING_DIRECTORY }}
101-
push: true
102-
tags: |
103-
${{ env.PROWLERCLOUD_DOCKERHUB_REPOSITORY }}/${{ env.PROWLERCLOUD_DOCKERHUB_IMAGE }}:${{ env.RELEASE_TAG }}
104-
${{ env.PROWLERCLOUD_DOCKERHUB_REPOSITORY }}/${{ env.PROWLERCLOUD_DOCKERHUB_IMAGE }}:${{ env.STABLE_TAG }}
105-
cache-from: type=gha
106-
cache-to: type=gha,mode=max
115+
username: ${{ secrets.DOCKERHUB_USERNAME }}
116+
password: ${{ secrets.DOCKERHUB_TOKEN }}
117+
118+
- name: Set up Docker Buildx
119+
uses: docker/setup-buildx-action@e468171a9de216ec08956ac3ada2f0791b6bd435 # v3.11.1
120+
121+
- name: Create and push latest and short_sha manifests
122+
if: github.event_name == 'push'
123+
run: |
124+
# Create latest tag manifest using the same arch-specific images
125+
docker buildx imagetools create -t \
126+
${{ env.PROWLERCLOUD_DOCKERHUB_REPOSITORY }}/${{ env.PROWLERCLOUD_DOCKERHUB_IMAGE }}:${{ env.LATEST_TAG }} \
127+
${{ env.PROWLERCLOUD_DOCKERHUB_REPOSITORY }}/${{ env.PROWLERCLOUD_DOCKERHUB_IMAGE }}:${{ needs.setup.outputs.short_sha }}-amd64 \
128+
${{ env.PROWLERCLOUD_DOCKERHUB_REPOSITORY }}/${{ env.PROWLERCLOUD_DOCKERHUB_IMAGE }}:${{ needs.setup.outputs.short_sha }}-arm64
129+
130+
# Create short_sha tag manifest using the same arch-specific images
131+
docker buildx imagetools create -t \
132+
${{ env.PROWLERCLOUD_DOCKERHUB_REPOSITORY }}/${{ env.PROWLERCLOUD_DOCKERHUB_IMAGE }}:${{ needs.setup.outputs.short_sha }} \
133+
${{ env.PROWLERCLOUD_DOCKERHUB_REPOSITORY }}/${{ env.PROWLERCLOUD_DOCKERHUB_IMAGE }}:${{ needs.setup.outputs.short_sha }}-amd64 \
134+
${{ env.PROWLERCLOUD_DOCKERHUB_REPOSITORY }}/${{ env.PROWLERCLOUD_DOCKERHUB_IMAGE }}:${{ needs.setup.outputs.short_sha }}-arm64
135+
136+
- name: Create and push release and stable manifests
137+
if: github.event_name == 'push'
138+
run: |
139+
# Create release tag manifest using the same arch-specific images
140+
docker buildx imagetools create -t \
141+
${{ env.PROWLERCLOUD_DOCKERHUB_REPOSITORY }}/${{ env.PROWLERCLOUD_DOCKERHUB_IMAGE }}:${{ env.RELEASE_TAG }} \
142+
${{ env.PROWLERCLOUD_DOCKERHUB_REPOSITORY }}/${{ env.PROWLERCLOUD_DOCKERHUB_IMAGE }}:${{ needs.setup.outputs.short_sha }}-amd64 \
143+
${{ env.PROWLERCLOUD_DOCKERHUB_REPOSITORY }}/${{ env.PROWLERCLOUD_DOCKERHUB_IMAGE }}:${{ needs.setup.outputs.short_sha }}-arm64
144+
145+
# Create stable tag manifest using the same arch-specific images
146+
docker buildx imagetools create -t \
147+
${{ env.PROWLERCLOUD_DOCKERHUB_REPOSITORY }}/${{ env.PROWLERCLOUD_DOCKERHUB_IMAGE }}:${{ env.STABLE_TAG }} \
148+
${{ env.PROWLERCLOUD_DOCKERHUB_REPOSITORY }}/${{ env.PROWLERCLOUD_DOCKERHUB_IMAGE }}:${{ needs.setup.outputs.short_sha }}-amd64 \
149+
${{ env.PROWLERCLOUD_DOCKERHUB_REPOSITORY }}/${{ env.PROWLERCLOUD_DOCKERHUB_IMAGE }}:${{ needs.setup.outputs.short_sha }}-arm64
107150
108151
- name: Trigger deployment
109152
if: github.event_name == 'push'
@@ -112,4 +155,4 @@ jobs:
112155
token: ${{ secrets.PROWLER_BOT_ACCESS_TOKEN }}
113156
repository: ${{ secrets.CLOUD_DISPATCH }}
114157
event-type: prowler-api-deploy
115-
client-payload: '{"sha": "${{ github.sha }}", "short_sha": "${{ env.SHORT_SHA }}"}'
158+
client-payload: '{"sha": "${{ github.sha }}", "short_sha": "${{ needs.setup.outputs.short_sha }}"}'

.github/workflows/sdk-build-lint-push-containers.yml

Lines changed: 129 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -47,13 +47,15 @@ env:
4747
PROWLERCLOUD_DOCKERHUB_IMAGE: prowler
4848

4949
jobs:
50-
# Build Prowler OSS container
51-
container-build-push:
52-
# needs: dockerfile-linter
50+
setup:
51+
name: Setup common variables
5352
runs-on: ubuntu-latest
5453
outputs:
5554
prowler_version_major: ${{ steps.get-prowler-version.outputs.PROWLER_VERSION_MAJOR }}
5655
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 }}
5759
env:
5860
POETRY_VIRTUALENVS_CREATE: "false"
5961

@@ -85,28 +87,81 @@ jobs:
8587
8688
case ${PROWLER_VERSION_MAJOR} in
8789
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"
9092
;;
91-
92-
9393
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"
9696
;;
97-
9897
5)
99-
echo "LATEST_TAG=latest" >> "${GITHUB_ENV}"
100-
echo "STABLE_TAG=stable" >> "${GITHUB_ENV}"
98+
LATEST_TAG="latest"
99+
STABLE_TAG="stable"
101100
;;
102-
103101
*)
104102
# Fallback if any other version is present
105103
echo "Releasing another Prowler major version, aborting..."
106104
exit 1
107105
;;
108106
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
109157

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:
110165
- name: Login to DockerHub
111166
uses: docker/login-action@74a5d142397b4f367a81961eba4e8cd7edddf772 # v3.4.0
112167
with:
@@ -125,62 +180,84 @@ jobs:
125180
- name: Set up Docker Buildx
126181
uses: docker/setup-buildx-action@e468171a9de216ec08956ac3ada2f0791b6bd435 # v3.11.1
127182

128-
- name: Build and push container image (latest)
183+
- name: Create and push latest manifests
129184
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
140197
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
142205
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
159242
160243
dispatch-action:
161-
needs: container-build-push
244+
needs: [setup, create-manifest]
162245
runs-on: ubuntu-latest
163246
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-
170247
- 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'
172249
run: |
173250
curl https://api.github.com/repos/${{ secrets.DISPATCH_OWNER }}/${{ secrets.DISPATCH_REPO }}/dispatches \
174251
-H "Accept: application/vnd.github+json" \
175252
-H "Authorization: Bearer ${{ secrets.PROWLER_BOT_ACCESS_TOKEN }}" \
176253
-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 }}"}}'
178255
179256
- 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'
181258
run: |
182259
curl https://api.github.com/repos/${{ secrets.DISPATCH_OWNER }}/${{ secrets.DISPATCH_REPO }}/dispatches \
183260
-H "Accept: application/vnd.github+json" \
184261
-H "Authorization: Bearer ${{ secrets.PROWLER_BOT_ACCESS_TOKEN }}" \
185262
-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

Comments
 (0)