From 7177fa4800f7378f1b6c205fd60e04a9b0c3745c Mon Sep 17 00:00:00 2001 From: Mike Cobbett <77053+techcobweb@users.noreply.github.com> Date: Wed, 16 Oct 2024 17:41:20 +0100 Subject: [PATCH] build locally : secrets baseline on linux should not contain a timestamp (#184) Signed-off-by: Mike Cobbett <77053+techcobweb@users.noreply.github.com> --- build-locally.sh | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/build-locally.sh b/build-locally.sh index 526e72b..c09a0a2 100755 --- a/build-locally.sh +++ b/build-locally.sh @@ -441,9 +441,21 @@ function check_secrets { error "Not all secrets found have been audited" exit 1 fi - sed -i '' '/[ ]*"generated_at": ".*",/d' .secrets.baseline success "secrets audit complete" + + h2 "Removing the timestamp from the secrets baseline file so it doesn't always cause a git change." + mkdir -p temp + rc=$? + check_exit_code $rc "Failed to create a temporary folder" + cat .secrets.baseline | grep -v "generated_at" > temp/.secrets.baseline.temp + rc=$? + check_exit_code $rc "Failed to create a temporary file with no timestamp inside" + mv temp/.secrets.baseline.temp .secrets.baseline + rc=$? + check_exit_code $rc "Failed to overwrite the secrets baseline with one containing no timestamp inside." + success "secrets baseline timestamp content has been removed ok" } + # #------------------------------------------------------------------------------------ # h2 "Packaging the javadoc into a docker file" # #------------------------------------------------------------------------------------