ci: add gitops update step while keeping original registry config
This commit is contained in:
parent
4d6de951bf
commit
747a4cb108
1 changed files with 4 additions and 16 deletions
|
|
@ -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:
|
||||
branch: [main, high-performance]
|
||||
event: push
|
||||
|
|
@ -38,7 +32,8 @@ steps:
|
|||
- name: build-and-push
|
||||
image: woodpeckerci/plugin-kaniko:2.1.1
|
||||
settings:
|
||||
registry: registry.nxtgauge.com:5000
|
||||
registry:
|
||||
from_secret: REGISTRY_HOSTPORT
|
||||
repo: nxtgauge-rust-${SERVICE}
|
||||
dockerfile: Dockerfile.simple
|
||||
build_args:
|
||||
|
|
@ -62,23 +57,16 @@ steps:
|
|||
commands:
|
||||
- |
|
||||
set -e
|
||||
|
||||
echo "Updating GitOps for ${SERVICE}"
|
||||
|
||||
# Clone gitops repo using cloned source from Woodpecker
|
||||
git clone https://github.com/Traceworks2023/nxtgauge-gitops.git /tmp/gitops
|
||||
cd /tmp/gitops
|
||||
git checkout main
|
||||
|
||||
# Update backend overlay
|
||||
BACKEND_OVERLAY="apps/nxtgauge-backend-rust/overlays/prod"
|
||||
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}|" \
|
||||
${BACKEND_OVERLAY}/kustomization.yaml
|
||||
echo "Updated ${SERVICE} in ${BACKEND_OVERLAY}/kustomization.yaml"
|
||||
fi
|
||||
|
||||
# Commit and push
|
||||
if ! git diff --quiet; then
|
||||
git config user.name "Woodpecker CI"
|
||||
git config user.email "woodpecker@nxtgauge.com"
|
||||
|
|
@ -93,7 +81,6 @@ steps:
|
|||
status: success
|
||||
|
||||
---
|
||||
# Database migrations pipeline
|
||||
when:
|
||||
branch: [main, high-performance]
|
||||
event: push
|
||||
|
|
@ -102,7 +89,8 @@ steps:
|
|||
- name: build-and-push-migrate
|
||||
image: woodpeckerci/plugin-kaniko:2.1.1
|
||||
settings:
|
||||
registry: registry.nxtgauge.com:5000
|
||||
registry:
|
||||
from_secret: REGISTRY_HOSTPORT
|
||||
repo: nxtgauge-db-migrate
|
||||
dockerfile: Dockerfile.migrate
|
||||
context: .
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue