Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: shellcheck style error #80

Merged
merged 1 commit into from
Mar 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/docker-push-v2.yml
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ jobs:
id: set_ssh
if: ${{ inputs.use_ssh }}
run: |
echo "ssh=main=$SSH_AUTH_SOCK" >> ${GITHUB_OUTPUT}
echo "ssh=main=$SSH_AUTH_SOCK" >> "${GITHUB_OUTPUT}"

- name: Build and push (with cache)
if: ${{ inputs.cache_docker_layers }}
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/ecs-deploy-v2.yml
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,9 @@ jobs:
- name: Get current version
id: current_version
run: |
CURRENT_TASK_DEFINITION=$(aws ecs list-task-definitions | jq --arg SERVICE "$SERVICE" --arg ENVIRONMENT "$ENV" -r -c '.taskDefinitionArns[] | select(contains($SERVICE + "-" + $ENVIRONMENT))')
CURRENT_IMAGE_TAG=$(aws ecs describe-task-definition --task-definition $CURRENT_TASK_DEFINITION | jq --arg SERVICE "$SERVICE" -r -c '.taskDefinition.containerDefinitions[] | select(.name == $SERVICE) | .image' | cut -d':' -f2)
echo "image_tag=$CURRENT_IMAGE_TAG" >> $GITHUB_OUTPUT
CURRENT_TASK_DEFINITION="$(aws ecs list-task-definitions | jq --arg SERVICE "$SERVICE" --arg ENVIRONMENT "$ENV" -r -c '.taskDefinitionArns[] | select(contains($SERVICE + "-" + $ENVIRONMENT))')"
CURRENT_IMAGE_TAG="$(aws ecs describe-task-definition --task-definition "$CURRENT_TASK_DEFINITION" | jq --arg SERVICE "$SERVICE" -r -c '.taskDefinition.containerDefinitions[] | select(.name == $SERVICE) | .image' | cut -d':' -f2)"
echo "image_tag=$CURRENT_IMAGE_TAG" >> "$GITHUB_OUTPUT"

- name: Notify deployment in progress
uses: sencrop/github-workflows/actions/notify-deployment-in-progress@master
Expand All @@ -108,12 +108,12 @@ jobs:
slack_bot_token: ${{ secrets.SLACK_BOT_TOKEN }}

- name: Terraform apply
run: terraform apply -var "docker_image_tag=${DOCKER_IMAGE_TAG}" -var-file=${ENV}.tfvars -auto-approve -input=false ${EXTRA_ARGS}
run: terraform apply -var "docker_image_tag=${DOCKER_IMAGE_TAG}" -var-file="${ENV}.tfvars" -auto-approve -input=false "${EXTRA_ARGS}"

- name: Wait for stabilization
if: ${{ inputs.wait_for_stabilization }}
run: |
if !(aws ecs wait services-stable --cluster "main-${ENV}" --service "${SERVICE}"); then
if ! (aws ecs wait services-stable --cluster "main-${ENV}" --service "${SERVICE}"); then
echo "/!\/!\/!\ The deployment has failed to stabilize after 10 minutes !"
echo "It likely means that this new version is crashing on start up."
echo "You should check the logs to understand what happened: ${LOGS_URL}"
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/terraform-apply-v2.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,4 +71,4 @@ jobs:
run: terraform validate

- name: Terraform apply
run: terraform apply -var-file=${ENV}.tfvars -auto-approve -input=false ${EXTRA_ARGS}
run: terraform apply -var-file="${ENV}.tfvars" -auto-approve -input=false "${EXTRA_ARGS}"
15 changes: 7 additions & 8 deletions .github/workflows/terraform-plan-ecs-v2.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,8 @@ jobs:
# and will likely ignore it the day it really matters
- name: Get current image tag
run: |
REF=$(aws ecs describe-task-definition --task-definition "${SERVICE}-${ENV}" --output json | jq -r '.taskDefinition.containerDefinitions[] | select(.name == "'${SERVICE}'") | .image | split(":")[1]')
echo ${REF}
echo "REF=$REF" >> ${GITHUB_ENV}
REF="$(aws ecs describe-task-definition --task-definition "${SERVICE}-${ENV}" --output json | jq --arg SERVICE "$SERVICE" -r '.taskDefinition.containerDefinitions[] | select(.name == $SERVICE) | .image | split(":")[1]')"
echo "REF=$REF" >> "${GITHUB_ENV}"

- name: Terraform setup
uses: sencrop/github-workflows/actions/setup-terraform@master
Expand All @@ -94,7 +93,7 @@ jobs:
# inspired by https://blog.testdouble.com/posts/2021-12-07-elevate-your-terraform-workflow-with-github-actions/
- name: Terraform plan
id: plan
run: terraform plan -var docker_image_tag=${REF} -var-file=${ENV}.tfvars -input=false -no-color -out=tfplan ${EXTRA_ARGS}
run: terraform plan -var docker_image_tag="${REF}" -var-file="${ENV}.tfvars" -input=false -no-color -out=tfplan "${EXTRA_ARGS}"

# 1. remove everything before the plan output
# 2. remove github actions output
Expand All @@ -115,10 +114,10 @@ jobs:
- name: Put Plan in Env Var
run: |
sed 's|`|\\\`|g' plan.txt > safe_plan.txt
PLAN=$(cat safe_plan.txt)
echo "PLAN<<EOF" >> $GITHUB_ENV
echo "$PLAN" >> $GITHUB_ENV
echo "EOF" >> $GITHUB_ENV
PLAN="$(cat safe_plan.txt)"
echo "PLAN<<EOF" >> "$GITHUB_ENV"
echo "$PLAN" >> "$GITHUB_ENV"
echo "EOF" >> "$GITHUB_ENV"

- uses: actions/github-script@v6
if: github.event_name == 'pull_request'
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/terraform-plan-v2.yml
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ jobs:
# inspired by https://blog.testdouble.com/posts/2021-12-07-elevate-your-terraform-workflow-with-github-actions/
- name: Terraform plan
id: plan
run: terraform plan -var-file=${ENV}.tfvars -input=false -no-color -out=tfplan ${EXTRA_ARGS}
run: terraform plan -var-file="${ENV}.tfvars" -input=false -no-color -out=tfplan "${EXTRA_ARGS}"

# 1. remove everything before the plan output
# 2. remove github actions output
Expand All @@ -100,10 +100,10 @@ jobs:
- name: Put Plan in Env Var
run: |
sed 's|`|\\\`|g' plan.txt > safe_plan.txt
PLAN=$(cat safe_plan.txt)
echo "PLAN<<EOF" >> $GITHUB_ENV
echo "$PLAN" >> $GITHUB_ENV
echo "EOF" >> $GITHUB_ENV
PLAN="$(cat safe_plan.txt)"
echo "PLAN<<EOF" >> "$GITHUB_ENV"
echo "$PLAN" >> "$GITHUB_ENV"
echo "EOF" >> "$GITHUB_ENV"

- uses: actions/github-script@v6
if: github.event_name == 'pull_request'
Expand Down
16 changes: 8 additions & 8 deletions .github/workflows/version-v2.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,16 +30,16 @@ jobs:
if: "! inputs.use_tags"
id: git_hash
run: |
REF=$(git rev-parse --short HEAD)
PREVIOUS_REF=$(git rev-parse --short HEAD~1)
echo "REF=$REF" >> ${GITHUB_OUTPUT}
echo "PREVIOUS_REF=$PREVIOUS_REF" >> ${GITHUB_OUTPUT}
REF="$(git rev-parse --short HEAD)"
PREVIOUS_REF="$(git rev-parse --short HEAD~1)"
echo "REF=$REF" >> "${GITHUB_OUTPUT}"
echo "PREVIOUS_REF=$PREVIOUS_REF" >> "${GITHUB_OUTPUT}"

- name: Get version from tags
if: inputs.use_tags
id: git_tags
run: |
REF=${GITHUB_REF#refs/tags/}
PREVIOUS_REF=$(git tag -l 'v*' --sort=-v:refname | head -n2 | tail -n1)
echo "REF=$REF" >> ${GITHUB_OUTPUT}
echo "PREVIOUS_REF=$PREVIOUS_REF" >> ${GITHUB_OUTPUT}
REF="${GITHUB_REF#refs/tags/}"
PREVIOUS_REF="$(git tag -l 'v*' --sort=-v:refname | head -n2 | tail -n1)"
echo "REF=$REF" >> "${GITHUB_OUTPUT}"
echo "PREVIOUS_REF=$PREVIOUS_REF" >> "${GITHUB_OUTPUT}"