This commit is contained in:
29
.woodpecker/pipeline.yml
Normal file
29
.woodpecker/pipeline.yml
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
kind: pipeline
|
||||||
|
name: deploy-to-k3s
|
||||||
|
|
||||||
|
steps:
|
||||||
|
# Étape 1 : Les tests (Node.js est automatiquement inclus dans l'image choisie)
|
||||||
|
test:
|
||||||
|
image: node:18-alpine
|
||||||
|
commands:
|
||||||
|
- node -v
|
||||||
|
- npm install
|
||||||
|
- echo "Tests réussis !"
|
||||||
|
|
||||||
|
# Étape 2 : Le déploiement (Utilise une image avec kubectl déjà prêt)
|
||||||
|
deploy:
|
||||||
|
image: bitnami/kubectl:latest
|
||||||
|
environment:
|
||||||
|
# On passe le Kubeconfig via un secret Woodpecker (à créer dans l'UI)
|
||||||
|
KUBECONFIG_DATA:
|
||||||
|
from_secret: k3s_kubeconfig
|
||||||
|
commands:
|
||||||
|
- mkdir -p ~/.kube
|
||||||
|
- echo "$KUBECONFIG_DATA" > ~/.kube/config
|
||||||
|
- kubectl apply -f deployment.yaml -n devops-tools
|
||||||
|
- kubectl rollout status deployment/hello-k3s -n devops-tools
|
||||||
|
|
||||||
|
# Optionnel : Ne déclencher que sur la branche main
|
||||||
|
when:
|
||||||
|
branch: main
|
||||||
|
event: push
|
||||||
Reference in New Issue
Block a user