register github action first run #3
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |