Actualiser .gitea/workflows/deploy-verso.yml
Build and Deploy Verso / deploy (push) Has been cancelled
Build and Deploy Verso / deploy (push) Has been cancelled
This commit is contained in:
@@ -0,0 +1,86 @@
|
||||
name: Build and Deploy Verso
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
workflow_dispatch:
|
||||
|
||||
env:
|
||||
IMAGE: registry.alocoq.fr/verso:latest
|
||||
REPO_URL: https://git.alocoq.fr/alois/verso.git
|
||||
|
||||
jobs:
|
||||
deploy:
|
||||
runs-on: native
|
||||
timeout-minutes: 60
|
||||
|
||||
steps:
|
||||
- name: Build and push image with Kaniko
|
||||
run: |
|
||||
kubectl -n ci delete job verso-kaniko --ignore-not-found=true
|
||||
|
||||
cat <<'EOF' | kubectl apply -f -
|
||||
apiVersion: batch/v1
|
||||
kind: Job
|
||||
metadata:
|
||||
name: verso-kaniko
|
||||
namespace: ci
|
||||
spec:
|
||||
backoffLimit: 0
|
||||
template:
|
||||
spec:
|
||||
restartPolicy: Never
|
||||
|
||||
initContainers:
|
||||
- name: prepare
|
||||
image: alpine/git:latest
|
||||
command:
|
||||
- sh
|
||||
- -c
|
||||
- |
|
||||
set -eux
|
||||
git clone --depth 1 https://git.alocoq.fr/alois/verso.git /workspace/repo
|
||||
|
||||
volumeMounts:
|
||||
- name: workspace
|
||||
mountPath: /workspace
|
||||
|
||||
containers:
|
||||
- name: kaniko
|
||||
image: gcr.io/kaniko-project/executor:debug
|
||||
args:
|
||||
- --context=dir:///workspace/repo/server-ce
|
||||
- --dockerfile=/workspace/repo/server-ce/Dockerfile
|
||||
- --destination=registry.alocoq.fr/verso:latest
|
||||
volumeMounts:
|
||||
- name: workspace
|
||||
mountPath: /workspace
|
||||
|
||||
volumes:
|
||||
- name: workspace
|
||||
emptyDir: {}
|
||||
EOF
|
||||
|
||||
- name: Wait for build
|
||||
run: |
|
||||
kubectl -n ci wait --for=condition=complete job/verso-kaniko --timeout=3600s
|
||||
|
||||
- name: Show logs
|
||||
if: always()
|
||||
run: |
|
||||
kubectl -n ci logs job/verso-kaniko -c prepare || true
|
||||
kubectl -n ci logs job/verso-kaniko -c kaniko || true
|
||||
|
||||
- name: Deploy
|
||||
run: |
|
||||
kubectl -n verso-dev set image deployment/verso \
|
||||
verso=registry.alocoq.fr/verso:latest
|
||||
|
||||
kubectl -n verso-dev rollout restart deployment/verso
|
||||
kubectl -n verso-dev rollout status deployment/verso
|
||||
|
||||
- name: Cleanup
|
||||
if: always()
|
||||
run: |
|
||||
kubectl -n ci delete job verso-kaniko --ignore-not-found=true
|
||||
Reference in New Issue
Block a user