ci(build): use short SHA tags for image manifests

Expose the short SHA between workflow jobs and verify image tag propagation.
This commit is contained in:
Andras Bacsai
2026-08-15 23:50:14 +02:00
parent c6a12d7078
commit 7bcdc23086
2 changed files with 11 additions and 6 deletions
+7 -4
View File
@@ -15,6 +15,8 @@ env:
jobs:
build-push:
outputs:
short_sha: ${{ steps.version.outputs.short_sha }}
strategy:
matrix:
include:
@@ -35,6 +37,7 @@ jobs:
run: |
BASE_VERSION=$(docker run --rm -v "$(pwd):/app" -w /app php:8.2-alpine3.16 php bootstrap/getVersion.php)
echo "version=${BASE_VERSION}-dev.${GITHUB_SHA::9}" >> "$GITHUB_OUTPUT"
echo "short_sha=${GITHUB_SHA::7}" >> "$GITHUB_OUTPUT"
- name: Login to ${{ env.GITHUB_REGISTRY }}
uses: docker/login-action@v3
@@ -60,8 +63,8 @@ jobs:
build-args: |
COOLIFY_VERSION=${{ steps.version.outputs.version }}
tags: |
${{ env.DOCKER_REGISTRY }}/${{ env.IMAGE_NAME }}:sha-${{ github.sha }}-${{ matrix.arch }}
${{ env.GITHUB_REGISTRY }}/${{ env.IMAGE_NAME }}:sha-${{ github.sha }}-${{ matrix.arch }}
${{ env.DOCKER_REGISTRY }}/${{ env.IMAGE_NAME }}:sha-${{ steps.version.outputs.short_sha }}-${{ matrix.arch }}
${{ env.GITHUB_REGISTRY }}/${{ env.IMAGE_NAME }}:sha-${{ steps.version.outputs.short_sha }}-${{ matrix.arch }}
merge-manifest:
runs-on: ubuntu-24.04
@@ -86,7 +89,7 @@ jobs:
- name: Create & publish manifest on ${{ env.GITHUB_REGISTRY }}
env:
REGISTRY: ${{ env.GITHUB_REGISTRY }}
SHA: ${{ github.sha }}
SHA: ${{ needs.build-push.outputs.short_sha }}
run: |
IMAGE="${REGISTRY}/${IMAGE_NAME}"
docker buildx imagetools create \
@@ -97,7 +100,7 @@ jobs:
- name: Create & publish manifest on ${{ env.DOCKER_REGISTRY }}
env:
REGISTRY: ${{ env.DOCKER_REGISTRY }}
SHA: ${{ github.sha }}
SHA: ${{ needs.build-push.outputs.short_sha }}
run: |
IMAGE="${REGISTRY}/${IMAGE_NAME}"
docker buildx imagetools create \
+4 -2
View File
@@ -9,8 +9,10 @@ it('publishes v4 branch builds under the commit sha with a traceable internal ve
->toContain('name: Build Coolify (SHA)')
->toContain('branches: ["main"]')
->not->toContain('v4.x')
->toContain('sha-${{ github.sha }}-${{ matrix.arch }}')
->toContain('sha-${{ github.sha }}')
->toContain('short_sha=${GITHUB_SHA::7}')
->toContain('sha-${{ steps.version.outputs.short_sha }}-${{ matrix.arch }}')
->toContain('SHA: ${{ needs.build-push.outputs.short_sha }}')
->not->toContain('sha-${{ github.sha }}')
->toContain('php bootstrap/getVersion.php')
->toContain('version=${BASE_VERSION}-dev.${GITHUB_SHA::9}')
->toContain('COOLIFY_VERSION=${{ steps.version.outputs.version }}')