Skip to content

Commit

Permalink
Add colors to yc-tf-ci action. (#244)
Browse files Browse the repository at this point in the history
  • Loading branch information
GureevLeonid authored Dec 13, 2023
1 parent 4d01ced commit e47b888
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 236 deletions.
231 changes: 0 additions & 231 deletions yc-terraform-ci-v2/action.yml

This file was deleted.

10 changes: 5 additions & 5 deletions yc-terraform-ci/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ runs:

- name: "Terraform Validate"
id: validate
run: terraform validate -no-color
run: terraform validate
working-directory: ${{ inputs.workingDir }}
shell: bash

Expand Down Expand Up @@ -163,7 +163,7 @@ runs:
id: plan
run: |
set +e
PLAN="terraform plan ${{ inputs.planAdditionalVars }} -no-color -out=plan.tfplan -detailed-exitcode"
PLAN="terraform plan ${{ inputs.planAdditionalVars }} -out=plan.tfplan -detailed-exitcode"
$PLAN
echo "planExitCode=$?" >> $GITHUB_OUTPUT
exit 0
Expand All @@ -185,7 +185,7 @@ runs:
id: show
run: |
if [[ ${{ steps.plan.outputs.planExitCode }} -ne 0 ]]; then
terraform show -no-color plan.tfplan
terraform show plan.tfplan
fi
working-directory: ${{ inputs.workingDir }}
shell: bash
Expand All @@ -194,7 +194,7 @@ runs:
id: kafkaCheck
run: |
if [[ ${{ steps.plan.outputs.planExitCode }} -ne 0 ]]; then
if test "$(terraform show -no-color plan.tfplan | grep -oP '# module\.kafka.*[broker|zookeeper]\[\K(".*")(?=\]\..*updated in\-place)' | sort -u | wc -l)" -gt 1; then
if test "$(terraform show plan.tfplan | grep -oP '# module\.kafka.*[broker|zookeeper]\[\K(".*")(?=\]\..*updated in\-place)' | sort -u | wc -l)" -gt 1; then
RED='\033[0;31m'
echo -e "${RED} You must update kafka brokers and zookeepers one by one only!"
exit 1
Expand All @@ -208,7 +208,7 @@ runs:
working-directory: ${{ inputs.workingDir }}
shell: bash
run: |
plan="$(terraform show -no-color plan.tfplan)"
plan="$(terraform show plan.tfplan)"
plan=$(echo "$plan" | sed -r 's/^([[:blank:]]*)([-+~])/\2\1/g')
plan=$(echo "$plan" | sed -r 's/^~/!/g')
original_length=${#plan}
Expand Down

0 comments on commit e47b888

Please sign in to comment.