-
Notifications
You must be signed in to change notification settings - Fork 30
Expand file tree
/
Copy pathInferenceSystem-deploy-configmaps.yaml
More file actions
68 lines (59 loc) · 2.39 KB
/
Copy pathInferenceSystem-deploy-configmaps.yaml
File metadata and controls
68 lines (59 loc) · 2.39 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
---
name: InferenceSystem-deploy-configmaps
on:
push:
branches:
- main
paths:
- 'InferenceSystem/deploy/*-configmap.yaml'
workflow_dispatch: # Allow manual workflow invocation from the Github Actions UI
concurrency:
# Cancel any CI/CD workflow currently in progress for the same PR.
# Allow running concurrently with any other commits.
group: InferenceSystem-deploy-configmaps-${{ github.event.pull_request.number || github.sha }}
cancel-in-progress: true
permissions: # added using https://github.com/step-security/secure-repo
contents: read
jobs:
deploy-configmaps:
runs-on: ubuntu-latest
steps:
- uses: step-security/harden-runner@9af89fc71515a100421586dfdb3dc9c984fbf411 # v2.19.4
with:
egress-policy: audit
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
fetch-depth: 2
- name: Set up kubectl
uses: azure/setup-kubectl@829323503d1be3d00ca8346e5391ca0b07a9ab0d # v5.1.0
- name: Set Kubernetes context
uses: azure/k8s-set-context@89b837d75b40a7bd2ddafde837473c212db8b313 # v5.0.0
with:
method: kubeconfig
kubeconfig: ${{ secrets.KUBE_CONFIG }}
- name: Get configmap files to apply
id: changed-files
run: |
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
# For manual triggers, apply all configmap files
CHANGED=$(ls InferenceSystem/deploy/*-configmap.yaml 2>/dev/null || true)
else
CHANGED=$(git diff --name-only HEAD~1 HEAD -- 'InferenceSystem/deploy/*-configmap.yaml')
fi
echo "files=$CHANGED" >> $GITHUB_OUTPUT
- name: Apply configmaps and restart deployments
run: |
CHANGED="${{ steps.changed-files.outputs.files }}"
if [ -z "$CHANGED" ]; then
echo "No configmap files to apply."
exit 0
fi
for FILE in $CHANGED; do
echo "Applying $FILE"
kubectl apply -f "$FILE"
# Derive namespace from filename, e.g. InferenceSystem/deploy/bush-point-configmap.yaml -> bush-point
NAMESPACE=$(basename "$FILE" -configmap.yaml)
echo "Restarting deployment/inference-system in namespace $NAMESPACE"
kubectl rollout restart deployment/inference-system -n "$NAMESPACE"
done