diff --git a/.forgejo/workflows/build.yaml b/.forgejo/workflows/build.yaml index af60fe6..ff74fe7 100644 --- a/.forgejo/workflows/build.yaml +++ b/.forgejo/workflows/build.yaml @@ -62,33 +62,36 @@ jobs: SHA: ${{ github.sha }} run: | set -euo pipefail - image_ref="$REGISTRY_HOST/nxtgauge/nxtgauge-ai-assistant:$SHA" - + image_ref="$REGISTRY_HOST/ashwin/nxtgauge-ai-assistant:$SHA" + docker buildx build --push \ -t "$image_ref" \ - -t "$REGISTRY_HOST/nxtgauge/nxtgauge-ai-assistant:latest" \ + -t "$REGISTRY_HOST/ashwin/nxtgauge-ai-assistant:latest" \ -f Dockerfile \ . - name: Update GitOps env: - GITOPS_REPO: https://ci.nxtgauge.com/nxtgauge/nxtgauge-gitops.git + GITOPS_REPO: https://ci.nxtgauge.com/ashwin/nxtgauge-gitops.git GITOPS_TOKEN: ${{ secrets.GITOPS_TOKEN }} SHA: ${{ github.sha }} run: | set -euo pipefail apk add --no-cache git - + git config --global credential.helper '!f() { printf "%s\\n" "username=forgejo-actions"; printf "%s\\n" "password=$GITOPS_TOKEN"; }; f' - + GITOPS_DIR=$(mktemp -d) git clone "$GITOPS_REPO" "$GITOPS_DIR" cd "$GITOPS_DIR" - - # Update deployment image - sed -i "s|image: ci.nxtgauge.com/nxtgauge/nxtgauge-ai-assistant:.*|image: ci.nxtgauge.com/nxtgauge/nxtgauge-ai-assistant:$SHA|" apps/nxtgauge-ai-assistant/base/deployment.yaml - + + # release-patch.yaml carries a Flux $imagepolicy marker comment on + # this line - Flux's own image-automation-controller would + # eventually rewrite it too, but committing here makes the new + # tag live immediately instead of waiting on Flux's poll interval. + sed -i -E "s|(image: ci\.nxtgauge\.com/ashwin/nxtgauge-ai-assistant:)[a-f0-9]+|\1$SHA|" apps/nxtgauge-ai-assistant/overlays/prod/release-patch.yaml + git config user.name "forgejo-actions[bot]" git config user.email "forgejo-actions@ci.nxtgauge.com" - git add apps/nxtgauge-ai-assistant/base/deployment.yaml + git add apps/nxtgauge-ai-assistant/overlays/prod/release-patch.yaml git diff --quiet || (git commit -m "chore(gitops): deploy ai-assistant@${SHA}" && git push)