Skip to content

Commit 40bbffa

Browse files
committed
Merge remote-tracking branch 'origin/main' into release_script
2 parents 30a9053 + e5c6c80 commit 40bbffa

13 files changed

Lines changed: 486 additions & 800 deletions

.gitallowed

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
token: ?"?\$\{\{\s*secrets\.GITHUB_TOKEN\s*\}\}"?
22
.*\.gitallowed.*
33
id-token: write
4-
def __init__\(self, token: str, owner: str, repo: str
5-
token = os.environ\.get\("GH_TOKEN"\)
4+
password: \${{ secrets\.GITHUB_TOKEN }}
5+
def __init__\(self, token: str, owner: str, repo: str.*
66
self\.token = token
7-
password: \${{ secrets.GITHUB_TOKEN }}
7+
token = os\.environ\.get\(\"GH_TOKEN\"\)
8+
poetry\.lock

.github/dependabot.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ updates:
77
directory: "/"
88
schedule:
99
interval: "weekly"
10-
day: "friday"
10+
day: "thursday"
1111
time: "18:00" # UTC
1212
open-pull-requests-limit: 20
1313
commit-message:
@@ -20,7 +20,7 @@ updates:
2020
directory: "/"
2121
schedule:
2222
interval: "weekly"
23-
day: "friday"
23+
day: "thursday"
2424
time: "18:00" # UTC
2525
open-pull-requests-limit: 20
2626
versioning-strategy: increase
@@ -34,7 +34,7 @@ updates:
3434
directory: "/"
3535
schedule:
3636
interval: "weekly"
37-
day: "friday"
37+
day: "thursday"
3838
time: "18:00" # UTC
3939
open-pull-requests-limit: 20
4040
versioning-strategy: increase

.github/workflows/combine-dependabot-prs.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ jobs:
4545
runs-on: ubuntu-22.04
4646
steps:
4747
- name: Checkout repository
48-
uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3
48+
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8
4949
with:
5050
repository: NHSDigital/eps-common-workflows
5151
sparse-checkout-cone-mode: false

.github/workflows/dependabot-auto-approve-and-merge.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,14 @@ jobs:
1919
steps:
2020
- name: Get token from Github App
2121
id: get_app_token
22-
uses: actions/create-github-app-token@67018539274d69449ef7c02e8e71183d1719ab42
22+
uses: actions/create-github-app-token@29824e69f54612133e76f7eaac726eef6c875baf
2323
with:
2424
app-id: ${{ secrets.AUTOMERGE_APP_ID }}
2525
private-key: ${{ secrets.AUTOMERGE_PEM }}
2626

2727
- name: Dependabot metadata
2828
id: dependabot-metadata
29-
uses: dependabot/fetch-metadata@08eff52bf64351f401fb50d4972fa95b9f2c2d1b
29+
uses: dependabot/fetch-metadata@21025c705c08248db411dc16f3619e6b5f9ea21a
3030
with:
3131
github-token: "${{ secrets.GITHUB_TOKEN }}"
3232

.github/workflows/pull_request.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ jobs:
2323
tag_format: ${{ steps.load-config.outputs.TAG_FORMAT }}
2424
steps:
2525
- name: Checkout code
26-
uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3
26+
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8
2727

2828
- name: Get asdf version
2929
id: asdf-version

.github/workflows/quality-checks.yml

Lines changed: 169 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,14 @@ jobs:
2828
quality_checks:
2929
runs-on: ubuntu-22.04
3030
steps:
31-
- uses: actions/setup-java@dded0888837ed1f317902acf8a20df0ad188d165
31+
- uses: actions/setup-java@f2beeb24e141e01a676f977032f5a29d81c9e27e
3232
if: ${{ inputs.install_java }}
3333
with:
3434
java-version: "21"
3535
distribution: "corretto"
3636

3737
- name: Checkout code
38-
uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3
38+
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8
3939
with:
4040
ref: ${{ env.BRANCH_NAME }}
4141
fetch-depth: 0
@@ -79,7 +79,7 @@ jobs:
7979
asdf_version: ${{ inputs.asdfVersion }}
8080

8181
- name: Cache asdf
82-
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830
82+
uses: actions/cache@9255dc7a253b0ccc959486e2bca901246202afeb
8383
with:
8484
path: |
8585
~/.asdf
@@ -110,7 +110,7 @@ jobs:
110110
echo "@nhsdigital:registry=https://npm.pkg.github.com" >> ~/.npmrc
111111
112112
- name: Cache npm dependencies
113-
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830
113+
uses: actions/cache@9255dc7a253b0ccc959486e2bca901246202afeb
114114
with:
115115
path: ./node_modules
116116
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
@@ -121,12 +121,12 @@ jobs:
121121
run: |
122122
make install
123123
124-
- name: Check if project uses Poetry
125-
id: check_poetry
124+
- name: Check language tools used and setup trivy config
125+
id: check_languages
126126
run: |
127127
if [ -f "pyproject.toml" ] && grep -q '\[tool.poetry\]' "pyproject.toml"; then
128128
echo "****************"
129-
echo "Project uses poetry"
129+
echo "Detected a poetry project"
130130
echo "****************"
131131
echo "uses_poetry=true" >> "$GITHUB_OUTPUT"
132132
else
@@ -135,10 +135,6 @@ jobs:
135135
echo "****************"
136136
echo "uses_poetry=false" >> "$GITHUB_OUTPUT"
137137
fi
138-
139-
- name: Check if project uses Java
140-
id: check_java
141-
run: |
142138
if [ -f pom.xml ]; then
143139
echo "****************"
144140
echo "Detected a Java project"
@@ -150,16 +146,85 @@ jobs:
150146
echo "****************"
151147
echo "uses_java=false" >> "$GITHUB_OUTPUT"
152148
fi
153-
154-
- name: Check licenses (Makefile)
149+
if [ -f package-lock.json ]; then
150+
echo "****************"
151+
echo "Detected a Node.js project"
152+
echo "****************"
153+
echo "uses_node=true" >> "$GITHUB_OUTPUT"
154+
else
155+
echo "****************"
156+
echo "Project does not use Node.js"
157+
echo "****************"
158+
echo "uses_node=false" >> "$GITHUB_OUTPUT"
159+
fi
160+
if [ -f src/go.sum ]; then
161+
echo "****************"
162+
echo "Detected a Go project"
163+
echo "****************"
164+
echo "uses_go=true" >> "$GITHUB_OUTPUT"
165+
else
166+
echo "****************"
167+
echo "Project does not use Go"
168+
echo "****************"
169+
echo "uses_go=false" >> "$GITHUB_OUTPUT"
170+
fi
171+
touch trivy.yaml
172+
- name: Update trivy config to include dev dependencies
173+
uses: mikefarah/yq@065b200af9851db0d5132f50bc10b1406ea5c0a8
174+
with:
175+
cmd: yq -i '.pkg.include-dev-deps = true' 'trivy.yaml'
176+
- name: convert python dependencies to requirements.txt
177+
if: ${{ steps.check_languages.outputs.uses_poetry == 'true' }}
155178
run: |
156-
make check-licenses
179+
POETRY_VERSION=$(poetry --version | awk '{print $3}')
157180
181+
if [[ "$(printf '%s\n' "2.0.0" "$POETRY_VERSION" "3.0.0" | sort -V | head -n1)" == "2.0.0" ]] \
182+
&& [[ "$(printf '%s\n' "$POETRY_VERSION" "3.0.0" | sort -V | head -n1)" == "$POETRY_VERSION" ]]; then
183+
echo "Poetry version $POETRY_VERSION is >=2.0.0 and <3.0.0 - installing plugin-export"
184+
poetry self add poetry-plugin-export
185+
else
186+
echo "Poetry version $POETRY_VERSION is outside the required range so not installing plugin-export"
187+
fi
188+
poetry export -f requirements.txt --with dev --without-hashes --output=requirements.txt
189+
- name: download go dependencies
190+
if: ${{ steps.check_languages.outputs.uses_go == 'true' }}
191+
run: |
192+
cd src
193+
go mod vendor
194+
- name: Check licenses
195+
uses: aquasecurity/trivy-action@b6643a29fecd7f34b3597bc6acb0a98b03d33ff8
196+
with:
197+
scan-type: "fs"
198+
scan-ref: "."
199+
severity: "CRITICAL,HIGH"
200+
scanners: "license"
201+
format: "table"
202+
output: "license_scan.txt"
203+
exit-code: "1"
204+
list-all-pkgs: "false"
205+
trivy-config: trivy.yaml
206+
env:
207+
VIRTUAL_ENV: "./.venv/"
208+
- name: remove requirements.txt
209+
if: ${{ steps.check_languages.outputs.uses_poetry == 'true' }}
210+
run: |
211+
rm -f requirements.txt
212+
- name: clean go dependencies
213+
if: ${{ steps.check_languages.outputs.uses_go == 'true' }}
214+
run: |
215+
cd src
216+
rm -rf vendor
217+
- name: Show license scan output
218+
if: always()
219+
run: |
220+
if [ -f license_scan.txt ]; then
221+
cat license_scan.txt
222+
fi
158223
- name: Run code lint
159224
run: make lint
160225

161226
- name: actionlint
162-
uses: raven-actions/actionlint@3a24062651993d40fed1019b58ac6fbdfbf276cc
227+
uses: raven-actions/actionlint@963d4779ef039e217e5d0e6fd73ce9ab7764e493
163228

164229
- name: Run ShellCheck
165230
uses: ludeeus/action-shellcheck@00cae500b08a931fb5698e11e79bfbd38e612a38
@@ -173,32 +238,111 @@ jobs:
173238
- name: Run unit tests
174239
run: make test
175240

176-
- name: Generate and check SBOMs
177-
uses: NHSDigital/eps-action-sbom@7684ce6314e515df7b7929fac08b4464f8a03d06
241+
- name: Generate SBOM
242+
uses: aquasecurity/trivy-action@b6643a29fecd7f34b3597bc6acb0a98b03d33ff8
243+
with:
244+
scan-type: "fs"
245+
scan-ref: "."
246+
scanners: "vuln"
247+
format: "cyclonedx"
248+
output: "sbom.cdx.json"
249+
exit-code: "0"
250+
trivy-config: trivy.yaml
251+
- name: Upload sbom
252+
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f
253+
with:
254+
name: sbom.cdx.json
255+
path: sbom.cdx.json
178256

257+
- name: Check python vulnerabilities
258+
if: ${{ steps.check_languages.outputs.uses_poetry == 'true' }}
259+
uses: aquasecurity/trivy-action@b6643a29fecd7f34b3597bc6acb0a98b03d33ff8
260+
with:
261+
scan-type: "fs"
262+
skip-files: "**/package-lock.json,**/go.mod,**/pom.xml"
263+
scan-ref: "."
264+
severity: "CRITICAL,HIGH"
265+
scanners: "vuln"
266+
format: "table"
267+
output: "dependency_results_python.txt"
268+
exit-code: "1"
269+
trivy-config: trivy.yaml
270+
- name: Check node vulnerabilities
271+
if: ${{ steps.check_languages.outputs.uses_node == 'true' }}
272+
uses: aquasecurity/trivy-action@b6643a29fecd7f34b3597bc6acb0a98b03d33ff8
273+
with:
274+
scan-type: "fs"
275+
skip-files: "**/poetry.lock,**/go.mod,**/pom.xml"
276+
scan-ref: "."
277+
severity: "CRITICAL,HIGH"
278+
scanners: "vuln"
279+
format: "table"
280+
output: "dependency_results_node.txt"
281+
exit-code: "1"
282+
trivy-config: trivy.yaml
283+
- name: Check go vulnerabilities
284+
if: ${{ steps.check_languages.outputs.uses_go == 'true' }}
285+
uses: aquasecurity/trivy-action@b6643a29fecd7f34b3597bc6acb0a98b03d33ff8
286+
with:
287+
scan-type: "fs"
288+
skip-files: "**/poetry.lock,**/package-lock.json,**/pom.xml"
289+
scan-ref: "."
290+
severity: "CRITICAL,HIGH"
291+
scanners: "vuln"
292+
format: "table"
293+
output: "dependency_results_go.txt"
294+
exit-code: "1"
295+
- name: Check java vulnerabilities
296+
if: ${{ steps.check_languages.outputs.uses_java == 'true' }}
297+
uses: aquasecurity/trivy-action@b6643a29fecd7f34b3597bc6acb0a98b03d33ff8
298+
with:
299+
scan-type: "fs"
300+
skip-files: "**/poetry.lock,**/package-lock.json,**/go.mod"
301+
scan-ref: "."
302+
severity: "CRITICAL,HIGH"
303+
scanners: "vuln"
304+
format: "table"
305+
output: "dependency_results_java.txt"
306+
exit-code: "1"
307+
trivy-config: trivy.yaml
308+
- name: Show vulnerability output
309+
if: always()
310+
run: |
311+
if [ -f dependency_results_python.txt ]; then
312+
cat dependency_results_python.txt
313+
fi
314+
if [ -f dependency_results_node.txt ]; then
315+
cat dependency_results_node.txt
316+
fi
317+
if [ -f dependency_results_java.txt ]; then
318+
cat dependency_results_java.txt
319+
fi
320+
if [ -f dependency_results_go.txt ]; then
321+
cat dependency_results_go.txt
322+
fi
179323
- name: "check is SONAR_TOKEN exists"
180324
env:
181325
super_secret: ${{ secrets.SONAR_TOKEN }}
182326
if: ${{ env.super_secret != '' && inputs.run_sonar == true }}
183327
run: echo "SONAR_TOKEN_EXISTS=true" >> "$GITHUB_ENV"
184328

185329
- name: Run SonarQube analysis
186-
if: ${{ steps.check_java.outputs.uses_java == 'true' && env.SONAR_TOKEN_EXISTS == 'true' }}
330+
if: ${{ steps.check_languages.outputs.uses_java == 'true' && env.SONAR_TOKEN_EXISTS == 'true' }}
187331
run: mvn sonar:sonar -Dsonar.login=${{ secrets.SONAR_TOKEN }}
188332

189333
- name: SonarCloud Scan
190-
uses: SonarSource/sonarqube-scan-action@fd88b7d7ccbaefd23d8f36f73b59db7a3d246602
191-
if: ${{ steps.check_java.outputs.uses_java == 'false' && env.SONAR_TOKEN_EXISTS == 'true' }}
334+
uses: SonarSource/sonarqube-scan-action@a31c9398be7ace6bbfaf30c0bd5d415f843d45e9
335+
if: ${{ steps.check_languages.outputs.uses_java == 'false' && env.SONAR_TOKEN_EXISTS == 'true' }}
192336
env:
193337
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
194338
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
195339

196340
# CloudFormation validation (runs only if templates exist, ~3-5 minutes)
197-
cloudformation-validation:
341+
IaC-validation:
198342
runs-on: ubuntu-22.04
199343
steps:
200344
- name: Checkout code
201-
uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3
345+
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8
202346
with:
203347
ref: ${{ env.BRANCH_NAME }}
204348
fetch-depth: 0
@@ -257,7 +401,7 @@ jobs:
257401
258402
- name: Cache npm dependencies
259403
if: steps.check_cdk.outputs.cdk_exists == 'true'
260-
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830
404+
uses: actions/cache@9255dc7a253b0ccc959486e2bca901246202afeb
261405
with:
262406
path: ~/.npm
263407
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
@@ -362,7 +506,7 @@ jobs:
362506
done
363507
364508
- name: Download terraform plans
365-
uses: actions/download-artifact@018cc2cf5baa6db3ef3c5f8a56943fffe632ef53
509+
uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131
366510
with:
367511
pattern: "*_terraform_plan"
368512
path: terraform_plans/
@@ -403,7 +547,7 @@ jobs:
403547

404548
- name: Upload cfn_guard_output
405549
if: failure()
406-
uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4
550+
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f
407551
with:
408552
name: cfn_guard_output
409553
path: cfn_guard_output

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
tag_format: ${{ steps.load-config.outputs.TAG_FORMAT }}
1616
steps:
1717
- name: Checkout code
18-
uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3
18+
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8
1919

2020
- name: Get asdf version
2121
id: asdf-version

0 commit comments

Comments
 (0)