ci: deployment debugging
This commit is contained in:
parent
8ab94c0cb3
commit
81ee90f1bc
1 changed files with 32 additions and 6 deletions
|
|
@ -62,7 +62,7 @@ jobs:
|
||||||
run: |
|
run: |
|
||||||
COMMIT_HASH=$(echo ${GITHUB_SHA} | cut -c1-7)
|
COMMIT_HASH=$(echo ${GITHUB_SHA} | cut -c1-7)
|
||||||
VERSION_TAG="${COMMIT_HASH}"
|
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
|
- name: Set up kubectl
|
||||||
run: |
|
run: |
|
||||||
|
|
@ -73,6 +73,13 @@ jobs:
|
||||||
chmod +x kubectl
|
chmod +x kubectl
|
||||||
mv kubectl /usr/local/bin/
|
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
|
- name: Set up Helm
|
||||||
run: |
|
run: |
|
||||||
# Install Helm
|
# Install Helm
|
||||||
|
|
@ -83,11 +90,14 @@ jobs:
|
||||||
# Create kubeconfig using service account token
|
# Create kubeconfig using service account token
|
||||||
- name: Configure kubeconfig from service account
|
- name: Configure kubeconfig from service account
|
||||||
run: |
|
run: |
|
||||||
# Create kubeconfig using service account token
|
# Create a dedicated kubeconfig file for this job
|
||||||
mkdir -p $HOME/.kube
|
CONFIG_FILE="$HOME/custom-kubeconfig"
|
||||||
cat > $HOME/.kube/config <<EOF
|
|
||||||
|
# Create fresh config with explicit server URL
|
||||||
|
cat > $CONFIG_FILE <<EOF
|
||||||
apiVersion: v1
|
apiVersion: v1
|
||||||
kind: Config
|
kind: Config
|
||||||
|
preferences: {}
|
||||||
clusters:
|
clusters:
|
||||||
- name: cluster
|
- name: cluster
|
||||||
cluster:
|
cluster:
|
||||||
|
|
@ -105,11 +115,27 @@ jobs:
|
||||||
namespace: ${{ env.NAMESPACE }}
|
namespace: ${{ env.NAMESPACE }}
|
||||||
current-context: default
|
current-context: default
|
||||||
EOF
|
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
|
- name: Deploy with Helm
|
||||||
run: |
|
run: |
|
||||||
# Deploy using Helm with service account authentication
|
# 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 }} \
|
helm upgrade --install nextjs-slack-clone ${{ env.HELM_CHART_PATH }} \
|
||||||
--namespace ${{ env.NAMESPACE }} \
|
--namespace ${{ env.NAMESPACE }} \
|
||||||
--set image.tag=${{ steps.generate_tag.outputs.VERSION_TAG }} \
|
--set image.tag=${{ steps.generate_tag.outputs.VERSION_TAG }} \
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue