Skip to content

Commit

Permalink
Use yq as part of atmos mock.
Browse files Browse the repository at this point in the history
  • Loading branch information
korenyoni committed Aug 20, 2024
1 parent db25b69 commit a5d32d6
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 36 deletions.
7 changes: 6 additions & 1 deletion .github/workflows/test-matrix-2-levels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,16 @@ jobs:
mkdir -p ${{ runner.temp }}
cp ./tests/atmos.yaml ${{ runner.temp }}/atmos.yaml
sed -i -e 's#__PLAN_ROLE__#${{ secrets.TERRAFORM_PLAN_ROLE }}#g' ${{ runner.temp }}/atmos.yaml
sed -i -e 's#__PLAN_ROLE__#${{ secrets.TERRAFORM_PLAN_ROLE }}#g' ./tests/fixtures/atmos
- name: add mock atmos to the path
run: echo "./tests/fixtures" >> $GITHUB_PATH

- uses: cloudposse-github-actions/install-gh-releases@v1
with:
cache: true
config: |-
mikefarah/yq:v4.44.3
- uses: ./
id: current
with:
Expand Down
7 changes: 6 additions & 1 deletion .github/workflows/test-matrix-3-levels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,16 @@ jobs:
mkdir -p ${{ runner.temp }}
cp ./tests/atmos.yaml ${{ runner.temp }}/atmos.yaml
sed -i -e 's#__PLAN_ROLE__#${{ secrets.TERRAFORM_PLAN_ROLE }}#g' ${{ runner.temp }}/atmos.yaml
sed -i -e 's#__PLAN_ROLE__#${{ secrets.TERRAFORM_PLAN_ROLE }}#g' ./tests/fixtures/atmos
- name: add mock atmos to the path
run: echo "./tests/fixtures" >> $GITHUB_PATH

- uses: cloudposse-github-actions/install-gh-releases@v1
with:
cache: true
config: |-
mikefarah/yq:v4.44.3
- uses: ./
id: current
with:
Expand Down
7 changes: 6 additions & 1 deletion .github/workflows/test-no-changes.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,12 @@ jobs:
mkdir -p ${{ runner.temp }}
cp ./tests/atmos.yaml ${{ runner.temp }}/atmos.yaml
sed -i -e 's#__PLAN_ROLE__#${{ secrets.TERRAFORM_PLAN_ROLE }}#g' ${{ runner.temp }}/atmos.yaml
sed -i -e 's#__PLAN_ROLE__#${{ secrets.TERRAFORM_PLAN_ROLE }}#g' ./tests/fixtures/atmos
- uses: cloudposse-github-actions/install-gh-releases@v1
with:
cache: true
config: |-
mikefarah/yq:v4.44.3
- uses: ./
id: current
Expand Down
7 changes: 6 additions & 1 deletion .github/workflows/test-positive.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,16 @@ jobs:
mkdir -p ${{ runner.temp }}
cp ./tests/atmos.yaml ${{ runner.temp }}/atmos.yaml
sed -i -e 's#__PLAN_ROLE__#${{ secrets.TERRAFORM_PLAN_ROLE }}#g' ${{ runner.temp }}/atmos.yaml
sed -i -e 's#__PLAN_ROLE__#${{ secrets.TERRAFORM_PLAN_ROLE }}#g' ./tests/fixtures/atmos
- name: add mock atmos to the path
run: echo "./tests/fixtures" >> $GITHUB_PATH

- uses: cloudposse-github-actions/install-gh-releases@v1
with:
cache: true
config: |-
mikefarah/yq:v4.44.3
- uses: ./
id: current
with:
Expand Down
33 changes: 1 addition & 32 deletions tests/fixtures/atmos
Original file line number Diff line number Diff line change
@@ -1,35 +1,4 @@
#!/bin/bash

cat "${GITHUB_ACTION_PATH}/tests/fixtures/mock-atmos-describe-affected.json" > affected-stacks.json

cat << EOF
{
"integrations": {
"atlantis": {
},
"github": {
"gitops": {
"infracost-enabled": false,
"matrix": {
"group-by": ".stack_slug | split(\"-\") | [.[0], .[2]] | join(\"-\")",
"sort-by": ".stack_slug"
},
"role": {
"apply": "arn:aws:iam::yyyyyyyyyyyy:role/cptest-core-gbl-identity-gitops",
"plan": "arn:aws:iam::yyyyyyyyyyyy:role/cptest-core-gbl-identity-gitops"
},
"artifact-storage": {
"bucket": "cptest-core-ue2-auto-gitops",
"region": "us-east-2",
"role": "__PLAN_ROLE__",
"table": "cptest-core-ue2-auto-gitops-plan-storage"
},
"terraform-version": "1.5.2"
}
}
}
}
EOF
cat ${ATMOS_CLI_CONFIG_PATH}/atmos.yaml | yq e --tojson '.' -

0 comments on commit a5d32d6

Please sign in to comment.