Skip to content

Commit d133ec5

Browse files
author
Christian Rebischke
authored
Merge pull request #32 from jpmenil/fix/packer-version
travis: get latest packer release with the help of hashicorp api
2 parents a2b2049 + 7d82c1b commit d133ec5

File tree

1 file changed

+16
-4
lines changed

1 file changed

+16
-4
lines changed

.travis.yml

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,24 @@ env:
77
- DIST=trusty
88
global:
99
# 20170821: as of writing there is no 'latest' (hashicorp/packer/issues/5265)
10-
- PACKER_ZIP="packer_1.2.1_linux_amd64.zip"
11-
- PACKER_URL="https://releases.hashicorp.com/packer/1.2.1/packer_1.2.1_linux_amd64.zip"
10+
- PACKER_CURRENT_VERSION="$(curl -s https://checkpoint-api.hashicorp.com/v1/check/packer | jq -r -M '.current_version')"
11+
- PACKER_URL="https://releases.hashicorp.com/packer/$PACKER_CURRENT_VERSION/packer_${PACKER_CURRENT_VERSION}_linux_amd64.zip"
12+
- PACKER_SHA256="https://releases.hashicorp.com/packer/$PACKER_CURRENT_VERSION/packer_${PACKER_CURRENT_VERSION}_SHA256SUMS"
13+
- PACKER_SHA256_SIG="https://releases.hashicorp.com/packer/$PACKER_CURRENT_VERSION/packer_${PACKER_CURRENT_VERSION}_SHA256SUMS.sig"
14+
- HASHICORP_FINGERPRINT=91a6e7f85d05c65630bef18951852d87348ffc4c
15+
- HASHICORP_KEY="https://keybase.io/hashicorp/pgp_keys.asc?fingerprint=${HASHICORP_FINGERPRINT}"
1216

1317
install:
14-
- wget "${PACKER_URL}"
15-
- unzip "${PACKER_ZIP}"
18+
- wget ${PACKER_URL}
19+
- wget ${PACKER_SHA256}
20+
- wget ${PACKER_SHA256_SIG}
21+
- wget -O hashicorp.key ${HASHICORP_KEY}
22+
- gpg --with-fingerprint --with-colons hashicorp.key | grep ${HASHICORP_FINGERPRINT^^}
23+
- gpg --import hashicorp.key
24+
- gpg --verify packer_${PACKER_CURRENT_VERSION}_SHA256SUMS.sig packer_${PACKER_CURRENT_VERSION}_SHA256SUMS
25+
- grep linux_amd64 packer_${PACKER_CURRENT_VERSION}_SHA256SUMS > packer_SHA256SUM_linux_amd64
26+
- sha256sum --check --status packer_SHA256SUM_linux_amd64
27+
- unzip packer_${PACKER_CURRENT_VERSION}_linux_amd64.zip
1628

1729
script:
1830
- ./packer --version

0 commit comments

Comments
 (0)