generated from pagopa/terraform-infrastructure-template
-
Notifications
You must be signed in to change notification settings - Fork 0
50 lines (43 loc) · 1.56 KB
/
static_analysis.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
name: Static Analysis
on:
push:
jobs:
static_analysis:
runs-on: ubuntu-22.04
steps:
# from https://github.com/actions/checkout/commits/main
- uses: actions/checkout@1f9a0c22da41e6ebfa534300ef656657ea2c6707
- name: init_terraform_folders
env:
FOLDERS: >
.identity
src/core
src/azuredevops/core
run: |
pids=()
TAG=$(cat .terraform-version)
for f in $FOLDERS; do
pushd "$(pwd)/${f}"
rm -rf 99_main.tf
mv 99_main.tf.ci 99_main.tf
docker run -v $(pwd):/tmp -w /tmp hashicorp/terraform:$TAG init &
pids+=($!)
popd
done
# Wait for each specific process to terminate.
# Instead of this loop, a single call to 'wait' would wait for all the jobs
# to terminate, but it would not give us their exit status.
#
for pid in "${pids[@]}"; do
#
# Waiting on a specific PID makes the wait command return with the exit
# status of that process. Because of the 'set -e' setting, any exit status
# other than zero causes the current shell to terminate with that exit
# status as well.
#
wait "$pid"
done
- name: run_pre_commit_terraform
run: |
TAG="v1.83.5@sha256:fed35dd9347aa3dd3e59a870dbc4500245dae26910d84065a6f66fe61afceaa8"
docker run -v $(pwd):/lint -w /lint ghcr.io/antonbabenko/pre-commit-terraform:$TAG run -a