Skip to content

Commit 0340c8d

Browse files
fix(docker): Prevent all possible "silent errors" during docker build (antonbabenko#644)
--------- Co-authored-by: George L. Yermulnik <yz@yz.kiev.ua>
1 parent ff2f0ca commit 0340c8d

34 files changed

+409
-192
lines changed

.dockerignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@
22
!.dockerignore
33
!Dockerfile
44
!tools/entrypoint.sh
5+
!tools/install/*.sh

.github/.container-structure-test-config.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ commandTests:
1313
- name: "terraform"
1414
command: "terraform"
1515
args: ["-version"]
16-
expectedOutput: ["^Terraform v([0-9]+\\.){2}[0-9]+\\non linux_amd64\\n$"]
16+
expectedOutput: ["^Terraform v([0-9]+\\.){2}[0-9]+\\n"]
1717

1818
- name: "gcc"
1919
command: "gcc"
@@ -28,12 +28,12 @@ commandTests:
2828
- name: "infracost"
2929
command: "infracost"
3030
args: ["--version"]
31-
expectedOutput: ["^Infracost v([0-9]+\\.){2}[0-9]+\\n$"]
31+
expectedOutput: ["^Infracost v([0-9]+\\.){2}[0-9]+"]
3232

3333
- name: "terraform-docs"
3434
command: "terraform-docs"
3535
args: ["--version"]
36-
expectedOutput: ["^terraform-docs version v([0-9]+\\.){2}[0-9]+ [a-z0-9]+ linux/amd64\\n$"]
36+
expectedOutput: ["^terraform-docs version v([0-9]+\\.){2}[0-9]+ [a-z0-9]+"]
3737

3838
- name: "terragrunt"
3939
command: "terragrunt"

.github/CONTRIBUTING.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,9 @@ You can use [this PR](https://github.com/antonbabenko/pre-commit-terraform/pull/
113113

114114
### Add code
115115

116+
> [!TIP]
117+
> Here is a screencast of [how to add new dependency in `tools/install/`](https://github.com/antonbabenko/pre-commit-terraform/assets/11096782/8fc461e9-f163-4592-9497-4a18fa89c0e8) - used in Dockerfile
118+
116119
1. Based on prev. block, add hook dependencies installation to [Dockerfile](../Dockerfile).
117120
Check that works:
118121
* `docker build -t pre-commit --build-arg INSTALL_ALL=true .`

.github/workflows/build-image-test.yaml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,13 @@ jobs:
2727
.dockerignore
2828
tools/entrypoint.sh
2929
.github/workflows/build-image-test.yaml
30+
tools/*.sh
31+
32+
- name: Set up QEMU
33+
if: matrix.os != 'ubuntu-latest' || matrix.arch != 'amd64'
34+
uses: docker/setup-qemu-action@v2
35+
with:
36+
platforms: 'arm64'
3037

3138
- name: Set up Docker Buildx
3239
uses: docker/setup-buildx-action@f95db51fddba0c2d1ec667646a06c2ce06100226 # v3.0.0
@@ -38,7 +45,7 @@ jobs:
3845
context: .
3946
build-args: |
4047
INSTALL_ALL=true
41-
platforms: linux/amd64 # Only one allowed here, see https://github.com/docker/buildx/issues/59#issuecomment-1433097926
48+
platforms: linux/${{ matrix.arch }} # Only one allowed here, see https://github.com/docker/buildx/issues/59#issuecomment-1433097926
4249
push: false
4350
load: true
4451
tags: |

.pre-commit-config.yaml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,13 +42,14 @@ repos:
4242
hooks:
4343
- id: hadolint
4444
args: [
45-
'--ignore', 'DL3027', # Do not use apt
4645
'--ignore', 'DL3007', # Using latest
46+
'--ignore', 'DL3013', # Pin versions in pip
47+
'--ignore', 'DL3027', # Do not use apt
48+
'--ignore', 'DL3059', # Docker `RUN`s shouldn't be consolidated here
4749
'--ignore', 'DL4006', # Not related to alpine
4850
'--ignore', 'SC1091', # Useless check
4951
'--ignore', 'SC2015', # Useless check
5052
'--ignore', 'SC3037', # Not related to alpine
51-
'--ignore', 'DL3013', # Pin versions in pip
5253
]
5354

5455
# JSON5 Linter

Dockerfile

Lines changed: 36 additions & 156 deletions
Original file line numberDiff line numberDiff line change
@@ -7,209 +7,89 @@ WORKDIR /bin_dir
77

88
RUN apk add --no-cache \
99
# Builder deps
10+
bash=~5 \
1011
curl=~8 && \
1112
# Upgrade packages for be able get latest Checkov
1213
python3 -m pip install --no-cache-dir --upgrade \
1314
pip \
1415
setuptools
1516

17+
COPY tools/install/ /install/
18+
19+
#
20+
# Install required tools
21+
#
1622
ARG PRE_COMMIT_VERSION=${PRE_COMMIT_VERSION:-latest}
1723
ARG TERRAFORM_VERSION=${TERRAFORM_VERSION:-latest}
1824

19-
# Install pre-commit
20-
RUN if [ ${PRE_COMMIT_VERSION} = "latest" ]; \
21-
then pip3 install --no-cache-dir pre-commit; \
22-
else pip3 install --no-cache-dir pre-commit==${PRE_COMMIT_VERSION}; \
25+
RUN touch /.env && \
26+
if [ "$PRE_COMMIT_VERSION" = "false" ] || [ "$TERRAFORM_VERSION" = "false" ]; then \
27+
echo "Vital software can't be skipped" && exit 1; \
2328
fi
2429

25-
# Install terraform because pre-commit needs it
26-
RUN if [ "${TERRAFORM_VERSION}" = "latest" ]; then \
27-
TERRAFORM_VERSION="$(curl -s https://api.github.com/repos/hashicorp/terraform/releases/latest | grep tag_name | grep -o -E -m 1 "[0-9.]+")" \
28-
; fi && \
29-
curl -L "https://releases.hashicorp.com/terraform/${TERRAFORM_VERSION}/terraform_${TERRAFORM_VERSION}_${TARGETOS}_${TARGETARCH}.zip" > terraform.zip && \
30-
unzip terraform.zip terraform && rm terraform.zip
30+
31+
RUN /install/pre-commit.sh
32+
RUN /install/terraform.sh
3133

3234
#
3335
# Install tools
3436
#
3537
ARG CHECKOV_VERSION=${CHECKOV_VERSION:-false}
38+
ARG HCLEDIT_VERSION=${HCLEDIT_VERSION:-false}
3639
ARG INFRACOST_VERSION=${INFRACOST_VERSION:-false}
3740
ARG TERRAFORM_DOCS_VERSION=${TERRAFORM_DOCS_VERSION:-false}
3841
ARG TERRAGRUNT_VERSION=${TERRAGRUNT_VERSION:-false}
3942
ARG TERRASCAN_VERSION=${TERRASCAN_VERSION:-false}
4043
ARG TFLINT_VERSION=${TFLINT_VERSION:-false}
4144
ARG TFSEC_VERSION=${TFSEC_VERSION:-false}
42-
ARG TRIVY_VERSION=${TRIVY_VERSION:-false}
4345
ARG TFUPDATE_VERSION=${TFUPDATE_VERSION:-false}
44-
ARG HCLEDIT_VERSION=${HCLEDIT_VERSION:-false}
46+
ARG TRIVY_VERSION=${TRIVY_VERSION:-false}
4547

4648

4749
# Tricky thing to install all tools by set only one arg.
4850
# In RUN command below used `. /.env` <- this is sourcing vars that
4951
# specified in step below
5052
ARG INSTALL_ALL=${INSTALL_ALL:-false}
5153
RUN if [ "$INSTALL_ALL" != "false" ]; then \
52-
echo "export CHECKOV_VERSION=latest" >> /.env && \
53-
echo "export INFRACOST_VERSION=latest" >> /.env && \
54-
echo "export TERRAFORM_DOCS_VERSION=latest" >> /.env && \
55-
echo "export TERRAGRUNT_VERSION=latest" >> /.env && \
56-
echo "export TERRASCAN_VERSION=latest" >> /.env && \
57-
echo "export TFLINT_VERSION=latest" >> /.env && \
58-
echo "export TFSEC_VERSION=latest" >> /.env && \
59-
echo "export TRIVY_VERSION=latest" >> /.env && \
60-
echo "export TFUPDATE_VERSION=latest" >> /.env && \
61-
echo "export HCLEDIT_VERSION=latest" >> /.env \
62-
; else \
63-
touch /.env \
54+
echo "CHECKOV_VERSION=latest" >> /.env && \
55+
echo "HCLEDIT_VERSION=latest" >> /.env && \
56+
echo "INFRACOST_VERSION=latest" >> /.env && \
57+
echo "TERRAFORM_DOCS_VERSION=latest" >> /.env && \
58+
echo "TERRAGRUNT_VERSION=latest" >> /.env && \
59+
echo "TERRASCAN_VERSION=latest" >> /.env && \
60+
echo "TFLINT_VERSION=latest" >> /.env && \
61+
echo "TFSEC_VERSION=latest" >> /.env && \
62+
echo "TFUPDATE_VERSION=latest" >> /.env && \
63+
echo "TRIVY_VERSION=latest" >> /.env \
6464
; fi
6565

66-
67-
# Checkov
68-
RUN . /.env && \
69-
if [ "$CHECKOV_VERSION" != "false" ]; then \
70-
( \
71-
# cargo, gcc, git, musl-dev, rust and CARGO envvar required for compilation of rustworkx@0.13.2, no longer required once checkov version depends on rustworkx >0.14.0
72-
# https://github.com/bridgecrewio/checkov/pull/6045
73-
# gcc libffi-dev musl-dev required for compilation of cffi, until it contains musl aarch64
74-
export CARGO_NET_GIT_FETCH_WITH_CLI=true && \
75-
apk add --no-cache cargo=~1 gcc=~12 git=~2 libffi-dev=~3 libgcc=~12 musl-dev=~1 rust=~1 ; \
76-
if [ "$CHECKOV_VERSION" = "latest" ]; \
77-
then pip3 install --no-cache-dir checkov || exit 1; \
78-
else pip3 install --no-cache-dir checkov==${CHECKOV_VERSION} || exit 1; \
79-
fi; \
80-
apk del cargo gcc git libffi-dev musl-dev rust \
81-
) \
82-
; fi
83-
84-
# infracost
85-
RUN . /.env && \
86-
if [ "$INFRACOST_VERSION" != "false" ]; then \
87-
( \
88-
INFRACOST_RELEASES="https://api.github.com/repos/infracost/infracost/releases" && \
89-
if [ "$INFRACOST_VERSION" = "latest" ]; \
90-
then curl -L "$(curl -s ${INFRACOST_RELEASES}/latest | grep -o -E -m 1 "https://.+?-${TARGETOS}-${TARGETARCH}.tar.gz")" > infracost.tgz; \
91-
else curl -L "$(curl -s ${INFRACOST_RELEASES} | grep -o -E "https://.+?v${INFRACOST_VERSION}/infracost-${TARGETOS}-${TARGETARCH}.tar.gz")" > infracost.tgz; \
92-
fi; \
93-
) && tar -xzf infracost.tgz && rm infracost.tgz && mv infracost-${TARGETOS}-${TARGETARCH} infracost \
94-
; fi
95-
96-
# Terraform docs
97-
RUN . /.env && \
98-
if [ "$TERRAFORM_DOCS_VERSION" != "false" ]; then \
99-
( \
100-
TERRAFORM_DOCS_RELEASES="https://api.github.com/repos/terraform-docs/terraform-docs/releases" && \
101-
if [ "$TERRAFORM_DOCS_VERSION" = "latest" ]; \
102-
then curl -L "$(curl -s ${TERRAFORM_DOCS_RELEASES}/latest | grep -o -E -m 1 "https://.+?-${TARGETOS}-${TARGETARCH}.tar.gz")" > terraform-docs.tgz; \
103-
else curl -L "$(curl -s ${TERRAFORM_DOCS_RELEASES} | grep -o -E "https://.+?v${TERRAFORM_DOCS_VERSION}-${TARGETOS}-${TARGETARCH}.tar.gz")" > terraform-docs.tgz; \
104-
fi; \
105-
) && tar -xzf terraform-docs.tgz terraform-docs && rm terraform-docs.tgz && chmod +x terraform-docs \
106-
; fi
107-
108-
# Terragrunt
109-
RUN . /.env \
110-
&& if [ "$TERRAGRUNT_VERSION" != "false" ]; then \
111-
( \
112-
TERRAGRUNT_RELEASES="https://api.github.com/repos/gruntwork-io/terragrunt/releases" && \
113-
if [ "$TERRAGRUNT_VERSION" = "latest" ]; \
114-
then curl -L "$(curl -s ${TERRAGRUNT_RELEASES}/latest | grep -o -E -m 1 "https://.+?/terragrunt_${TARGETOS}_${TARGETARCH}")" > terragrunt; \
115-
else curl -L "$(curl -s ${TERRAGRUNT_RELEASES} | grep -o -E -m 1 "https://.+?v${TERRAGRUNT_VERSION}/terragrunt_${TARGETOS}_${TARGETARCH}")" > terragrunt; \
116-
fi; \
117-
) && chmod +x terragrunt \
118-
; fi
66+
RUN /install/checkov.sh
67+
RUN /install/hcledit.sh
68+
RUN /install/infracost.sh
69+
RUN /install/terraform-docs.sh
70+
RUN /install/terragrunt.sh
71+
RUN /install/terrascan.sh
72+
RUN /install/tflint.sh
73+
RUN /install/tfsec.sh
74+
RUN /install/tfupdate.sh
75+
RUN /install/trivy.sh
11976

12077

121-
# Terrascan
122-
RUN . /.env && \
123-
if [ "$TERRASCAN_VERSION" != "false" ]; then \
124-
if [ "$TARGETARCH" != "amd64" ]; then ARCH="$TARGETARCH"; else ARCH="x86_64"; fi; \
125-
# Convert the first letter to Uppercase
126-
OS="$(echo ${TARGETOS} | cut -c1 | tr '[:lower:]' '[:upper:]' | xargs echo -n; echo ${TARGETOS} | cut -c2-)"; \
127-
( \
128-
TERRASCAN_RELEASES="https://api.github.com/repos/tenable/terrascan/releases" && \
129-
if [ "$TERRASCAN_VERSION" = "latest" ]; \
130-
then curl -L "$(curl -s ${TERRASCAN_RELEASES}/latest | grep -o -E -m 1 "https://.+?_${OS}_${ARCH}.tar.gz")" > terrascan.tar.gz; \
131-
else curl -L "$(curl -s ${TERRASCAN_RELEASES} | grep -o -E "https://.+?${TERRASCAN_VERSION}_${OS}_${ARCH}.tar.gz")" > terrascan.tar.gz; \
132-
fi; \
133-
) && tar -xzf terrascan.tar.gz terrascan && rm terrascan.tar.gz && \
134-
./terrascan init \
135-
; fi
136-
137-
# TFLint
138-
RUN . /.env && \
139-
if [ "$TFLINT_VERSION" != "false" ]; then \
140-
( \
141-
TFLINT_RELEASES="https://api.github.com/repos/terraform-linters/tflint/releases" && \
142-
if [ "$TFLINT_VERSION" = "latest" ]; \
143-
then curl -L "$(curl -s ${TFLINT_RELEASES}/latest | grep -o -E -m 1 "https://.+?_${TARGETOS}_${TARGETARCH}.zip")" > tflint.zip; \
144-
else curl -L "$(curl -s ${TFLINT_RELEASES} | grep -o -E "https://.+?/v${TFLINT_VERSION}/tflint_${TARGETOS}_${TARGETARCH}.zip")" > tflint.zip; \
145-
fi; \
146-
) && unzip tflint.zip && rm tflint.zip \
147-
; fi
148-
149-
# TFSec
150-
RUN . /.env && \
151-
if [ "$TFSEC_VERSION" != "false" ]; then \
152-
( \
153-
TFSEC_RELEASES="https://api.github.com/repos/aquasecurity/tfsec/releases" && \
154-
if [ "$TFSEC_VERSION" = "latest" ]; then \
155-
curl -L "$(curl -s ${TFSEC_RELEASES}/latest | grep -o -E -m 1 "https://.+?/tfsec-${TARGETOS}-${TARGETARCH}")" > tfsec; \
156-
else curl -L "$(curl -s ${TFSEC_RELEASES} | grep -o -E -m 1 "https://.+?v${TFSEC_VERSION}/tfsec-${TARGETOS}-${TARGETARCH}")" > tfsec; \
157-
fi; \
158-
) && chmod +x tfsec \
159-
; fi
160-
161-
# Trivy
162-
RUN . /.env && \
163-
if [ "$TRIVY_VERSION" != "false" ]; then \
164-
if [ "$TARGETARCH" != "amd64" ]; then ARCH="$TARGETARCH"; else ARCH="64bit"; fi; \
165-
( \
166-
TRIVY_RELEASES="https://api.github.com/repos/aquasecurity/trivy/releases" && \
167-
if [ "$TRIVY_VERSION" = "latest" ]; \
168-
then curl -L "$(curl -s ${TRIVY_RELEASES}/latest | grep -o -E -i -m 1 "https://.+?/trivy_.+?_${TARGETOS}-${ARCH}.tar.gz")" > trivy.tar.gz; \
169-
else curl -L "$(curl -s ${TRIVY_RELEASES} | grep -o -E -i -m 1 "https://.+?/v${TRIVY_VERSION}/trivy_.+?_${TARGETOS}-${ARCH}.tar.gz")" > trivy.tar.gz; \
170-
fi; \
171-
) && tar -xzf trivy.tar.gz trivy && rm trivy.tar.gz \
172-
; fi
173-
174-
# TFUpdate
175-
RUN . /.env && \
176-
if [ "$TFUPDATE_VERSION" != "false" ]; then \
177-
( \
178-
TFUPDATE_RELEASES="https://api.github.com/repos/minamijoyo/tfupdate/releases" && \
179-
if [ "$TFUPDATE_VERSION" = "latest" ]; \
180-
then curl -L "$(curl -s ${TFUPDATE_RELEASES}/latest | grep -o -E -m 1 "https://.+?_${TARGETOS}_${TARGETARCH}.tar.gz")" > tfupdate.tgz; \
181-
else curl -L "$(curl -s ${TFUPDATE_RELEASES} | grep -o -E -m 1 "https://.+?${TFUPDATE_VERSION}_${TARGETOS}_${TARGETARCH}.tar.gz")" > tfupdate.tgz; \
182-
fi; \
183-
) && tar -xzf tfupdate.tgz tfupdate && rm tfupdate.tgz \
184-
; fi
185-
186-
# hcledit
187-
RUN . /.env && \
188-
if [ "$HCLEDIT_VERSION" != "false" ]; then \
189-
( \
190-
HCLEDIT_RELEASES="https://api.github.com/repos/minamijoyo/hcledit/releases" && \
191-
if [ "$HCLEDIT_VERSION" = "latest" ]; \
192-
then curl -L "$(curl -s ${HCLEDIT_RELEASES}/latest | grep -o -E -m 1 "https://.+?_${TARGETOS}_${TARGETARCH}.tar.gz")" > hcledit.tgz; \
193-
else curl -L "$(curl -s ${HCLEDIT_RELEASES} | grep -o -E -m 1 "https://.+?${HCLEDIT_VERSION}_${TARGETOS}_${TARGETARCH}.tar.gz")" > hcledit.tgz; \
194-
fi; \
195-
) && tar -xzf hcledit.tgz hcledit && rm hcledit.tgz \
196-
; fi
197-
19878
# Checking binaries versions and write it to debug file
19979
RUN . /.env && \
20080
F=tools_versions_info && \
20181
pre-commit --version >> $F && \
20282
./terraform --version | head -n 1 >> $F && \
20383
(if [ "$CHECKOV_VERSION" != "false" ]; then echo "checkov $(checkov --version)" >> $F; else echo "checkov SKIPPED" >> $F ; fi) && \
84+
(if [ "$HCLEDIT_VERSION" != "false" ]; then echo "hcledit $(./hcledit version)" >> $F; else echo "hcledit SKIPPED" >> $F ; fi) && \
20485
(if [ "$INFRACOST_VERSION" != "false" ]; then echo "$(./infracost --version)" >> $F; else echo "infracost SKIPPED" >> $F ; fi) && \
20586
(if [ "$TERRAFORM_DOCS_VERSION" != "false" ]; then ./terraform-docs --version >> $F; else echo "terraform-docs SKIPPED" >> $F ; fi) && \
20687
(if [ "$TERRAGRUNT_VERSION" != "false" ]; then ./terragrunt --version >> $F; else echo "terragrunt SKIPPED" >> $F ; fi) && \
20788
(if [ "$TERRASCAN_VERSION" != "false" ]; then echo "terrascan $(./terrascan version)" >> $F; else echo "terrascan SKIPPED" >> $F ; fi) && \
20889
(if [ "$TFLINT_VERSION" != "false" ]; then ./tflint --version >> $F; else echo "tflint SKIPPED" >> $F ; fi) && \
20990
(if [ "$TFSEC_VERSION" != "false" ]; then echo "tfsec $(./tfsec --version)" >> $F; else echo "tfsec SKIPPED" >> $F ; fi) && \
210-
(if [ "$TRIVY_VERSION" != "false" ]; then echo "trivy $(./trivy --version)" >> $F; else echo "trivy SKIPPED" >> $F ; fi) && \
21191
(if [ "$TFUPDATE_VERSION" != "false" ]; then echo "tfupdate $(./tfupdate --version)" >> $F; else echo "tfupdate SKIPPED" >> $F ; fi) && \
212-
(if [ "$HCLEDIT_VERSION" != "false" ]; then echo "hcledit $(./hcledit version)" >> $F; else echo "hcledit SKIPPED" >> $F ; fi) && \
92+
(if [ "$TRIVY_VERSION" != "false" ]; then echo "trivy $(./trivy --version)" >> $F; else echo "trivy SKIPPED" >> $F ; fi) && \
21393
echo -e "\n\n" && cat $F && echo -e "\n\n"
21494

21595

hooks/infracost_breakdown.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
set -eo pipefail
33

44
# globals variables
5-
# shellcheck disable=SC2155 # No way to assign to readonly variable in separate lines
6-
readonly SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd -P)"
5+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd -P)"
6+
readonly SCRIPT_DIR
77
# shellcheck source=_common.sh
88
. "$SCRIPT_DIR/_common.sh"
99

hooks/terraform_checkov.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
set -eo pipefail
33

44
# globals variables
5-
# shellcheck disable=SC2155 # No way to assign to readonly variable in separate lines
6-
readonly SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd -P)"
5+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd -P)"
6+
readonly SCRIPT_DIR
77
# shellcheck source=_common.sh
88
. "$SCRIPT_DIR/_common.sh"
99

hooks/terraform_docs.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
set -eo pipefail
33

44
# globals variables
5-
# shellcheck disable=SC2155 # No way to assign to readonly variable in separate lines
6-
readonly SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd -P)"
5+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd -P)"
6+
readonly SCRIPT_DIR
77
# shellcheck source=_common.sh
88
. "$SCRIPT_DIR/_common.sh"
99

hooks/terraform_fmt.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
set -eo pipefail
33

44
# globals variables
5-
# shellcheck disable=SC2155 # No way to assign to readonly variable in separate lines
6-
readonly SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd -P)"
5+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd -P)"
6+
readonly SCRIPT_DIR
77
# shellcheck source=_common.sh
88
. "$SCRIPT_DIR/_common.sh"
99

hooks/terraform_providers_lock.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
set -eo pipefail
44

55
# globals variables
6-
# shellcheck disable=SC2155 # No way to assign to readonly variable in separate lines
7-
readonly SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd -P)"
6+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd -P)"
7+
readonly SCRIPT_DIR
88
# shellcheck source=_common.sh
99
. "$SCRIPT_DIR/_common.sh"
1010

hooks/terraform_tflint.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
set -eo pipefail
44

55
# globals variables
6-
# shellcheck disable=SC2155 # No way to assign to readonly variable in separate lines
7-
readonly SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd -P)"
6+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd -P)"
7+
readonly SCRIPT_DIR
88
# shellcheck source=_common.sh
99
. "$SCRIPT_DIR/_common.sh"
1010

0 commit comments

Comments
 (0)