diff --git a/.gitea/workflow/deploy-verso.yml b/.gitea/workflow/deploy-verso.yml deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/.gitea/workflows/deploy-verso.yml b/.gitea/workflows/deploy-verso.yml new file mode 100644 index 0000000000..0bd4ad86e9 --- /dev/null +++ b/.gitea/workflows/deploy-verso.yml @@ -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 \ No newline at end of file