ci: add gitops update step while keeping original registry config
This commit is contained in:
parent
8959025299
commit
9cae2f9125
1 changed files with 2 additions and 13 deletions
|
|
@ -1,9 +1,3 @@
|
|||
# Woodpecker CI - Admin build + GitOps update
|
||||
#
|
||||
# Secrets required:
|
||||
# - 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
|
||||
|
|
@ -12,7 +6,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-admin-solid
|
||||
dockerfile: Dockerfile.simple
|
||||
tags:
|
||||
|
|
@ -34,22 +29,16 @@ steps:
|
|||
commands:
|
||||
- |
|
||||
set -e
|
||||
|
||||
echo "Updating GitOps for nxtgauge-admin-solid"
|
||||
|
||||
git clone https://github.com/Traceworks2023/nxtgauge-gitops.git /tmp/gitops
|
||||
cd /tmp/gitops
|
||||
git checkout main
|
||||
|
||||
# Update admin overlay
|
||||
ADMIN_OVERLAY="apps/nxtgauge-admin-solid/overlays/prod"
|
||||
if [ -f "${ADMIN_OVERLAY}/kustomization.yaml" ]; then
|
||||
sed -i "s|image: registry.nxtgauge.com:5000/nxtgauge-admin-solid:.*|image: registry.nxtgauge.com:5000/nxtgauge-admin-solid:${CI_COMMIT_SHA}|" \
|
||||
${ADMIN_OVERLAY}/kustomization.yaml
|
||||
echo "Updated admin image to ${CI_COMMIT_SHA}"
|
||||
fi
|
||||
|
||||
# Commit and push
|
||||
if ! git diff --quiet; then
|
||||
git config user.name "Woodpecker CI"
|
||||
git config user.email "woodpecker@nxtgauge.com"
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue