passage à un job kaniko
Build and Deploy Jekyll / deploy (push) Has been cancelled

This commit is contained in:
2026-05-25 15:25:40 +00:00
parent 13f9587844
commit 3872738a08
+61 -6
View File
@@ -4,37 +4,92 @@ on:
push:
branches:
- main
workflow_dispatch:
env:
IMAGE: registry.alocoq.fr/coqresearch:latest
jobs:
build:
deploy:
runs-on: native
timeout-minutes: 15
timeout-minutes: 30
steps:
- name: Build Jekyll in Kubernetes job
- name: Build and push image with Kaniko
run: |
cat <<'EOF' | kubectl apply -f -
apiVersion: batch/v1
kind: Job
metadata:
name: jekyll-build
name: coqresearch-kaniko
namespace: ci
spec:
backoffLimit: 0
template:
spec:
restartPolicy: Never
containers:
- name: jekyll
initContainers:
- name: prepare
image: ruby:3.3-alpine
command:
- sh
- -c
- |
set -eux
apk add --no-cache git build-base
git clone --depth 1 https://git.alocoq.fr/alois/CoqResearch.git /work
cd /work
bundle install
bundle exec jekyll build
mkdir -p /workspace/image
cp -a /work/_site/. /workspace/image/
cat > /workspace/image/Dockerfile <<'DOCKER'
FROM nginx:alpine
COPY . /usr/share/nginx/html/
DOCKER
volumeMounts:
- name: workspace
mountPath: /workspace
containers:
- name: kaniko
image: gcr.io/kaniko-project/executor:debug
args:
- --context=dir:///workspace/image
- --dockerfile=/workspace/image/Dockerfile
- --destination=registry.alocoq.fr/coqresearch:latest
volumeMounts:
- name: workspace
mountPath: /workspace
volumes:
- name: workspace
emptyDir: {}
EOF
- name: Wait for build
run: |
kubectl -n ci wait --for=condition=complete job/coqresearch-kaniko --timeout=1800s
- name: Show logs
if: always()
run: |
kubectl -n ci logs job/coqresearch-kaniko -c prepare || true
kubectl -n ci logs job/coqresearch-kaniko -c kaniko || true
- name: Deploy
run: |
kubectl -n research set image deployment/research-nginx \
research-nginx=registry.alocoq.fr/coqresearch:latest
kubectl -n research rollout restart deployment/research-nginx
kubectl -n research rollout status deployment/research-nginx
- name: Cleanup
if: always()
run: |
kubectl -n ci delete job coqresearch-kaniko --ignore-not-found=true