Skip to content

Commit cf3404a

Browse files
committed
Refactor GitHub workflows to simplify image tagging
- Updated workflows for building Alpine PHP test and extension images to streamline the tagging process by removing architecture-specific tags. - Consolidated tags to use a single format: `${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ matrix.php_version }}-${{ env.VERSION }}`. - Removed unnecessary build steps for arm64 architecture across multiple workflows, focusing on amd64 builds.
1 parent 0424222 commit cf3404a

File tree

6 files changed

+18
-277
lines changed

6 files changed

+18
-277
lines changed

.github/workflows/build-alpine-php-test-images-nts.yml

Lines changed: 1 addition & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -37,54 +37,4 @@ jobs:
3737
push: true
3838
build-args: |
3939
PHP_VERSION=${{ matrix.php_version }}
40-
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ matrix.php_version }}-amd64-${{ env.VERSION }}
41-
42-
build-arm64:
43-
runs-on: ubuntu-24.04-arm
44-
strategy:
45-
matrix:
46-
php_version: ['7.4','8.0','8.1','8.2','8.3','8.4','8.5']
47-
fail-fast: false
48-
permissions: { contents: read, packages: write }
49-
steps:
50-
- uses: actions/checkout@v4
51-
- uses: docker/setup-buildx-action@v3
52-
- uses: docker/login-action@v3
53-
with:
54-
registry: ${{ env.REGISTRY }}
55-
username: ${{ github.actor }}
56-
password: ${{ secrets.GITHUB_TOKEN }}
57-
- name: Build & push (arm64)
58-
uses: docker/build-push-action@v6
59-
with:
60-
context: .
61-
file: .github/workflows/Dockerfile.alpine-php-test-nts
62-
platforms: linux/arm64
63-
push: true
64-
build-args: |
65-
PHP_VERSION=${{ matrix.php_version }}
66-
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ matrix.php_version }}-arm64-${{ env.VERSION }}
67-
68-
publish-manifests:
69-
runs-on: ubuntu-24.04
70-
needs: [build-amd64, build-arm64]
71-
strategy:
72-
matrix:
73-
php_version: ['7.4','8.0','8.1','8.2','8.3','8.4','8.5']
74-
fail-fast: false
75-
permissions: { contents: read, packages: write }
76-
steps:
77-
- uses: docker/setup-buildx-action@v3
78-
- uses: docker/login-action@v3
79-
with:
80-
registry: ${{ env.REGISTRY }}
81-
username: ${{ github.actor }}
82-
password: ${{ secrets.GITHUB_TOKEN }}
83-
- name: Create multi-arch manifest
84-
run: |
85-
IMAGE=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
86-
V=${{ matrix.php_version }}
87-
docker buildx imagetools create \
88-
--tag ${IMAGE}:${V}-${{ env.VERSION }} \
89-
${IMAGE}:${V}-amd64-${{ env.VERSION }} \
90-
${IMAGE}:${V}-arm64-${{ env.VERSION }}
40+
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ matrix.php_version }}-${{ env.VERSION }}

.github/workflows/build-alpine-php-test-images-zts.yml

Lines changed: 1 addition & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -37,54 +37,4 @@ jobs:
3737
push: true
3838
build-args: |
3939
PHP_VERSION=${{ matrix.php_version }}
40-
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ matrix.php_version }}-amd64-${{ env.VERSION }}
41-
42-
build-arm64:
43-
runs-on: ubuntu-24.04-arm
44-
strategy:
45-
matrix:
46-
php_version: ['7.4','8.0','8.1','8.2','8.3','8.4','8.5']
47-
fail-fast: false
48-
permissions: { contents: read, packages: write }
49-
steps:
50-
- uses: actions/checkout@v4
51-
- uses: docker/setup-buildx-action@v3
52-
- uses: docker/login-action@v3
53-
with:
54-
registry: ${{ env.REGISTRY }}
55-
username: ${{ github.actor }}
56-
password: ${{ secrets.GITHUB_TOKEN }}
57-
- name: Build & push (arm64)
58-
uses: docker/build-push-action@v6
59-
with:
60-
context: .
61-
file: .github/workflows/Dockerfile.alpine-php-test-zts
62-
platforms: linux/arm64
63-
push: true
64-
build-args: |
65-
PHP_VERSION=${{ matrix.php_version }}
66-
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ matrix.php_version }}-arm64-${{ env.VERSION }}
67-
68-
publish-manifests:
69-
runs-on: ubuntu-24.04
70-
needs: [build-amd64, build-arm64]
71-
strategy:
72-
matrix:
73-
php_version: ['7.4','8.0','8.1','8.2','8.3','8.4','8.5']
74-
fail-fast: false
75-
permissions: { contents: read, packages: write }
76-
steps:
77-
- uses: docker/setup-buildx-action@v3
78-
- uses: docker/login-action@v3
79-
with:
80-
registry: ${{ env.REGISTRY }}
81-
username: ${{ github.actor }}
82-
password: ${{ secrets.GITHUB_TOKEN }}
83-
- name: Create multi-arch manifest
84-
run: |
85-
IMAGE=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
86-
V=${{ matrix.php_version }}
87-
docker buildx imagetools create \
88-
--tag ${IMAGE}:${V}-${{ env.VERSION }} \
89-
${IMAGE}:${V}-amd64-${{ env.VERSION }} \
90-
${IMAGE}:${V}-arm64-${{ env.VERSION }}
40+
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ matrix.php_version }}-${{ env.VERSION }}

