Skip to content

Commit 17a7c68

Browse files
committed
new makefile targets
1 parent 1a66d5b commit 17a7c68

4 files changed

Lines changed: 28 additions & 0 deletions

File tree

README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -283,6 +283,13 @@ Check targets (`check.mk`)
283283
- `cfn-guard-terraform` - validates `terraform_plans` against cfn-guard rulesets and writes outputs to `.cfn_guard_out/`
284284
- `actionlint` - runs actionlint against github actions
285285
- `secret-scan` - runs git-secrets (including scanning history) against the repo
286+
- `guard-<ENVIRONMENT_VARIABLE>` - checks if an environment variable is set and errors if it is not
287+
288+
Credentials targets (`credentials.mk`)
289+
- `aws-configure` - configures an AWS sso session
290+
- `aws-login` - Authorizes an sso session with AWS so aws cli tools can be used. You may still need to set AWS_PROFILE before running commands
291+
- `github-login` - Authorizes github cli to github with scope to read packages
292+
- `create-npmrc` - depends on `github-login`, then writes `.npmrc` with a GitHub Packages auth token and `@nhsdigital` registry
286293

287294
Trivy targets (`trivy.mk`)
288295
- `trivy-license-check` - runs Trivy license scan (HIGH/CRITICAL) and writes `.trivy_out/license_scan.txt`

src/base/.devcontainer/Mk/check.mk

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,3 +81,9 @@ actionlint:
8181

8282
secret-scan:
8383
git-secrets --scan-history .
84+
85+
guard-%:
86+
@ if [ "${${*}}" = "" ]; then \
87+
echo "Environment variable $* not set"; \
88+
exit 1; \
89+
fi
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
include /usr/local/share/eps/Mk/build.mk
22
include /usr/local/share/eps/Mk/check.mk
33
include /usr/local/share/eps/Mk/trivy.mk
4+
include /usr/local/share/eps/Mk/credentials.mk
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
.PHONY: aws-configure aws-login create-npmrc github-login
2+
3+
aws-configure:
4+
aws configure sso --region eu-west-2
5+
6+
aws-login:
7+
aws sso login --sso-session sso-session
8+
9+
create-npmrc: github-login
10+
echo "//npm.pkg.github.com/:_authToken=$$(gh auth token)" > .npmrc
11+
echo "@nhsdigital:registry=https://npm.pkg.github.com" >> .npmrc
12+
13+
github-login:
14+
gh auth login --scopes read:packages

0 commit comments

Comments
 (0)