fix: Simplify kubectl installation and update deployment messages in kub-deploy.yml
Build and Deploy to Kubernetes / build-and-deploy (push) Has been cancelled

This commit is contained in:
masoodafar-web
2026-01-29 02:36:21 +03:30
parent 839250e132
commit 0b0fa3aa61
+9 -17
View File
@@ -19,19 +19,14 @@ jobs:
- name: Install dependencies - name: Install dependencies
run: | run: |
apk add --no-cache git curl apk add --no-cache git curl
echo "✅ Dependencies installed (kubectl not needed for offline build)"
# Install kubectl with fixed version (no need to fetch stable.txt)
KUBECTL_VERSION="v1.31.0"
curl -LO "https://dl.k8s.io/release/${KUBECTL_VERSION}/bin/linux/amd64/kubectl"
chmod +x kubectl
mv kubectl /usr/local/bin/
- name: Start Docker daemon with insecure registry - name: Start Docker daemon with insecure registry
run: | run: |
mkdir -p /etc/docker mkdir -p /etc/docker
cat > /etc/docker/daemon.json << 'DAEMON' cat > /etc/docker/daemon.json << 'DAEMON'
{ {
"insecure-registries": ["194.5.195.53:30080", "194.5.195.53:32500", "gitea-svc:3000"], "insecure-registries": ["194.5.195.53:30080", "194.5.195.53:32500", "194.5.195.53:32082", "gitea-svc:3000"],
"dns": ["0.0.0.0"] "dns": ["0.0.0.0"]
} }
DAEMON DAEMON
@@ -71,14 +66,11 @@ jobs:
docker push ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ github.sha }} docker push ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ github.sha }}
docker push ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest docker push ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest
- name: Deploy to Kubernetes - name: Build and Push Complete
run: | run: |
# Setup kubeconfig echo "🎉 Build and push completed successfully!"
mkdir -p ~/.kube echo "📦 Image pushed to: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ github.sha }}"
echo "${{ secrets.KUBECONFIG }}" | base64 -d > ~/.kube/config echo "📦 Latest tag: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest"
echo ""
# Restart deployment to pull new image echo "🚀 To deploy manually on server:"
kubectl rollout restart deployment/cms || echo "Deployment doesn't exist yet" echo "kubectl set image deployment/cms cms=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ github.sha }}"
# Wait for rollout to complete
kubectl rollout status deployment/cms --timeout=5m || echo "Deployment rollout pending"