ci: add gitops update step while keeping original registry config

This commit is contained in:
Tracewebstudio Dev 2026-04-14 14:34:00 +02:00
parent 4d6de951bf
commit 747a4cb108

View file

@ -1,9 +1,3 @@
# Woodpecker CI - Build all services + update GitOps with image digests
#
# Secrets required in Woodpecker:
# - REGISTRY_HOSTPORT, REGISTRY_USERNAME, REGISTRY_PASSWORD (existing)
# - GITOPS_REPO_URL, GITOPS_BRANCH, GITOPS_TOKEN, GITOPS_USERNAME, GITOPS_EMAIL
when: when:
branch: [main, high-performance] branch: [main, high-performance]
event: push event: push
@ -38,7 +32,8 @@ steps:
- name: build-and-push - name: build-and-push
image: woodpeckerci/plugin-kaniko:2.1.1 image: woodpeckerci/plugin-kaniko:2.1.1
settings: settings:
registry: registry.nxtgauge.com:5000 registry:
from_secret: REGISTRY_HOSTPORT
repo: nxtgauge-rust-${SERVICE} repo: nxtgauge-rust-${SERVICE}
dockerfile: Dockerfile.simple dockerfile: Dockerfile.simple
build_args: build_args:
@ -62,23 +57,16 @@ steps:
commands: commands:
- | - |
set -e set -e
echo "Updating GitOps for ${SERVICE}" echo "Updating GitOps for ${SERVICE}"
# Clone gitops repo using cloned source from Woodpecker
git clone https://github.com/Traceworks2023/nxtgauge-gitops.git /tmp/gitops git clone https://github.com/Traceworks2023/nxtgauge-gitops.git /tmp/gitops
cd /tmp/gitops cd /tmp/gitops
git checkout main git checkout main
# Update backend overlay
BACKEND_OVERLAY="apps/nxtgauge-backend-rust/overlays/prod" BACKEND_OVERLAY="apps/nxtgauge-backend-rust/overlays/prod"
if [ -f "${BACKEND_OVERLAY}/kustomization.yaml" ]; then if [ -f "${BACKEND_OVERLAY}/kustomization.yaml" ]; then
sed -i "s|image: registry.nxtgauge.com:5000/nxtgauge-rust-${SERVICE}:.*|image: registry.nxtgauge.com:5000/nxtgauge-rust-${SERVICE}:${CI_COMMIT_SHA}|" \ sed -i "s|image: registry.nxtgauge.com:5000/nxtgauge-rust-${SERVICE}:.*|image: registry.nxtgauge.com:5000/nxtgauge-rust-${SERVICE}:${CI_COMMIT_SHA}|" \
${BACKEND_OVERLAY}/kustomization.yaml ${BACKEND_OVERLAY}/kustomization.yaml
echo "Updated ${SERVICE} in ${BACKEND_OVERLAY}/kustomization.yaml" echo "Updated ${SERVICE} in ${BACKEND_OVERLAY}/kustomization.yaml"
fi fi
# Commit and push
if ! git diff --quiet; then if ! git diff --quiet; then
git config user.name "Woodpecker CI" git config user.name "Woodpecker CI"
git config user.email "woodpecker@nxtgauge.com" git config user.email "woodpecker@nxtgauge.com"
@ -93,7 +81,6 @@ steps:
status: success status: success
--- ---
# Database migrations pipeline
when: when:
branch: [main, high-performance] branch: [main, high-performance]
event: push event: push
@ -102,7 +89,8 @@ steps:
- name: build-and-push-migrate - name: build-and-push-migrate
image: woodpeckerci/plugin-kaniko:2.1.1 image: woodpeckerci/plugin-kaniko:2.1.1
settings: settings:
registry: registry.nxtgauge.com:5000 registry:
from_secret: REGISTRY_HOSTPORT
repo: nxtgauge-db-migrate repo: nxtgauge-db-migrate
dockerfile: Dockerfile.migrate dockerfile: Dockerfile.migrate
context: . context: .