ci: add gitops update step while keeping original registry config
This commit is contained in:
parent
42f1b7a220
commit
faaca623d1
2 changed files with 4 additions and 13 deletions
|
|
@ -1,9 +1,3 @@
|
||||||
# Woodpecker CI - Frontend 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-frontend-solid
|
repo: nxtgauge-frontend-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-frontend-solid"
|
echo "Updating GitOps for nxtgauge-frontend-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 frontend overlay
|
|
||||||
FRONTEND_OVERLAY="apps/nxtgauge-frontend-solid/overlays/prod"
|
FRONTEND_OVERLAY="apps/nxtgauge-frontend-solid/overlays/prod"
|
||||||
if [ -f "${FRONTEND_OVERLAY}/kustomization.yaml" ]; then
|
if [ -f "${FRONTEND_OVERLAY}/kustomization.yaml" ]; then
|
||||||
sed -i "s|image: registry.nxtgauge.com:5000/nxtgauge-frontend-solid:.*|image: registry.nxtgauge.com:5000/nxtgauge-frontend-solid:${CI_COMMIT_SHA}|" \
|
sed -i "s|image: registry.nxtgauge.com:5000/nxtgauge-frontend-solid:.*|image: registry.nxtgauge.com:5000/nxtgauge-frontend-solid:${CI_COMMIT_SHA}|" \
|
||||||
${FRONTEND_OVERLAY}/kustomization.yaml
|
${FRONTEND_OVERLAY}/kustomization.yaml
|
||||||
echo "Updated frontend image to ${CI_COMMIT_SHA}"
|
echo "Updated frontend 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"
|
||||||
|
|
|
||||||
|
|
@ -138,3 +138,5 @@ vinxi starting dev server
|
||||||
2:31:43 PM [vite] (client) page reload .woodpecker.yml
|
2:31:43 PM [vite] (client) page reload .woodpecker.yml
|
||||||
2:32:20 PM [vite] (ssr) page reload .woodpecker.yml
|
2:32:20 PM [vite] (ssr) page reload .woodpecker.yml
|
||||||
2:32:20 PM [vite] (client) page reload .woodpecker.yml
|
2:32:20 PM [vite] (client) page reload .woodpecker.yml
|
||||||
|
2:33:52 PM [vite] (ssr) page reload .woodpecker.yml
|
||||||
|
2:33:52 PM [vite] (client) page reload .woodpecker.yml
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue