Skip to content

Commit ee0c7cc

Browse files
fix namespace 2
1 parent 445e154 commit ee0c7cc

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

.github/workflows/deploy-apps.yml

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,16 +44,19 @@ jobs:
4444
echo "${{ secrets.KUBE_CONFIG }}" > ~/.kube/config
4545
chmod 600 ~/.kube/config
4646
47-
- name: Apply K8s manifests
48-
run: kubectl apply -f infra/k8s/apps/${{ matrix.app }}-deployment.yaml
49-
50-
- name: Detect namespace
47+
- name: Detect namespace from manifest
5148
id: detect-namespace
5249
run: |
53-
namespace=$(kubectl get deployment ${{ matrix.app }} -A -o jsonpath='{.items[0].metadata.namespace}' 2>/dev/null || echo "default")
50+
namespace=$(grep -A 5 "kind: Deployment" infra/k8s/apps/${{ matrix.app }}-deployment.yaml | grep "namespace:" | head -1 | awk '{print $2}' || echo "default")
51+
if [ -z "$namespace" ]; then
52+
namespace="default"
53+
fi
5454
echo "namespace=$namespace" >> $GITHUB_OUTPUT
5555
echo "Detected namespace: $namespace"
5656
57+
- name: Apply K8s manifests
58+
run: kubectl apply -f infra/k8s/apps/${{ matrix.app }}-deployment.yaml
59+
5760
- name: Check if app has custom image
5861
id: check-image
5962
run: |

0 commit comments

Comments
 (0)