.github/workflows/build-extension-images-alpine-nts.yml

Lines changed: 1 addition & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -37,54 +37,4 @@ jobs:
3737
push: true
3838
build-args: |
3939
PHP_VERSION=${{ matrix.php_version }}
40-
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ matrix.php_version }}-amd64-${{ env.VERSION }}
41-
42-
build-arm64:
43-
runs-on: ubuntu-24.04-arm
44-
strategy:
45-
matrix:
46-
php_version: ['7.4','8.0','8.1','8.2','8.3','8.4','8.5']
47-
fail-fast: false
48-
permissions: { contents: read, packages: write }
49-
steps:
50-
- uses: actions/checkout@v4
51-
- uses: docker/setup-buildx-action@v3
52-
- uses: docker/login-action@v3
53-
with:
54-
registry: ${{ env.REGISTRY }}
55-
username: ${{ github.actor }}
56-
password: ${{ secrets.GITHUB_TOKEN }}
57-
- name: Build & push (arm64)
58-
uses: docker/build-push-action@v6
59-
with:
60-
context: .
61-
file: .github/workflows/Dockerfile.build-extension-alpine-nts
62-
platforms: linux/arm64
63-
push: true
64-
build-args: |
65-
PHP_VERSION=${{ matrix.php_version }}
66-
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ matrix.php_version }}-arm64-${{ env.VERSION }}
67-
68-
publish-manifests:
69-
runs-on: ubuntu-24.04
70-
needs: [build-amd64, build-arm64]
71-
strategy:
72-
matrix:
73-
php_version: ['7.4','8.0','8.1','8.2','8.3','8.4','8.5']
74-
fail-fast: false
75-
permissions: { contents: read, packages: write }
76-
steps:
77-
- uses: docker/setup-buildx-action@v3
78-
- uses: docker/login-action@v3
79-
with:
80-
registry: ${{ env.REGISTRY }}
81-
username: ${{ github.actor }}
82-
password: ${{ secrets.GITHUB_TOKEN }}
83-
- name: Create multi-arch manifest
84-
run: |
85-
IMAGE=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
86-
V=${{ matrix.php_version }}
87-
docker buildx imagetools create \
88-
--tag ${IMAGE}:${V}-${{ env.VERSION }} \
89-
${IMAGE}:${V}-amd64-${{ env.VERSION }} \
90-
${IMAGE}:${V}-arm64-${{ env.VERSION }}
40+
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ matrix.php_version }}-${{ env.VERSION }}

.github/workflows/build-extension-images-alpine-zts.yml

Lines changed: 1 addition & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -37,54 +37,4 @@ jobs:
3737
push: true
3838
build-args: |
3939
PHP_VERSION=${{ matrix.php_version }}
40-
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ matrix.php_version }}-amd64-${{ env.VERSION }}
41-
42-
build-arm64:
43-
runs-on: ubuntu-24.04-arm
44-
strategy:
45-
matrix:
46-
php_version: ['7.4','8.0','8.1','8.2','8.3','8.4','8.5']
47-
fail-fast: false
48-
permissions: { contents: read, packages: write }
49-
steps:
50-
- uses: actions/checkout@v4
51-
- uses: docker/setup-buildx-action@v3
52-
- uses: docker/login-action@v3
53-
with:
54-
registry: ${{ env.REGISTRY }}
55-
username: ${{ github.actor }}
56-
password: ${{ secrets.GITHUB_TOKEN }}
57-
- name: Build & push (arm64)
58-
uses: docker/build-push-action@v6
59-
with:
60-
context: .
61-
file: .github/workflows/Dockerfile.build-extension-alpine-zts
62-
platforms: linux/arm64
63-
push: true
64-
build-args: |
65-
PHP_VERSION=${{ matrix.php_version }}
66-
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ matrix.php_version }}-arm64-${{ env.VERSION }}
67-
68-
publish-manifests:
69-
runs-on: ubuntu-24.04
70-
needs: [build-amd64, build-arm64]
71-
strategy:
72-
matrix:
73-
php_version: ['7.4','8.0','8.1','8.2','8.3','8.4','8.5']
74-
fail-fast: false
75-
permissions: { contents: read, packages: write }
76-
steps:
77-
- uses: docker/setup-buildx-action@v3
78-
- uses: docker/login-action@v3
79-
with:
80-
registry: ${{ env.REGISTRY }}
81-
username: ${{ github.actor }}
82-
password: ${{ secrets.GITHUB_TOKEN }}
83-
- name: Create multi-arch manifest
84-
run: |
85-
IMAGE=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
86-
V=${{ matrix.php_version }}
87-
docker buildx imagetools create \
88-
--tag ${IMAGE}:${V}-${{ env.VERSION }} \
89-
${IMAGE}:${V}-amd64-${{ env.VERSION }} \
90-
${IMAGE}:${V}-arm64-${{ env.VERSION }}
40+
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ matrix.php_version }}-${{ env.VERSION }}

.github/workflows/build-libs-alpine-image.yml

Lines changed: 2 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -34,54 +34,7 @@ jobs:
3434
platforms: linux/amd64
3535
push: true
3636
tags: |
37-
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.VERSION }}-amd64
37+
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.VERSION }}
38+
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest
3839
cache-from: type=registry,ref=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:cache-${{ env.VERSION }}-amd64
3940
cache-to: type=registry,ref=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:cache-${{ env.VERSION }}-amd64,mode=max
40-
41-
build-arm64:
42-
runs-on: ubuntu-24.04-arm
43-
permissions:
44-
contents: read
45-
packages: write
46-
steps:
47-
- uses: actions/checkout@v4
48-
- uses: docker/setup-buildx-action@v3
49-
- uses: docker/login-action@v3
50-
with:
51-
registry: ${{ env.REGISTRY }}
52-
username: ${{ github.actor }}
53-
password: ${{ secrets.GITHUB_TOKEN }}
54-
- name: Build & push (arm64)
55-
uses: docker/build-push-action@v6
56-
with:
57-
context: .
58-
file: .github/workflows/Dockerfile.build-libs-alpine
59-
platforms: linux/arm64
60-
push: true
61-
tags: |
62-
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.VERSION }}-arm64
63-
cache-from: type=registry,ref=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:cache-${{ env.VERSION }}-arm64
64-
cache-to: type=registry,ref=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:cache-${{ env.VERSION }}-arm64,mode=max
65-
66-
publish-manifest:
67-
runs-on: ubuntu-24.04
68-
needs: [build-amd64, build-arm64]
69-
permissions:
70-
contents: read
71-
packages: write
72-
steps:
73-
- uses: docker/setup-buildx-action@v3
74-
- uses: docker/login-action@v3
75-
with:
76-
registry: ${{ env.REGISTRY }}
77-
username: ${{ github.actor }}
78-
password: ${{ secrets.GITHUB_TOKEN }}
79-
- name: Create multi-arch manifest
80-
run: |
81-
IMAGE=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
82-
VERSION=${{ env.VERSION }}
83-
docker buildx imagetools create \
84-
--tag ${IMAGE}:${VERSION} \
85-
--tag ${IMAGE}:latest \
86-
${IMAGE}:${VERSION}-amd64 \
87-
${IMAGE}:${VERSION}-arm64

.github/workflows/build.yml

Lines changed: 12 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -79,14 +79,10 @@ jobs:
7979
${{ github.workspace }}/build/aikido-request-processor.so
8080
8181
build_libs_alpine:
82-
name: Build Go libs (Alpine/musl) ${{ matrix.arch == '' && 'x86_64' || 'arm' }}
83-
runs-on: ubuntu-24.04${{ matrix.arch }}
82+
name: Build Go libs (Alpine/musl) x86_64
83+
runs-on: ubuntu-24.04
8484
container:
8585
image: ghcr.io/aikidosec/firewall-php-build-libs-alpine:v1
86-
strategy:
87-
matrix:
88-
arch: [ '', '-arm' ]
89-
fail-fast: false
9086

