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:
|
when:
|
||||||
branch: [main, high-performance]
|
branch: [main, high-performance]
|
||||||
event: push
|
event: push
|
||||||
|
|
@ -12,7 +6,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-admin-solid
|
repo: nxtgauge-admin-solid
|
||||||
dockerfile: Dockerfile.simple
|
dockerfile: Dockerfile.simple
|
||||||
tags:
|
tags:
|
||||||
|
|
@ -34,22 +29,16 @@ steps:
|
||||||
commands:
|
commands:
|
||||||
- |
|
- |
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
echo "Updating GitOps for nxtgauge-admin-solid"
|
echo "Updating GitOps for nxtgauge-admin-solid"
|
||||||
|
|
||||||
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 admin overlay
|
|
||||||
ADMIN_OVERLAY="apps/nxtgauge-admin-solid/overlays/prod"
|
ADMIN_OVERLAY="apps/nxtgauge-admin-solid/overlays/prod"
|
||||||
if [ -f "${ADMIN_OVERLAY}/kustomization.yaml" ]; then
|
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}|" \
|
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
|
${ADMIN_OVERLAY}/kustomization.yaml
|
||||||
echo "Updated admin image to ${CI_COMMIT_SHA}"
|
echo "Updated admin image to ${CI_COMMIT_SHA}"
|
||||||
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"
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue