Adding post stage to gitlab pipeline to sync argo if helm/* was changed, also updating the test script to format your code

This commit is contained in:
Luke Robles 2022-02-08 10:57:01 -08:00
parent ae8bff8108
commit e57bee7199
3 changed files with 14 additions and 4 deletions

View File

@ -40,10 +40,16 @@ build_and_push_container:
- docker build -t ldooks/dragon-bot:$CI_PIPELINE_ID -t ldooks/dragon-bot:latest .
- docker push ldooks/dragon-bot:latest
- docker push ldooks/dragon-bot:$CI_PIPELINE_ID
- wget https://github.com/argoproj/argo-cd/releases/download/v2.2.5/argocd-linux-amd64 -O /tmp/argocd && chmod +x /tmp/argocd
- /tmp/argocd --insecure --server 192.168.1.205 --auth-token $ARGOCD_TOKEN app sync dragon-bot
#- docker run --rm daangn/argocd-cli sh -c "/usr/local/bin/argocd --insecure --server 192.168.1.205 --auth-token $ARGOCD_TOKEN app sync dragon-bot"
rules:
- changes:
- app/*
- Dockerfile
sync_argo:
stage: .post
script:
- wget https://github.com/argoproj/argo-cd/releases/download/v2.2.5/argocd-linux-amd64 -O /tmp/argocd && chmod +x /tmp/argocd
- /tmp/argocd --insecure --server 192.168.1.205 --auth-token $ARGOCD_TOKEN app sync dragon-bot
rules:
- changes:
- helm/*

View File

@ -1 +1 @@
docker run --rm -ti -v $(pwd):/tmp/python/app python bash -c "cd /tmp/python ; pip install black; black ."
docker run --rm -ti -v $(pwd):/tmp/python/app python:alpine sh -c "cd /tmp/python ; pip install black; black ."

View File

@ -1,4 +1,8 @@
# Remove the running container so we cna re-use the container name 'dragon-bot'
printf "\n[-] Formatting code\n"
./format_code.sh
printf "[+] Done\n"
printf "\n[-] Deleting old dragon-bot container from system\n"
docker rm -f dragon-bot-test
printf "[+] Done\n"