Skip to content

Commit bd3568d

Browse files
Copilotdthaler
andauthored
Add GitHub workflow to deploy InferenceSystem configmaps on push (#434)
* Initial plan * Add InferenceSystem-deploy-configmaps workflow Co-authored-by: dthaler <6547784+dthaler@users.noreply.github.com> * Restart inference-system deployment after applying configmap Co-authored-by: dthaler <6547784+dthaler@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: dthaler <6547784+dthaler@users.noreply.github.com>
1 parent 63eab78 commit bd3568d

1 file changed

Lines changed: 67 additions & 0 deletions

File tree

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

0 commit comments

Comments
 (0)