Ajouter .forgejo/workflows/deploy.yml
Some checks failed
Deploy to Kubernetes / deploy-to-k8s (push) Failing after 16s

This commit is contained in:
gano 2025-05-09 15:06:28 +00:00
parent 031ccd0e0b
commit 51ccf00431

View file

@ -0,0 +1,45 @@
name: Deploy to Kubernetes
on:
push:
tags:
- '*'
jobs:
deploy-to-k8s:
runs-on: docker
steps:
- name: Checkout du code
uses: actions/checkout@v3
- name: Installer kubectl
run: |
apt-get update
apt-get install -y curl
curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl"
chmod +x kubectl
mv kubectl /usr/local/bin/
- name: Déployer sur Kubernetes
uses: docker://bitnami/kubectl:latest
env:
KUBECONFIG_DATA: ${{ secrets.KUBECONFIG_DATA }}
IMAGE_NAME: grafana/grafana
with:
entrypoint: /bin/sh
args: |
-c "
# Nettoyer les retours à la ligne et les caractères spéciaux
#cat <<EOF > /tmp/kubeconfig.yaml
#$KUBECONFIG_DATA
#EOF
cp kubeconfig.yaml > /tmp/kubeconfig.yaml &&
#echo "$KUBECONFIG_DATA" > /tmp/kubeconfig.yaml &&
export KUBECONFIG=/tmp/kubeconfig.yaml &&
kubectl config view --raw &&
cat /tmp/kubeconfig.yaml &&
kubectl get pods &&
kubectl set image deployment/grafana grafana=${IMAGE_NAME}:${GITHUB_REF_NAME} &&
kubectl rollout status deployment/grafana
"