github.com/hernad/nomad@v1.6.112/e2e/terraform/packer/build (about) 1 #!/usr/bin/env bash 2 3 set -u 4 set -e 5 6 usage() { 7 cat <<EOF 8 Usage: build <target> 9 10 Build an AMI for the target configuration 11 12 Examples 13 build ubuntu-jammy-amd64 14 15 EOF 16 17 exit 2 18 } 19 20 if [[ $# -ne 1 ]]; then 21 usage 22 fi 23 24 target="${1/%.pkr.hcl/}" 25 26 directory="$(dirname "$0")" 27 cd "${directory}" 28 29 if ! test -f "${target}.pkr.hcl"; then 30 echo "${target}.pkr.hcl is not present" >&2 31 exit 1 32 fi 33 34 sha=$(git log -n 1 --pretty=format:%H "${directory}") 35 echo packer build --var "build_sha=${sha}" "${target}.pkr.hcl" 36 packer build --var "build_sha=${sha}" "${target}.pkr.hcl"