chore: improve image tag update logic in deploy workflow and adjust image registry URL format
Some checks failed
Build (develop) / Promote (main) / build-and-push-deploy (push) Failing after 5m28s
Some checks failed
Build (develop) / Promote (main) / build-and-push-deploy (push) Failing after 5m28s
This commit is contained in:
@@ -45,11 +45,11 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
SHA_TAG=$(echo "${{ github.sha }}" | cut -c1-7)
|
SHA_TAG=$(echo "${{ github.sha }}" | cut -c1-7)
|
||||||
IMAGE_NAME="172.35.0.216:3000/simplifique/vendaweb-portal"
|
|
||||||
|
|
||||||
MANIFEST_FILE="k8s/overlays/prod/deployment-image-digest-patch.yaml"
|
MANIFEST_FILE="k8s/overlays/prod/deployment-image-digest-patch.yaml"
|
||||||
|
|
||||||
sed -i -E "s|^([[:space:]]*image: ${IMAGE_NAME}:).*|\\1${SHA_TAG}|g" "$MANIFEST_FILE"
|
# Match image line for vendaweb-portal and replace tag (works with any registry hostname)
|
||||||
|
sed -i -E "s|(image: .*vendaweb-portal:).*|\1${SHA_TAG}|" "$MANIFEST_FILE"
|
||||||
|
|
||||||
if [ -z "${{ secrets.GITEA_TOKEN }}" ]; then
|
if [ -z "${{ secrets.GITEA_TOKEN }}" ]; then
|
||||||
echo "Missing secrets.GITEA_TOKEN (needed to push back to repo)"
|
echo "Missing secrets.GITEA_TOKEN (needed to push back to repo)"
|
||||||
@@ -62,5 +62,9 @@ jobs:
|
|||||||
git config user.email "actions@simplifiquehc.com.br"
|
git config user.email "actions@simplifiquehc.com.br"
|
||||||
|
|
||||||
git add "$MANIFEST_FILE"
|
git add "$MANIFEST_FILE"
|
||||||
git commit -m "chore: update image tag to $SHA_TAG [skip ci]"
|
if git diff --staged --quiet; then
|
||||||
git push origin main
|
echo "Manifest already has image tag $SHA_TAG, nothing to commit"
|
||||||
|
else
|
||||||
|
git commit -m "chore: update image tag to $SHA_TAG [skip ci]"
|
||||||
|
git push origin main
|
||||||
|
fi
|
||||||
|
|||||||
@@ -7,4 +7,4 @@ spec:
|
|||||||
spec:
|
spec:
|
||||||
containers:
|
containers:
|
||||||
- name: portal
|
- name: portal
|
||||||
image: git.simplifiquehc.com.br/simplifique/vendaweb-portal:d7edd99
|
image: 172.35.0.216:3000/simplifique/vendaweb-portal:d7edd99
|
||||||
|
|||||||
Reference in New Issue
Block a user