-
-
Notifications
You must be signed in to change notification settings - Fork 581
chore(linters): Reorder linters, make hadolint ignores more specific #832
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
Changes from all commits
96af868
b45bb4e
142d793
5a022c9
0ae619e
37c3fc5
79e43ad
d9993be
b2d7cd1
edd0b91
bfae853
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -20,7 +20,7 @@ | |
| # | ||
| # Install required tools | ||
| # | ||
| ARG PRE_COMMIT_VERSION=${PRE_COMMIT_VERSION:-latest} | ||
|
Check warning on line 23 in Dockerfile
|
||
| RUN touch /.env && \ | ||
| if [ "$PRE_COMMIT_VERSION" = "false" ]; then \ | ||
| echo "Vital software can't be skipped" && exit 1; \ | ||
|
|
@@ -30,19 +30,19 @@ | |
| # | ||
| # Install tools | ||
| # | ||
| ARG OPENTOFU_VERSION=${OPENTOFU_VERSION:-false} | ||
|
Check warning on line 33 in Dockerfile
|
||
| ARG TERRAFORM_VERSION=${TERRAFORM_VERSION:-false} | ||
|
|
||
| ARG CHECKOV_VERSION=${CHECKOV_VERSION:-false} | ||
|
Check warning on line 36 in Dockerfile
|
||
| ARG HCLEDIT_VERSION=${HCLEDIT_VERSION:-false} | ||
| ARG INFRACOST_VERSION=${INFRACOST_VERSION:-false} | ||
|
Check warning on line 38 in Dockerfile
|
||
| ARG TERRAFORM_DOCS_VERSION=${TERRAFORM_DOCS_VERSION:-false} | ||
|
Check warning on line 39 in Dockerfile
|
||
| ARG TERRAGRUNT_VERSION=${TERRAGRUNT_VERSION:-false} | ||
|
Check warning on line 40 in Dockerfile
|
||
| ARG TERRASCAN_VERSION=${TERRASCAN_VERSION:-false} | ||
|
Check warning on line 41 in Dockerfile
|
||
| ARG TFLINT_VERSION=${TFLINT_VERSION:-false} | ||
| ARG TFSEC_VERSION=${TFSEC_VERSION:-false} | ||
| ARG TFUPDATE_VERSION=${TFUPDATE_VERSION:-false} | ||
|
Check warning on line 44 in Dockerfile
|
||
| ARG TRIVY_VERSION=${TRIVY_VERSION:-false} | ||
|
Check warning on line 45 in Dockerfile
|
||
|
|
||
|
|
||
| # Tricky thing to install all tools by set only one arg. | ||
|
|
@@ -65,6 +65,8 @@ | |
| echo "TRIVY_VERSION=latest" >> /.env \ | ||
| ; fi | ||
|
|
||
| # Docker `RUN`s shouldn't be consolidated here | ||
| # hadolint global ignore=DL3059 | ||
| RUN /install/opentofu.sh | ||
| RUN /install/terraform.sh | ||
|
|
||
|
|
@@ -81,12 +83,15 @@ | |
|
|
||
|
|
||
| # Checking binaries versions and write it to debug file | ||
|
|
||
| # SC2086 - We do not need to quote "$F" variable, because it's not contain spaces | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It doesn't hurt to wrap in double quotes though and the benefit would be to not skip this check is we, by any chance, will add any new var into this code block.
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If we add new vars here, it should be moved to separate .sh file, as it will become too complicated
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. But the skipping check may remain and will disable checking it =)
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's always a good idea to use the
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Despite the use of curly brackets is also encouraged by at least some shell linters I guess, I'd argue against it as curly brackets denote variable expansion syntax, which is pointless where no expansion is meant or expected. |
||
| # DL4006 - Not Applicable for /bin/sh in alpine images. Disable, as recommended by check itself | ||
| # hadolint ignore=SC2086,DL4006 | ||
| RUN . /.env && \ | ||
| F=tools_versions_info && \ | ||
| pre-commit --version >> $F && \ | ||
| (if [ "$OPENTOFU_VERSION" != "false" ]; then ./tofu --version | head -n 1 >> $F; else echo "opentofu SKIPPED" >> $F ; fi) && \ | ||
| (if [ "$TERRAFORM_VERSION" != "false" ]; then ./terraform --version | head -n 1 >> $F; else echo "terraform SKIPPED" >> $F ; fi) && \ | ||
|
|
||
| \ | ||
| (if [ "$CHECKOV_VERSION" != "false" ]; then echo "checkov $(checkov --version)" >> $F; else echo "checkov SKIPPED" >> $F ; fi) && \ | ||
| (if [ "$HCLEDIT_VERSION" != "false" ]; then echo "hcledit $(./hcledit version)" >> $F; else echo "hcledit SKIPPED" >> $F ; fi) && \ | ||
|
|
@@ -98,7 +103,7 @@ | |
| (if [ "$TFSEC_VERSION" != "false" ]; then echo "tfsec $(./tfsec --version)" >> $F; else echo "tfsec SKIPPED" >> $F ; fi) && \ | ||
| (if [ "$TFUPDATE_VERSION" != "false" ]; then echo "tfupdate $(./tfupdate --version)" >> $F; else echo "tfupdate SKIPPED" >> $F ; fi) && \ | ||
| (if [ "$TRIVY_VERSION" != "false" ]; then echo "trivy $(./trivy --version)" >> $F; else echo "trivy SKIPPED" >> $F ; fi) && \ | ||
| echo -e "\n\n" && cat $F && echo -e "\n\n" | ||
| printf "\n\n\n" && cat $F && printf "\n\n\n" | ||
|
|
||
|
|
||
|
|
||
|
|
@@ -143,9 +148,9 @@ | |
|
|
||
| COPY tools/entrypoint.sh /entrypoint.sh | ||
|
|
||
| ENV PRE_COMMIT_COLOR=${PRE_COMMIT_COLOR:-always} | ||
|
Check warning on line 151 in Dockerfile
|
||
|
|
||
| ENV INFRACOST_API_KEY=${INFRACOST_API_KEY:-} | ||
|
Check warning on line 153 in Dockerfile
|
||
| ENV INFRACOST_SKIP_UPDATE_CHECK=${INFRACOST_SKIP_UPDATE_CHECK:-false} | ||
|
Check warning on line 154 in Dockerfile
|
||
|
|
||
| ENTRYPOINT [ "/entrypoint.sh" ] | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,11 +1,9 @@ | ||
| # We use `latest` tag for tests proposes | ||
|
MaxymVlasov marked this conversation as resolved.
|
||
| # hadolint ignore=DL3007 | ||
| FROM pre-commit-terraform:latest | ||
|
|
||
| RUN apt update && \ | ||
| apt install -y \ | ||
| datamash \ | ||
| time && \ | ||
| # Cleanup | ||
| rm -rf /var/lib/apt/lists/* | ||
|
MaxymVlasov marked this conversation as resolved.
|
||
| RUN apk add --no-cache \ | ||
| datamash=~1.8 | ||
|
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I found that we changed base image to alpine a long time ago :) |
||
|
|
||
| WORKDIR /pct | ||
| ENTRYPOINT [ "/pct/tests/hooks_performance_test.sh" ] | ||
Uh oh!
There was an error while loading. Please reload this page.