66 lines
2.0 KiB
YAML
66 lines
2.0 KiB
YAML
steps:
|
|
build-frontend:
|
|
name: Build & Push Frontend
|
|
image: woodpeckerci/plugin-kaniko
|
|
when:
|
|
event: [ push, pull_request, tag, manual ] # 👈 allow manual run
|
|
path:
|
|
include: [ frontend/** ] # 👈 filter for auto-trigger
|
|
settings:
|
|
registry: harbor.dvirlabs.com
|
|
repo: my-apps/labmap-frontend
|
|
dockerfile: frontend/Dockerfile
|
|
context: frontend
|
|
tags:
|
|
- latest
|
|
- ${CI_COMMIT_SHA:0:7}
|
|
username:
|
|
from_secret: DOCKER_USERNAME
|
|
password:
|
|
from_secret: DOCKER_PASSWORD
|
|
|
|
build-backend:
|
|
name: Build & Push Backend
|
|
image: woodpeckerci/plugin-kaniko
|
|
when:
|
|
event: [ push, pull_request, tag, manual ]
|
|
path:
|
|
include: [ backend/** ]
|
|
settings:
|
|
registry: harbor.dvirlabs.com
|
|
repo: my-apps/labmap-backend
|
|
dockerfile: backend/Dockerfile
|
|
context: backend
|
|
tags:
|
|
- latest
|
|
- ${CI_COMMIT_SHA:0:7}
|
|
username:
|
|
from_secret: DOCKER_USERNAME
|
|
password:
|
|
from_secret: DOCKER_PASSWORD
|
|
|
|
update-values:
|
|
name: Update my-apps image tag
|
|
image: alpine
|
|
when:
|
|
branch: master
|
|
event: push
|
|
environment:
|
|
GIT_SSH_COMMAND: 'ssh -i /root/.ssh/id_rsa -o StrictHostKeyChecking=no'
|
|
GIT_DEPLOY_KEY:
|
|
from_secret: GIT_DEPLOY_KEY
|
|
commands:
|
|
- apk add --no-cache git openssh yq
|
|
- mkdir -p ~/.ssh
|
|
- echo "$GIT_DEPLOY_KEY" > ~/.ssh/id_rsa
|
|
- chmod 600 ~/.ssh/id_rsa
|
|
- ssh-keyscan 192.168.10.242 >> ~/.ssh/known_hosts
|
|
- git config --global user.name "Woodpecker Bot"
|
|
- git config --global user.email "ci@dvirlabs.com"
|
|
- git clone git@192.168.10.242:dvirlabs/my-apps.git
|
|
- cd my-apps/manifests/labmap
|
|
- yq e '.image.frontend.tag = "${CI_COMMIT_SHA:0:7}"' -i values.yaml
|
|
- yq e '.image.backend.tag = "${CI_COMMIT_SHA:0:7}"' -i values.yaml
|
|
- git add values.yaml
|
|
- git commit -m "Update labmap image tags to ${CI_COMMIT_SHA:0:7}" || echo "No changes to commit"
|
|
- git push origin master |