From 1814f55ea87ac52614f8e9c31bcb42e712017d8f Mon Sep 17 00:00:00 2001 From: Luke Fritz Date: Sat, 12 Aug 2023 22:56:42 -0500 Subject: [PATCH 1/2] Fix discrepancy in filesystem-specific path emit (patch) --- scripts/deployment/deploy-files-to-s3/deploy-files-to-s3.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scripts/deployment/deploy-files-to-s3/deploy-files-to-s3.js b/scripts/deployment/deploy-files-to-s3/deploy-files-to-s3.js index 1798711..5571317 100644 --- a/scripts/deployment/deploy-files-to-s3/deploy-files-to-s3.js +++ b/scripts/deployment/deploy-files-to-s3/deploy-files-to-s3.js @@ -70,10 +70,11 @@ async function main() { let errorCount = 0; const files = await readdir(sourcePath, IGNORED_PATHS); + const bareSourcePath = sourcePath.replace(/^\.\//, ''); console.log(`Uploading ${ files.length } files.`); for (const file of files) { console.log(`Processing file "${ file }"...`); - const key = file.replace(sourcePath, ''); + const key = file.replace(new RegExp(`^(\.\/)?${ bareSourcePath }(\/)?`), ''); console.log(`Uploading to s3://${ key }...`); const result = await upload(client, bucket, file, key); if (!result) { From d2d70dcbbc8f6620eff5501aa045b240ad50e651 Mon Sep 17 00:00:00 2001 From: Gerard Setho Date: Wed, 13 Sep 2023 12:53:00 +0800 Subject: [PATCH 2/2] XDR-4667: Compare between most recent tag and next more recent (fix) --- scripts/utilities/verify-files-changed.sh | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/scripts/utilities/verify-files-changed.sh b/scripts/utilities/verify-files-changed.sh index 0a83c62..388b85b 100755 --- a/scripts/utilities/verify-files-changed.sh +++ b/scripts/utilities/verify-files-changed.sh @@ -5,18 +5,19 @@ function main() { local -r base_directory="$1" local -r grep_pattern="$2" local -r current_hash="$(git rev-parse HEAD)" - local -r previous_hash="$(git rev-list --tags --max-count=1)" - local -r previous_parent_hash="$(git rev-list --tags --no-merges --max-count=1)" - local -r previous_version="$(git describe --abbrev=0 --tags --exact-match "$previous_hash")" + # Get the most recent tag, which does not contain HEAD. + local -r previous_tag="$(git --no-pager tag --sort='-authordate' --no-contains HEAD | head -n1)" + local -r previous_hash="$(git --no-pager tag --sort='-authordate' --no-contains HEAD --format '%(objectname)' | head -n1)" - echo "Most recent tag was $previous_version at commit $previous_hash" + echo "Most recent tag was $previous_tag at commit $previous_hash" echo "Complete changeset:" - git --no-pager diff --name-only "$previous_parent_hash..$current_hash" + # This is safe even if previous_tag is an empty string. git-diff will treat previous_tag as HEAD + git --no-pager diff --name-only "$previous_tag..$current_hash" echo "" echo "Looking for files in ./${base_directory}/ matching '${grep_pattern}'" - changeset="$(git --no-pager diff --name-only "$previous_parent_hash..$current_hash")" + changeset="$(git --no-pager diff --name-only "$previous_tag..$current_hash")" changeset="$(echo "$changeset" | grep -E "^$base_directory/.*")" changeset="$(echo "$changeset" | grep -E "$grep_pattern" || true)"