ci: sesuaikan pipeline deploy sidata-prod
CI/CD Pipeline to Rancher - SIDATA / build-and-deploy (push) Failing after 2m3s

This commit is contained in:
2026-09-06 12:22:43 +07:00
parent 674941939c
commit 018ec9a694
+60 -14
View File
@@ -8,11 +8,12 @@ on:
jobs: jobs:
build-and-deploy: build-and-deploy:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Checkout Code - name: Checkout Code
uses: actions/checkout@v3 uses: actions/checkout@v3
# Login ke Registry Gitea Lokal # Login ke Gitea Container Registry
- name: Log in to Gitea Container Registry - name: Log in to Gitea Container Registry
uses: docker/login-action@v2 uses: docker/login-action@v2
with: with:
@@ -20,7 +21,7 @@ jobs:
username: ${{ secrets.REGISTRY_USER }} username: ${{ secrets.REGISTRY_USER }}
password: ${{ secrets.REGISTRY_PASSWORD }} password: ${{ secrets.REGISTRY_PASSWORD }}
# Build & Push Image Aplikasi SIDATA ke Registry # Build & Push Image SIDATA ke Gitea Registry
- name: Build and Push Docker Image - name: Build and Push Docker Image
uses: docker/build-push-action@v4 uses: docker/build-push-action@v4
with: with:
@@ -30,22 +31,67 @@ jobs:
10.15.39.187:3000/${{ secrets.REGISTRY_USER }}/sidata:latest 10.15.39.187:3000/${{ secrets.REGISTRY_USER }}/sidata:latest
10.15.39.187:3000/${{ secrets.REGISTRY_USER }}/sidata:${{ gitea.sha }} 10.15.39.187:3000/${{ secrets.REGISTRY_USER }}/sidata:${{ gitea.sha }}
# Deploy & Update Workload di Cluster Local Rancher BPKD # Deploy ke Rancher
- name: Deploy to Rancher Cluster - name: Deploy to Rancher Cluster
shell: bash
run: | run: |
# Download binary kubectl set -e
curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl"
echo "=== Download kubectl ==="
KUBECTL_VERSION=$(curl -L -s https://dl.k8s.io/release/stable.txt)
curl -fLO \
"https://dl.k8s.io/release/${KUBECTL_VERSION}/bin/linux/amd64/kubectl"
chmod +x kubectl chmod +x kubectl
# Set Kubeconfig menggunakan API Rancher BPKD echo "kubectl version:"
./kubectl config set-cluster rancher-cluster --server=${{ secrets.RANCHER_URL }}/k8s/clusters/${{ secrets.RANCHER_CLUSTER_ID }} --insecure-skip-tls-verify=true ./kubectl version --client
./kubectl config set-credentials rancher-user --token=${{ secrets.RANCHER_TOKEN }}
./kubectl config set-context rancher-context --cluster=rancher-cluster --user=rancher-user echo "=== Configure Rancher Kubeconfig ==="
./kubectl config set-cluster rancher-cluster \
--server="${{ secrets.RANCHER_URL }}/k8s/clusters/${{ secrets.RANCHER_CLUSTER_ID }}" \
--insecure-skip-tls-verify=true
./kubectl config set-credentials rancher-user \
--token="${{ secrets.RANCHER_TOKEN }}"
./kubectl config set-context rancher-context \
--cluster=rancher-cluster \
--user=rancher-user
./kubectl config use-context rancher-context ./kubectl config use-context rancher-context
# Update Container Image untuk Workload sidata echo "=== Check Cluster ==="
# Sesuaikan 'sidata-deployment', 'sidata-container', dan namespace jika berbeda di Rancher
./kubectl set image deployment/sidata-deployment sidata-container=10.15.39.187:3000/${{ secrets.REGISTRY_USER }}/sidata:${{ gitea.sha }} -n sidataprod
# Pantau Status Rollout hingga Sukses ./kubectl cluster-info
./kubectl rollout status deployment/sidata-deployment -n sidataprod
echo "=== Check SIDATA Deployment ==="
./kubectl get deployment -n sidata-prod
echo "=== Update SIDATA Image ==="
IMAGE="10.15.39.187:3000/${{ secrets.REGISTRY_USER }}/sidata:${{ gitea.sha }}"
echo "Deploy image: ${IMAGE}"
./kubectl set image \
deployment/sidata \
sidata="${IMAGE}" \
-n sidata-prod
echo "=== Wait Rollout ==="
./kubectl rollout status \
deployment/sidata \
-n sidata-prod \
--timeout=10m
echo "=== Deployment Status ==="
./kubectl get deployment sidata -n sidata-prod
./kubectl get pods -n sidata-prod -l app=sidata