Skip to content

Commit

Permalink
Merge pull request #10 from Pablommr/feature/broke-pipe-rollout
Browse files Browse the repository at this point in the history
Fix broken rollout
  • Loading branch information
Pablommr authored Nov 26, 2024
2 parents fa5597f + d73d292 commit 661b42d
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 4 deletions.
10 changes: 7 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
- name: Checkout
uses: actions/checkout@v4
- name: Deployment
uses: Pablommr/[email protected].0
uses: Pablommr/[email protected].1
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
Expand Down Expand Up @@ -94,7 +94,7 @@ Whether to watch the status of the latest rollout until it's done. The rollout o
### `KUBE_ROLLOUT_TIMEOUT`
(String)

Timeout to KUBE_ROLLOUT. This env must be in time format. (i.e.: 60s, 5m, 1h) and KUBE_ROLLOUT_TIMEOUT must be true. Defaul value is 20m.
Timeout to KUBE_ROLLOUT. This env must be in time format. (i.e.: 60s, 5m, 1h) and KUBE_ROLLOUT must be true. Defaul value is 20m.

<br>

Expand Down Expand Up @@ -149,7 +149,7 @@ jobs:
- name: Checkout
uses: actions/checkout@v4
- name: Deploy
uses: Pablommr/[email protected].0
uses: Pablommr/[email protected].1
env:
FILES_PATH: kubernetes
KUBE_YAML: kubernetes/envs/prod/configmap.yaml
Expand All @@ -165,6 +165,10 @@ In this setup, with FILES_PATH: kubernetes, you will apply all files under the k

# Change Log

## v2.1.1

- Add to broke pipeline in case of rollout failed

## v2.1.0

- Add KUBE_ROLLOUT_TIMEOUT option
Expand Down
14 changes: 13 additions & 1 deletion entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -244,9 +244,9 @@ applyFile () {
if [ $KUBE_EXIT_CODE -ne 0 ]; then
echo "Erro ao aplicar o arquivo: $file"
echo " | Failed :x: |" >> $GITHUB_STEP_SUMMARY
#Para a action caso o esteja setado CONTINUE_IF_FAIL=false
echo "KUBE_EXIT_CODE: $KUBE_EXIT_CODE"
echo "KUBECTL_OUTPUT: $KUBE_APPLY"
#Para a action caso o esteja setado CONTINUE_IF_FAIL=false
if ! $CONTINUE_IF_FAIL; then
exit 1
fi
Expand Down Expand Up @@ -318,6 +318,8 @@ IFS=',' read -r -a FT_KUBE_YAML <<< "$KUBE_YAML"
#Recebe os arquivos e os status dos rollouts
KUBE_ROLLOUT_JSON=()

#Recebe o status do rollout
KUBE_ROLLOUT_FAILED=false

#Valida se os paths existem
if [ ${#FT_FILES_PATH[@]} -gt 0 ]; then
Expand Down Expand Up @@ -468,11 +470,21 @@ if [ "$KUBE_ROLLOUT" == "true" ]; then
echo "| "Passed :white_check_mark:" |" >> $GITHUB_STEP_SUMMARY
else
echo "| Failed :x: |" >> $GITHUB_STEP_SUMMARY
KUBE_ROLLOUT_FAILED=true
#Para a action caso o esteja setado CONTINUE_IF_FAIL=false
if ! $CONTINUE_IF_FAIL; then
exit 1
fi
fi

done

fi

#Quebra a pipe caso algum rollout tenha falhado
if $KUBE_ROLLOUT_FAILED; then
exit 1
fi

echo ""
echo "All done! =D"

0 comments on commit 661b42d

Please sign in to comment.