ci: deployment debugging
Some checks failed
/ build-and-push (push) Successful in 1m29s
/ deploy (push) Failing after 52s

This commit is contained in:
Mattias Wiberg 2025-06-09 22:04:05 +02:00
parent 8ab94c0cb3
commit 81ee90f1bc

View file

@ -62,7 +62,7 @@ jobs:
run: |
COMMIT_HASH=$(echo ${GITHUB_SHA} | cut -c1-7)
VERSION_TAG="${COMMIT_HASH}"
echo "VERSION_TAG=$VERSION_TAG" >> $GITHUB_OUTPUT
echo "VERSION_TAG=$VERSION_TAG" >> $GITHUB_OUTPUT - name: Set up kubectl
- name: Set up kubectl
run: |
@ -73,6 +73,13 @@ jobs:
chmod +x kubectl
mv kubectl /usr/local/bin/
# Make sure we don't use any existing microk8s config
if [ -f /var/snap/microk8s/current/credentials/client.config ]; then
echo "Detected microk8s config - we'll use our own config instead"
# Backup any existing config and make sure it won't be used
[ -d $HOME/.kube ] && mv $HOME/.kube $HOME/.kube.bak
fi
- name: Set up Helm
run: |
# Install Helm
@ -83,11 +90,14 @@ jobs:
# Create kubeconfig using service account token
- name: Configure kubeconfig from service account
run: |
# Create kubeconfig using service account token
mkdir -p $HOME/.kube
cat > $HOME/.kube/config <<EOF
# Create a dedicated kubeconfig file for this job
CONFIG_FILE="$HOME/custom-kubeconfig"
# Create fresh config with explicit server URL
cat > $CONFIG_FILE <<EOF
apiVersion: v1
kind: Config
preferences: {}
clusters:
- name: cluster
cluster:
@ -105,11 +115,27 @@ jobs:
namespace: ${{ env.NAMESPACE }}
current-context: default
EOF
chmod 600 $HOME/.kube/config
chmod 600 $CONFIG_FILE
# Set KUBECONFIG environment variable to use our config
echo "KUBECONFIG=$CONFIG_FILE" >> $GITHUB_ENV
# Verify the config is pointing to the correct server
echo "Checking kubectl configuration..."
KUBECTL_SERVER=$(KUBECONFIG=$CONFIG_FILE kubectl config view --minify -o jsonpath='{.clusters[0].cluster.server}')
echo "Kubectl is configured to use server: $KUBECTL_SERVER"
- name: Verify Kubernetes connectivity
run: |
# Test connectivity to the Kubernetes cluster
echo "Testing Kubernetes API connectivity..."
kubectl cluster-info
kubectl get nodes
- name: Deploy with Helm
run: |
# Deploy using Helm with service account authentication
echo "Deploying with Helm to server: $(kubectl config view --minify -o jsonpath='{.clusters[0].cluster.server}')"
helm upgrade --install nextjs-slack-clone ${{ env.HELM_CHART_PATH }} \
--namespace ${{ env.NAMESPACE }} \
--set image.tag=${{ steps.generate_tag.outputs.VERSION_TAG }} \