@@ -22,7 +22,13 @@ packer_files_sha=$(find Makefile "packer/${os}" plugins/ -type f -print0 | xargs
22
22
internal_files_sha=$( find go.mod go.sum internal/ -type f -print0 | xargs -0 sha256sum | awk ' {print $1}' | sort | sha256sum | awk ' {print $1}' )
23
23
stable_agent_sha=$( curl -Lfs " https://download.buildkite.com/agent/stable/latest/${agent_binary} .sha256" )
24
24
unstable_agent_sha=$( curl -Lfs " https://download.buildkite.com/agent/unstable/latest/${agent_binary} .sha256" )
25
- packer_hash=$( echo " $packer_files_sha " " $internal_files_sha " " $arch " " $stable_agent_sha " " $unstable_agent_sha " " $variant " | sha256sum | awk ' {print $1}' )
25
+ if [[ " ${variant} " == " base" ]]; then
26
+ # Base AMI doesn't use Go dependencies
27
+ packer_hash=$( echo " $packer_files_sha " " $arch " " $stable_agent_sha " " $unstable_agent_sha " " $variant " | sha256sum | awk ' {print $1}' )
28
+ else
29
+ # Full AMI includes Go dependencies for fix-perms binary
30
+ packer_hash=$( echo " $packer_files_sha " " $internal_files_sha " " $arch " " $stable_agent_sha " " $unstable_agent_sha " " $variant " | sha256sum | awk ' {print $1}' )
31
+ fi
26
32
27
33
# Include variant in the hash so base and full images don’t clash
28
34
echo " Packer image hash for ${os} /${arch} (${variant} ) is ${packer_hash} "
@@ -46,7 +52,8 @@ if [[ -n "${PACKER_REBUILD:-}" ]] || ! aws s3 cp "s3://${BUILDKITE_AWS_STACK_BUC
46
52
echo " Base AMI ID not found in metadata, checking S3 for latest base image..."
47
53
48
54
# Calculate hash for base image to find the S3 file
49
- base_packer_hash=$( echo " $packer_files_sha " " $internal_files_sha " " $arch " " $stable_agent_sha " " $unstable_agent_sha " " base" | sha256sum | awk ' {print $1}' )
55
+ # Base AMI doesn't include Go dependencies, so exclude them from hash
56
+ base_packer_hash=$( echo " $packer_files_sha " " $arch " " $stable_agent_sha " " $unstable_agent_sha " " base" | sha256sum | awk ' {print $1}' )
50
57
base_packer_file=" packer-${base_packer_hash} -${os} -${arch} -base.output"
51
58
52
59
# Try to download and extract AMI ID from the base image packer output
0 commit comments