Skip to content

Commit

Permalink
fix: hashing functiopn
Browse files Browse the repository at this point in the history
  • Loading branch information
christian-calabrese committed Dec 24, 2024
1 parent 262b73f commit 85dfc48
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/infra_apply.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ jobs:
calculate_hash() {
local module_path="$1"
tar --exclude=.* -cvf - "$module_path" | sha256sum | awk '{ print $1 }'
find "$module_path" -type f -not -path "$module_path/.*" | sort | xargs sha256sum | awk '{print $1}' | sha256sum | awk '{print $1}'
}
# Iterate over modules listed in the metadata that were sourced from the Terraform registry
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/infra_plan.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ jobs:
calculate_hash() {
local module_path="$1"
tar --exclude="$module_path/.*" -cf - "$module_path" | sha256sum | awk '{ print $1 }'
find "$module_path" -type f -not -path "$module_path/.*" | sort | xargs sha256sum | awk '{print $1}' | sha256sum | awk '{print $1}'
}
# Iterate over modules listed in the metadata that were sourced from the Terraform registry
Expand Down
3 changes: 2 additions & 1 deletion infra/resources/dev/tfmodules.lock.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{
"dx-azure-naming-conventionz": "302662f449f4359dc31a92ac3be39b3cb6311efe769c45d21149b40ab2453aa5"
"dx-azure-naming-convention": "807e8fafaf3cda8d1df7cc5c624715555ff150e87a8df0becc7e5cab3e54f855",
"dx-azure-naming-conventionz": "b0f4e012251e566e638cba00f25d3e9e79e7ba67058e89d6f1a6b11062e203cb"
}
3 changes: 2 additions & 1 deletion infra/scripts/lock-modules.sh
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,8 @@ function ensure_terraform_get() {
function calculate_hash() {
local -r module_path="$1"
# Create tar archive excluding hidden files, then calculate SHA256 hash
tar --exclude='$module_path/.*' -cf - "$module_path" | sha256sum | awk '{ print $1 }'
# tar --exclude='$module_path/.*' -cf - "$module_path" | sha256sum | awk '{ print $1 }'
find "$module_path" -type f -not -path "$module_path/.*" | sort | xargs sha256sum | awk '{print $1}' | sha256sum | awk '{print $1}'
}

# Initialize or create the hashes file if it doesn't exist
Expand Down

1 comment on commit 85dfc48

@gunzip
Copy link
Contributor

@gunzip gunzip commented on 85dfc48 Dec 24, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

while hashing twice?

Please sign in to comment.