Skip to content

Commit

Permalink
feat: update scaffold-module and scaffold-working-dir to support …
Browse files Browse the repository at this point in the history
…scaffolding linters conditionally (#1111)

* feat: update scaffold-module and scaffold-working-dir to support scaffolding linters conditionally

* style: remove a newline

* fix: stringify TFACTION_SKIP_ADDING_AQUA_PACKAGES

* debug

* debug

* test

* fix: fix if condition

* test

* fix
  • Loading branch information
suzuki-shunsuke authored Sep 5, 2023
1 parent 6325f6e commit 28bfbbc
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 7 deletions.
2 changes: 1 addition & 1 deletion get-global-config/dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions get-global-config/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,7 @@ try {
} else {
core.setOutput('disable_update_related_pull_requests', 'false');
}
core.exportVariable('TFACTION_SKIP_ADDING_AQUA_PACKAGES', config.scaffold_working_directory && config.scaffold_working_directory.skip_adding_aqua_packages);

core.exportVariable('TFACTION_SKIP_ADDING_AQUA_PACKAGES', JSON.stringify(config.scaffold_working_directory && config.scaffold_working_directory.skip_adding_aqua_packages));

core.setOutput('enable_tfsec', config.tfsec == null || config.tfsec.enabled == null || config.tfsec.enabled);
core.setOutput('enable_tflint', config.tflint == null || config.tflint.enabled == null || config.tflint.enabled);
Expand Down
20 changes: 19 additions & 1 deletion scaffold-module/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,27 @@ runs:
- run: aqua init
shell: bash
working-directory: ${{inputs.module_path}}
- run: aqua g -i aquasecurity/tfsec terraform-linters/tflint hashicorp/terraform
if: env.TFACTION_SKIP_ADDING_AQUA_PACKAGES != 'true'

- run: aqua g -i hashicorp/terraform
shell: bash
working-directory: ${{inputs.module_path}}
if: env.TFACTION_SKIP_ADDING_AQUA_PACKAGES != 'true'

- run: aqua g -i aquasecurity/tfsec
shell: bash
working-directory: ${{inputs.module_path}}
if: env.TFACTION_SKIP_ADDING_AQUA_PACKAGES != 'true' && fromJSON(steps.global-config.outputs.enable_tfsec)

- run: aqua g -i aquasecurity/trivy
shell: bash
working-directory: ${{inputs.module_path}}
if: env.TFACTION_SKIP_ADDING_AQUA_PACKAGES != 'true' && fromJSON(steps.global-config.outputs.enable_trivy)

- run: aqua g -i terraform-linters/tflint
shell: bash
working-directory: ${{inputs.module_path}}
if: env.TFACTION_SKIP_ADDING_AQUA_PACKAGES != 'true' && fromJSON(steps.global-config.outputs.enable_tflint)

- run: aqua i -l -a
shell: bash
Expand Down
22 changes: 19 additions & 3 deletions scaffold-working-dir/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,27 @@ runs:
- run: aqua init
shell: bash
working-directory: ${{steps.target-config.outputs.working_directory}}
if: env.TFACTION_SKIP_ADDING_AQUA_PACKAGES == '' || !fromJSON(env.TFACTION_SKIP_ADDING_AQUA_PACKAGES)
- run: aqua g -i open-policy-agent/conftest terraform-linters/tflint aquasecurity/tfsec hashicorp/terraform
if: env.TFACTION_SKIP_ADDING_AQUA_PACKAGES != 'true'

- run: aqua g -i open-policy-agent/conftest hashicorp/terraform
shell: bash
working-directory: ${{steps.target-config.outputs.working_directory}}
if: env.TFACTION_SKIP_ADDING_AQUA_PACKAGES != 'true'

- run: aqua g -i terraform-linters/tflint
shell: bash
working-directory: ${{steps.target-config.outputs.working_directory}}
if: env.TFACTION_SKIP_ADDING_AQUA_PACKAGES != 'true' && fromJSON(steps.target-config.outputs.enable_tflint)

- run: aqua g -i aquasecurity/tfsec
shell: bash
working-directory: ${{steps.target-config.outputs.working_directory}}
if: env.TFACTION_SKIP_ADDING_AQUA_PACKAGES != 'true' && fromJSON(steps.target-config.outputs.enable_tfsec)

- run: aqua g -i aquasecurity/trivy
shell: bash
working-directory: ${{steps.target-config.outputs.working_directory}}
if: env.TFACTION_SKIP_ADDING_AQUA_PACKAGES == '' || !fromJSON(env.TFACTION_SKIP_ADDING_AQUA_PACKAGES)
if: env.TFACTION_SKIP_ADDING_AQUA_PACKAGES != 'true' && fromJSON(steps.target-config.outputs.enable_trivy)

- run: git add .
shell: bash
Expand Down

0 comments on commit 28bfbbc

Please sign in to comment.