Skip to content

Commit ce8c45c

Browse files
authored
CCM-8881: Sync changes from repository template (#335)
1 parent a031808 commit ce8c45c

20 files changed

+367
-78
lines changed

.github/actions/lint-terraform/action.yaml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@ inputs:
77
runs:
88
using: "composite"
99
steps:
10-
- uses: hashicorp/setup-terraform@v3
11-
- uses: asdf-vm/actions/setup@v3
1210
- name: "Check Terraform format"
1311
shell: bash
1412
run: |
@@ -18,5 +16,6 @@ runs:
1816
run: |
1917
stacks=${{ inputs.root-modules }}
2018
for dir in $(find infrastructure/environments -maxdepth 1 -mindepth 1 -type d; echo ${stacks//,/$'\n'}); do
19+
dir=$dir opts='-backend=false' make terraform-init
2120
dir=$dir make terraform-validate
2221
done

.github/actions/tfsec/action.yaml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@ description: "Scan HCL using TFSec"
33
runs:
44
using: "composite"
55
steps:
6-
- uses: hashicorp/setup-terraform@v3
7-
- uses: asdf-vm/actions/setup@v3
86
- name: "TFSec Scan - Components"
97
shell: bash
108
run: |

.github/workflows/scheduled-repository-template-sync.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ jobs:
2727

2828
- name: Run syncronisation script
2929
run: |
30-
./scripts/githooks/sync-template-repo.sh
30+
./nhs-notify-repository-template/scripts/githooks/sync-template-repo.sh
3131
rm -Rf ./nhs-notify-repository-template
3232
3333
- name: Create Pull Request

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
*sbom*report*.json
66
*vulnerabilities*report*.json
77
*report*json.zip
8+
version.json
89
.version
910

1011
*.code-workspace

.gitleaksignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,5 @@
33
cd9c0efec38c5d63053dd865e5d4e207c0760d91:docs/guides/Perform_static_analysis.md:generic-api-key:37
44
87312c6a627a7b0420956d49187fd15b130df170:src/__tests__/components/molecules/LoginStatus.test.tsx:jwt:23
55
37ca9f5670f4cd7d91869845ca27defbe6156bb9:src/__tests__/components/molecules/LoginStatus.test.tsx:jwt:23
6+
b19d88d1d92b0530f065feefcf25d8cdd82a876a:tests/test-team/auth/user.json:jwt:15
7+
b19d88d1d92b0530f065feefcf25d8cdd82a876a:tests/test-team/auth/user.json:jwt:25

.tool-versions

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
act 0.2.64
2-
gitleaks 8.18.4
2+
gitleaks 8.24.0
33
pre-commit 3.6.0
44
terraform 1.9.2
55
terraform-docs 0.19.0
@@ -13,7 +13,7 @@ nodejs 20.18.2
1313
# TODO: Move this section - consider using a different file for the repository template dependencies.
1414
# docker/ghcr.io/anchore/grype v0.69.1@sha256:d41fcb371d0af59f311e72123dff46900ebd6d0482391b5a830853ee4f9d1a76 # SEE: https://github.com/anchore/grype/pkgs/container/grype
1515
# docker/ghcr.io/anchore/syft v0.92.0@sha256:63c60f0a21efb13e80aa1359ab243e49213b6cc2d7e0f8179da38e6913b997e0 # SEE: https://github.com/anchore/syft/pkgs/container/syft
16-
# docker/ghcr.io/gitleaks/gitleaks v8.18.0@sha256:fd2b5cab12b563d2cc538b14631764a1c25577780e3b7dba71657d58da45d9d9 # SEE: https://github.com/gitleaks/gitleaks/pkgs/container/gitleaks
16+
# docker/ghcr.io/gitleaks/gitleaks v8.24.0@sha256:2bcceac45179b3a91bff11a824d0fb952585b429e54fc928728b1d4d5c3e5176 # SEE: https://github.com/gitleaks/gitleaks/pkgs/container/gitleaks
1717
# docker/ghcr.io/igorshubovych/markdownlint-cli v0.37.0@sha256:fb3e79946fce78e1cde84d6798c6c2a55f2de11fc16606a40d49411e281d950d # SEE: https://github.com/igorshubovych/markdownlint-cli/pkgs/container/markdownlint-cli
1818
# docker/ghcr.io/make-ops-tools/gocloc latest@sha256:6888e62e9ae693c4ebcfed9f1d86c70fd083868acb8815fe44b561b9a73b5032 # SEE: https://github.com/make-ops-tools/gocloc/pkgs/container/gocloc
1919
# docker/ghcr.io/nhs-england-tools/github-runner-image 20230909-321fd1e-rt@sha256:ce4fd6035dc450a50d3cbafb4986d60e77cb49a71ab60a053bb1b9518139a646 # SEE: https://github.com/nhs-england-tools/github-runner-image/pkgs/container/github-runner-image

infrastructure/terraform/bin/terraform.sh

Lines changed: 29 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
##
99
# Set Script Version
1010
##
11-
readonly script_ver="1.8.0";
11+
readonly script_ver="1.8.1";
1212

1313
##
1414
# Standardised failure function
@@ -399,13 +399,16 @@ fi;
399399
pushd "${component_path}";
400400
readonly component_name=$(basename ${component_path});
401401

402-
# Check for presence of tfenv (https://github.com/kamatama41/tfenv)
403-
# and a .terraform-version file. If both present, ensure required
404-
# version of terraform for this component is installed automagically.
405-
tfenv_bin="$(which tfenv 2>/dev/null)";
406-
if [[ -n "${tfenv_bin}" && -x "${tfenv_bin}" && -f .terraform-version ]]; then
407-
${tfenv_bin} install;
408-
fi;
402+
# install terraform
403+
# verify terraform version matches .tool-versions
404+
echo ${PWD}
405+
tool_version=$(grep "terraform " .tool-versions | cut -d ' ' -f 2)
406+
asdf plugin-add terraform && asdf install terraform "${tool_version}"
407+
current_version=$(terraform --version | head -n 1 | cut -d 'v' -f 2)
408+
409+
if [ -z "${current_version}" ] || [ "${current_version}" != "${tool_version}" ]; then
410+
error_and_die "Terraform version mismatch. Expected: ${tool_version}, Actual: ${current_version}"
411+
fi
409412

410413
# Regardless of bootstrapping or not, we'll be using this string.
411414
# If bootstrapping, we will fill it with variables,
@@ -536,26 +539,24 @@ fi;
536539
[ -f "${dynamic_file_path}" ] && tf_var_file_paths+=("${dynamic_file_path}");
537540

538541
# Warn on duplication
539-
if [ ${#tf_var_file_paths[@]} -gt 0 ]; then
540-
duplicate_variables="$(cat "${tf_var_file_paths[@]}" | sed -n -e 's/\(^[a-zA-Z0-9_\-]\+\)\s*=.*$/\1/p' | sort | uniq -d)";
541-
[ -n "${duplicate_variables}" ] \
542-
&& echo -e "
543-
###################################################################
544-
# WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING #
545-
###################################################################
546-
The following input variables appear to be duplicated:
547-
548-
${duplicate_variables}
549-
550-
This could lead to unexpected behaviour. Overriding of variables
551-
has previously been unpredictable and is not currently supported,
552-
but it may work.
553-
554-
Recent changes to terraform might give you useful overriding and
555-
map-merging functionality, please use with caution and report back
556-
on your successes & failures.
557-
###################################################################";
558-
fi
542+
duplicate_variables="$(cat "${tf_var_file_paths[@]}" | sed -n -e 's/\(^[a-zA-Z0-9_\-]\+\)\s*=.*$/\1/p' | sort | uniq -d)";
543+
[ -n "${duplicate_variables}" ] \
544+
&& echo -e "
545+
###################################################################
546+
# WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING #
547+
###################################################################
548+
The following input variables appear to be duplicated:
549+
550+
${duplicate_variables}
551+
552+
This could lead to unexpected behaviour. Overriding of variables
553+
has previously been unpredictable and is not currently supported,
554+
but it may work.
555+
556+
Recent changes to terraform might give you useful overriding and
557+
map-merging functionality, please use with caution and report back
558+
on your successes & failures.
559+
###################################################################";
559560

560561
# Build up the tfvars arguments for terraform command line
561562
for file_path in "${tf_var_file_paths[@]}"; do
Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,24 @@
11
# Files and folders to ignore when syncing nhs-notify-repository-template back in to this repository
2-
scripts/config/.repository-template-sync-ignore
32
.github/workflows/
43
nhs-notify-repository-template/
4+
.github/CODEOWNERS
55

66
# Files and Folders in this repository to ignore
77
.vscode/
88
CHANGELOG.md
99
project.code-workspace
1010
README.md
1111
VERSION
12+
.editorconfig
13+
.gitleaksignore
14+
scripts/tests/
15+
Makefile
16+
scripts/config/sonar-scanner.properties
1217

1318
# Files and Folders in the template repository to disregard
1419
.devcontainer/
1520
.github/workflows/cicd-*.yaml
1621
*/examples/
1722
docs/
1823
infrastructure/terraform/components/
24+
docker/examples/
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Files and folders to merge when syncing nhs-notify-repository-template back in to this repository
2+
scripts/config/.repository-template-sync-ignore
3+
scripts/config/.repository-template-sync-merge
4+
.tool-versions
5+
.gitignore
6+
scripts/config/vale/styles/config/vocabularies/words/accept.txt
7+
scripts/config/vale/styles/config/vocabularies/words/reject.txt

scripts/config/gitleaks.toml

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
# SEE: https://github.com/gitleaks/gitleaks/#configuration
2+
# Do not edit this file directly as it will be overwritten by changes from the nhs-notify-repository-template on next sync
23

34
[extend]
45
useDefault = true # SEE: https://github.com/gitleaks/gitleaks/blob/master/config/gitleaks.toml
@@ -16,4 +17,15 @@ regexes = [
1617
]
1718

1819
[allowlist]
19-
paths = ['''.terraform.lock.hcl''', '''poetry.lock''', '''yarn.lock''']
20+
paths = [
21+
'''.terraform.lock.hcl''',
22+
'''poetry.lock''',
23+
'''yarn.lock''',
24+
'''Gemfile.lock''',
25+
]
26+
27+
# Exclude Chrome version in user agent
28+
regexTarget = "line"
29+
regexes = [
30+
'''Chrome/[\d.]+'''
31+
]

0 commit comments

Comments
 (0)