Simplified container building workflow - now only checks for presence of container tag on repo
Some checks failed
SonarQube Scan / SonarQube Trigger (push) Failing after 15m51s
Build containers when image tags change / build-if-image-changed (., web, containers, main container, git.baumann.gr/adebaumann/vui) (push) Successful in 6s
Build containers when image tags change / build-if-image-changed (data-loader, loader, initContainers, init-container, git.baumann.gr/adebaumann/vui-data-loader) (push) Successful in 4s
Some checks failed
SonarQube Scan / SonarQube Trigger (push) Failing after 15m51s
Build containers when image tags change / build-if-image-changed (., web, containers, main container, git.baumann.gr/adebaumann/vui) (push) Successful in 6s
Build containers when image tags change / build-if-image-changed (data-loader, loader, initContainers, init-container, git.baumann.gr/adebaumann/vui-data-loader) (push) Successful in 4s
This commit is contained in:
@@ -211,28 +211,17 @@ jobs:
|
||||
echo "ERROR: Found $ctype \"$cname\" image repo is \"$new_repo\" but expected \"$expected_repo\""
|
||||
exit 1
|
||||
fi
|
||||
if [ -n "${old_image:-}" ]; then
|
||||
old_tag="${old_image##*:}"
|
||||
else
|
||||
old_tag=""
|
||||
fi
|
||||
|
||||
registry="$(echo "$new_repo" | awk -F/ '{print $1}')"
|
||||
|
||||
{
|
||||
echo "changed=$([ "$old_tag" != "$new_tag" ] && echo true || echo false)"
|
||||
echo "new_image=$new_image"
|
||||
echo "new_repo=$new_repo"
|
||||
echo "new_tag=$new_tag"
|
||||
echo "registry=$registry"
|
||||
} >> "$GITHUB_OUTPUT"
|
||||
|
||||
- name: Skip if tag unchanged
|
||||
if: steps.img.outputs.changed != 'true'
|
||||
run: echo "${{ matrix.description }} image tag unchanged; skipping build."
|
||||
|
||||
- name: Check if image exists on registry
|
||||
if: steps.img.outputs.changed == 'true'
|
||||
id: check_image
|
||||
shell: bash
|
||||
run: |
|
||||
@@ -267,15 +256,15 @@ jobs:
|
||||
fi
|
||||
|
||||
- name: Skip if image already exists
|
||||
if: steps.img.outputs.changed == 'true' && steps.check_image.outputs.exists == 'true'
|
||||
if: steps.check_image.outputs.exists == 'true'
|
||||
run: echo "${{ matrix.description }} image ${{ steps.img.outputs.new_image }} already exists on registry; skipping build."
|
||||
|
||||
- name: Set up Buildx
|
||||
if: steps.img.outputs.changed == 'true' && steps.check_image.outputs.exists == 'false'
|
||||
if: steps.check_image.outputs.exists == 'false'
|
||||
uses: docker/setup-buildx-action@v3
|
||||
|
||||
- name: Log in to registry
|
||||
if: steps.img.outputs.changed == 'true' && steps.check_image.outputs.exists == 'false'
|
||||
if: steps.check_image.outputs.exists == 'false'
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
registry: ${{ steps.img.outputs.registry }}
|
||||
@@ -283,7 +272,7 @@ jobs:
|
||||
password: ${{ secrets.REGISTRY_PASSWORD }}
|
||||
|
||||
- name: Build and push ${{ matrix.description }} (exact tag from deployment)
|
||||
if: steps.img.outputs.changed == 'true' && steps.check_image.outputs.exists == 'false'
|
||||
if: steps.check_image.outputs.exists == 'false'
|
||||
uses: docker/build-push-action@v6
|
||||
with:
|
||||
context: ${{ matrix.build_context }}
|
||||
|
||||
Reference in New Issue
Block a user