Skip to content

Commit a3b3abe

Browse files
committed
Revert back to Go 1.8.1 and use more nice bits provided by upstream (xxx.sha256 files, for example)
1 parent 830ea98 commit a3b3abe

File tree

6 files changed

+44
-36
lines changed

6 files changed

+44
-36
lines changed

1.8/Dockerfile

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,19 +9,19 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
99
pkg-config \
1010
&& rm -rf /var/lib/apt/lists/*
1111

12-
ENV GOLANG_VERSION 1.8
12+
ENV GOLANG_VERSION 1.8.1
1313

1414
RUN set -eux; \
1515
\
1616
# this "case" statement is generated via "update.sh"
1717
dpkgArch="$(dpkg --print-architecture)"; \
1818
case "${dpkgArch##*-}" in \
19-
ppc64el) goRelArch='linux-ppc64le'; goRelSha256='7e78afe33377b4d4c04817d48feb9f2a904406d32216df015d44462f0432643b' ;; \
20-
i386) goRelArch='linux-386'; goRelSha256='8f618dc8b01c2e53e639a38d780645b8424e671e292c7b518248022205d6a448' ;; \
21-
s390x) goRelArch='linux-s390x'; goRelSha256='fb893a546902c2afdff929ddf5a9fbc0fd50b9017126ee85e80604d8620010fe' ;; \
22-
armhf) goRelArch='linux-armv6l'; goRelSha256='32553dbb342f74a821ed5069cb72ec7e135c031102e7d01c6bc4da8ad6df5202' ;; \
23-
amd64) goRelArch='linux-amd64'; goRelSha256='53ab94104ee3923e228a2cb2116e5e462ad3ebaeea06ff04463479d7f12d27ca' ;; \
24-
*) goRelArch='src'; goRelSha256='406865f587b44be7092f206d73fc1de252600b79b3cacc587b74b5ef5c623596'; \
19+
ppc64el) goRelArch='linux-ppc64le'; goRelSha256='b7b47572a2676449716865a66901090c057f6f1d8dfb1e19528fcd0372e5ce74' ;; \
20+
i386) goRelArch='linux-386'; goRelSha256='cb3f4527112075a8b045d708f793aeee2709d2f5ddd320973a1413db06fddb50' ;; \
21+
s390x) goRelArch='linux-s390x'; goRelSha256='0a59f4034a27fc51431989da520fd244d5261f364888134cab737e5bc2158cb2' ;; \
22+
armhf) goRelArch='linux-armv6l'; goRelSha256='e8a8326913640409028ef95c2107773f989b1b2a6e11ceb463c77c42887381da' ;; \
23+
amd64) goRelArch='linux-amd64'; goRelSha256='a579ab19d5237e263254f1eac5352efcf1d70b9dacadb6d6bb12b0911ede8994' ;; \
24+
*) goRelArch='src'; goRelSha256='33daf4c03f86120fdfdc66bddf6bfff4661c7ca11c5da473e537f4d69b470e57'; \
2525
echo >&2; echo >&2 "warning: current architecture ($dpkgArch) does not have a corresponding Go binary release; will be building from source"; echo >&2 ;; \
2626
esac; \
2727
\

1.8/alpine/Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ FROM alpine:3.5
22

33
RUN apk add --no-cache ca-certificates
44

5-
ENV GOLANG_VERSION 1.8
5+
ENV GOLANG_VERSION 1.8.1
66

77
# https://golang.org/issue/14851 (Go 1.8 & 1.7)
88
# https://golang.org/issue/17847 (Go 1.7)
@@ -30,7 +30,7 @@ RUN set -eux; \
3030
; \
3131
\
3232
wget -O go.tgz "https://golang.org/dl/go$GOLANG_VERSION.src.tar.gz"; \
33-
echo '406865f587b44be7092f206d73fc1de252600b79b3cacc587b74b5ef5c623596 *go.tgz' | sha256sum -c -; \
33+
echo '33daf4c03f86120fdfdc66bddf6bfff4661c7ca11c5da473e537f4d69b470e57 *go.tgz' | sha256sum -c -; \
3434
tar -C /usr/local -xzf go.tgz; \
3535
rm go.tgz; \
3636
\

1.8/stretch/Dockerfile

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,19 +9,19 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
99
pkg-config \
1010
&& rm -rf /var/lib/apt/lists/*
1111

12-
ENV GOLANG_VERSION 1.8
12+
ENV GOLANG_VERSION 1.8.1
1313

1414
RUN set -eux; \
1515
\
1616
# this "case" statement is generated via "update.sh"
1717
dpkgArch="$(dpkg --print-architecture)"; \
1818
case "${dpkgArch##*-}" in \
19-
ppc64el) goRelArch='linux-ppc64le'; goRelSha256='7e78afe33377b4d4c04817d48feb9f2a904406d32216df015d44462f0432643b' ;; \
20-
i386) goRelArch='linux-386'; goRelSha256='8f618dc8b01c2e53e639a38d780645b8424e671e292c7b518248022205d6a448' ;; \
21-
s390x) goRelArch='linux-s390x'; goRelSha256='fb893a546902c2afdff929ddf5a9fbc0fd50b9017126ee85e80604d8620010fe' ;; \
22-
armhf) goRelArch='linux-armv6l'; goRelSha256='32553dbb342f74a821ed5069cb72ec7e135c031102e7d01c6bc4da8ad6df5202' ;; \
23-
amd64) goRelArch='linux-amd64'; goRelSha256='53ab94104ee3923e228a2cb2116e5e462ad3ebaeea06ff04463479d7f12d27ca' ;; \
24-
*) goRelArch='src'; goRelSha256='406865f587b44be7092f206d73fc1de252600b79b3cacc587b74b5ef5c623596'; \
19+
ppc64el) goRelArch='linux-ppc64le'; goRelSha256='b7b47572a2676449716865a66901090c057f6f1d8dfb1e19528fcd0372e5ce74' ;; \
20+
i386) goRelArch='linux-386'; goRelSha256='cb3f4527112075a8b045d708f793aeee2709d2f5ddd320973a1413db06fddb50' ;; \
21+
s390x) goRelArch='linux-s390x'; goRelSha256='0a59f4034a27fc51431989da520fd244d5261f364888134cab737e5bc2158cb2' ;; \
22+
armhf) goRelArch='linux-armv6l'; goRelSha256='e8a8326913640409028ef95c2107773f989b1b2a6e11ceb463c77c42887381da' ;; \
23+
amd64) goRelArch='linux-amd64'; goRelSha256='a579ab19d5237e263254f1eac5352efcf1d70b9dacadb6d6bb12b0911ede8994' ;; \
24+
*) goRelArch='src'; goRelSha256='33daf4c03f86120fdfdc66bddf6bfff4661c7ca11c5da473e537f4d69b470e57'; \
2525
echo >&2; echo >&2 "warning: current architecture ($dpkgArch) does not have a corresponding Go binary release; will be building from source"; echo >&2 ;; \
2626
esac; \
2727
\

1.8/windows/nanoserver/Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,13 @@ RUN $newPath = ('{0}\bin;C:\go\bin;{1}' -f $env:GOPATH, $env:PATH); \
1616
setx /M PATH $newPath;
1717
# doing this first to share cache across versions more aggressively
1818

19-
ENV GOLANG_VERSION 1.8
19+
ENV GOLANG_VERSION 1.8.1
2020

2121
RUN $url = ('https://golang.org/dl/go{0}.windows-amd64.zip' -f $env:GOLANG_VERSION); \
2222
Write-Host ('Downloading {0} ...' -f $url); \
2323
Invoke-WebRequest -Uri $url -OutFile 'go.zip'; \
2424
\
25-
$sha256 = 'cb27fe210f3a9d10329d48514895d2a1e3651125a7c3c758f0358a5bfc0e3060'; \
25+
$sha256 = 'bb6f0fbef8b80c382455af8699bfbb7fe89256d4baf06d927feaeceb7342e4ee'; \
2626
Write-Host ('Verifying sha256 ({0}) ...' -f $sha256); \
2727
if ((Get-FileHash go.zip -Algorithm sha256).Hash -ne $sha256) { \
2828
Write-Host 'FAILED!'; \

1.8/windows/windowsservercore/Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,13 +45,13 @@ RUN $newPath = ('{0}\bin;C:\go\bin;{1}' -f $env:GOPATH, $env:PATH); \
4545
[Environment]::SetEnvironmentVariable('PATH', $newPath, [EnvironmentVariableTarget]::Machine);
4646
# doing this first to share cache across versions more aggressively
4747

48-
ENV GOLANG_VERSION 1.8
48+
ENV GOLANG_VERSION 1.8.1
4949

5050
RUN $url = ('https://golang.org/dl/go{0}.windows-amd64.zip' -f $env:GOLANG_VERSION); \
5151
Write-Host ('Downloading {0} ...' -f $url); \
5252
Invoke-WebRequest -Uri $url -OutFile 'go.zip'; \
5353
\
54-
$sha256 = 'cb27fe210f3a9d10329d48514895d2a1e3651125a7c3c758f0358a5bfc0e3060'; \
54+
$sha256 = 'bb6f0fbef8b80c382455af8699bfbb7fe89256d4baf06d927feaeceb7342e4ee'; \
5555
Write-Host ('Verifying sha256 ({0}) ...' -f $sha256); \
5656
if ((Get-FileHash go.zip -Algorithm sha256).Hash -ne $sha256) { \
5757
Write-Host 'FAILED!'; \

update.sh

Lines changed: 24 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,6 @@ sed_escape_rhs() {
3737
echo "$@" | sed -e 's/[\/&]/\\&/g' | sed -e ':a;N;$!ba;s/\n/\\n/g'
3838
}
3939

40-
googleSource="$(curl -fsSL 'https://golang.org/dl/')"
41-
scrape_sha256() {
42-
local filename="$1"
43-
echo $googleSource | grep -Po '">'"$(sed_escape_lhs "$filename")"'</a>.*?>[a-f0-9]{40,64}<' | sed -r 's!.*>([a-f0-9]{64})<.*!\1!; s!.*[<>]+.*!!' | tail -1
44-
}
45-
4640
travisEnv=
4741
appveyorEnv=
4842
for version in "${versions[@]}"; do
@@ -52,26 +46,39 @@ for version in "${versions[@]}"; do
5246
rcGrepV=
5347
fi
5448
rcGrepV+=' -E'
55-
rcGrepExpr='rc'
49+
rcGrepExpr='beta|rc'
5650

57-
# First check for full version from GitHub as a canonical source
58-
fullVersion="$(curl -fsSL "https://raw.githubusercontent.com/golang/go/release-branch.go$rcVersion/VERSION" 2>/dev/null | grep $rcGrepV -- "$rcGrepExpr" || true)"
59-
if [ -z "$fullVersion" ]; then
60-
echo >&2 "warning: cannot find version from GitHub for $version, scraping golang download page"
61-
fullVersion="$(echo $googleSource | grep -Po '">go'"$rcVersion"'.*?\.src\.tar\.gz</a>' | sed -r 's!.*go([^"/<]+)\.src\.tar\.gz.*!\1!' | grep $rcGrepV -- "$rcGrepExpr" | sort -V | tail -1)"
62-
fi
51+
# https://github.com/golang/go/issues/13220
52+
fullVersion="$(
53+
curl -fsSL 'https://storage.googleapis.com/golang/' \
54+
| grep -oE '<Key>go[^<]+[.]src[.]tar[.]gz</Key>' \
55+
| sed -r \
56+
-e 's!</?Key>!!g' \
57+
-e 's![.]src[.]tar[.]gz$!!' \
58+
-e 's!^go!!' \
59+
| grep $rcGrepV -- "$rcGrepExpr" \
60+
| grep -E "^${version}([.]|$)" \
61+
| sort -V \
62+
| tail -1
63+
)" || true
6364
if [ -z "$fullVersion" ]; then
6465
echo >&2 "warning: cannot find full version for $version"
6566
continue
6667
fi
6768
fullVersion="${fullVersion#go}" # strip "go" off "go1.4.2"
6869

69-
srcSha256="$(scrape_sha256 "go${fullVersion}.src.tar.gz")"
70+
# https://github.com/golang/build/commit/24f7399f96feb8dd2fc54f064e47a886c2f8bb4a
71+
srcSha256="$(curl -fsSL "https://storage.googleapis.com/golang/go${fullVersion}.src.tar.gz.sha256")"
72+
if [ -z "$srcSha256" ]; then
73+
echo >&2 "warning: cannot find sha256 for $fullVersion src tarball"
74+
continue
75+
fi
76+
7077
linuxArchCase='dpkgArch="$(dpkg --print-architecture)"; '$'\\\n'
7178
linuxArchCase+=$'\t''case "${dpkgArch##*-}" in '$'\\\n'
7279
for dpkgArch in "${!dpkgArches[@]}"; do
7380
goArch="${dpkgArches[$dpkgArch]}"
74-
sha256="$(scrape_sha256 "go${fullVersion}.linux-${goArch}.tar.gz")"
81+
sha256="$(curl -fsSL "https://storage.googleapis.com/golang/go${fullVersion}.linux-${goArch}.tar.gz.sha256")"
7582
if [ -z "$sha256" ]; then
7683
echo >&2 "warning: cannot find sha256 for $fullVersion on arch $goArch"
7784
continue 2
@@ -81,7 +88,8 @@ for version in "${versions[@]}"; do
8188
linuxArchCase+=$'\t\t'"*) goRelArch='src'; goRelSha256='$srcSha256'; "$'\\\n'
8289
linuxArchCase+=$'\t\t\t''echo >&2; echo >&2 "warning: current architecture ($dpkgArch) does not have a corresponding Go binary release; will be building from source"; echo >&2 ;; '$'\\\n'
8390
linuxArchCase+=$'\t''esac'
84-
windowsSha256="$(scrape_sha256 "go${fullVersion}.windows-amd64.zip")"
91+
92+
windowsSha256="$(curl -fsSL "https://storage.googleapis.com/golang/go${fullVersion}.windows-amd64.zip.sha256")"
8593

8694
for variant in alpine3.5 alpine; do
8795
if [ -d "$version/$variant" ]; then

0 commit comments

Comments
 (0)