-
Notifications
You must be signed in to change notification settings - Fork 9
31 lines (26 loc) · 1.02 KB
/
mongo-reset.yaml
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
name: Reset Dev Mongo
on:
workflow_dispatch:
push:
jobs:
reset-mongo:
name: SSH and Reset Dev MongoDB State
runs-on: ubuntu-latest
steps:
- name: SSH and Reset MongoDB
uses: appleboy/[email protected]
with:
host: ${{ secrets.SSH_HOST }}
username: ${{ secrets.SSH_USERNAME }}
key: ${{ secrets.SSH_KEY }}
script: |
set -e # Exit immediately if a command fails
# Update reste-dev-mongo CronJob
kubectl apply -f infra/base/templates/mongo-reset.yaml
# Create Mongo job from mongo-reset
kubectl create job --from=cronjob/reset-dev-mongo reset-dev-mongo-manual
echo "MongoDB reset scheduled."
# Wait for job_pod log output
job_pod=$(kubectl get pods -o custom-columns=NAME:.metadata.name --no-headers -n bt | grep 'reset-dev-mongo-manual')
kubectl wait --for=condition=ready pod/$job_pod -n bt --timeout=30s
kubectl logs -f $job_pod -n bt