9187
steps:
9288
- name: Checkout repository
@@ -252,13 +248,12 @@ jobs:
252248
${{ github.workspace }}/tests/*.diff
253249
254250
build_php_extension_alpine_nts:
255-
name: Build php ${{ matrix.php_version }} extension Alpine NTS ${{ matrix.arch == '' && 'x86_64' || 'arm' }}
256-
runs-on: ubuntu-24.04${{ matrix.arch }}
251+
name: Build php ${{ matrix.php_version }} extension Alpine NTS x86_64
252+
runs-on: ubuntu-24.04
257253
container: ghcr.io/aikidosec/firewall-php-build-extension-alpine-nts:${{ matrix.php_version }}-v1
258254
strategy:
259255
matrix:
260256
php_version: ['7.4', '8.0', '8.1', '8.2', '8.3', '8.4', '8.5']
261-
arch: [ '', '-arm' ]
262257
fail-fast: false
263258

264259
steps:
@@ -305,13 +300,12 @@ jobs:
305300
${{ github.workspace }}/tests/*.diff
306301
307302
build_php_extension_alpine_zts:
308-
name: Build php ${{ matrix.php_version }} extension Alpine ZTS ${{ matrix.arch == '' && 'x86_64' || 'arm' }}
309-
runs-on: ubuntu-24.04${{ matrix.arch }}
303+
name: Build php ${{ matrix.php_version }} extension Alpine ZTS x86_64
304+
runs-on: ubuntu-24.04
310305
container: ghcr.io/aikidosec/firewall-php-build-extension-alpine-zts:${{ matrix.php_version }}-v1
311306
strategy:
312307
matrix:
313308
php_version: ['7.4', '8.0', '8.1', '8.2', '8.3', '8.4', '8.5']
314-
arch: [ '', '-arm' ]
315309
fail-fast: false
316310

317311
steps:
@@ -552,14 +546,10 @@ jobs:
552546
${{ env.AIKIDO_ARTIFACT }}
553547
554548
build_apk:
555-
name: Build apk ${{ matrix.arch == '' && 'x86_64' || 'arm' }}
556-
runs-on: ubuntu-24.04${{ matrix.arch }}
549+
name: Build apk x86_64
550+
runs-on: ubuntu-24.04
557551
container:
558552
image: alpine:3.21
559-
strategy:
560-
matrix:
561-
arch: ['', '-arm']
562-
fail-fast: false
563553
needs: [ build_libs_alpine, build_php_extension_alpine_nts, build_php_extension_alpine_zts ]
564554
steps:
565555
- name: Checkout repository
@@ -1155,8 +1145,8 @@ jobs:
11551145
python3 run_server_tests.py ../tests/server ../tests/testlib --server=${{ matrix.server }} --max-runs=3
11561146
11571147
test_php_alpine:
1158-
name: Alpine NTS php-${{ matrix.php_version }} ${{ matrix.server }} ${{ matrix.arch == '' && 'x86_64' || 'arm' }}
1159-
runs-on: ubuntu-24.04${{ matrix.arch }}
1148+
name: Alpine NTS php-${{ matrix.php_version }} ${{ matrix.server }} x86_64
1149+
runs-on: ubuntu-24.04
11601150
container:
11611151
image: ghcr.io/aikidosec/firewall-php-test-alpine-nts:${{ matrix.php_version }}-v1
11621152
options: --privileged
@@ -1165,7 +1155,6 @@ jobs:
11651155
matrix:
11661156
php_version: ['7.4', '8.0', '8.1', '8.2', '8.3', '8.4', '8.5']
11671157
server: ['nginx-php-fpm', 'php-built-in']
1168-
arch: ['', '-arm']
11691158
fail-fast: false
11701159

11711160
steps:
@@ -1243,8 +1232,8 @@ jobs:
12431232
python3 run_server_tests.py ../tests/server ../tests/testlib --server=${{ matrix.server }} --max-runs=3
12441233
12451234
test_php_alpine_zts:
1246-
name: Alpine ZTS php-${{ matrix.php_version }} ${{ matrix.server }} ${{ matrix.arch == '' && 'x86_64' || 'arm' }}
1247-
runs-on: ubuntu-24.04${{ matrix.arch }}
1235+
name: Alpine ZTS php-${{ matrix.php_version }} ${{ matrix.server }} x86_64
1236+
runs-on: ubuntu-24.04
12481237
container:
12491238
image: ghcr.io/aikidosec/firewall-php-test-alpine-zts:${{ matrix.php_version }}-v1
12501239
options: --privileged
@@ -1253,7 +1242,6 @@ jobs:
12531242
matrix:
12541243
php_version: ['7.4', '8.0', '8.1', '8.2', '8.3', '8.4', '8.5']
12551244
server: ['nginx-php-fpm', 'php-built-in']
1256-
arch: ['', '-arm']
12571245
fail-fast: false
12581246

12591247
steps:

0 commit comments

Comments
 (0)