Browse Source

Update to manifest-tool v0.7.0

With this release, we get to drop our custom patch for pushing to `library/xxx`, and go back to using the officially released upstream binaries (which now exist for all the same architectures we support).
Tianon Gravi 8 years ago
parent
commit
59f40afac1
2 changed files with 26 additions and 86 deletions
  1. 26 30
      bashbrew/Dockerfile.release
  2. 0 56
      bashbrew/manifest-tool.patch

+ 26 - 30
bashbrew/Dockerfile.release

@@ -1,4 +1,4 @@
-FROM golang:1.8-alpine
+FROM golang:1.9-alpine
 
 
 RUN apk add --no-cache \
 RUN apk add --no-cache \
 		file \
 		file \
@@ -24,42 +24,37 @@ ENV BASHBREW_ARCHES \
 COPY .bashbrew-arch-to-goenv.sh /usr/local/bin/
 COPY .bashbrew-arch-to-goenv.sh /usr/local/bin/
 
 
 # https://github.com/estesp/manifest-tool/releases
 # https://github.com/estesp/manifest-tool/releases
-ENV MANIFEST_TOOL_VERSION 0.6.0
+ENV MANIFEST_TOOL_VERSION 0.7.0
 # gpg: key 0F386284C03A1162: public key "Philip Estes <[email protected]>" imported
 # gpg: key 0F386284C03A1162: public key "Philip Estes <[email protected]>" imported
-#ENV MANIFEST_TOOL_GPG_KEY 27F3EA268A97867EAF0BD05C0F386284C03A1162
-# TODO consume Phil's releases again (once he fixes https://github.com/estesp/manifest-tool/issues/47 properly)
-
-COPY manifest-tool.patch ./
+ENV MANIFEST_TOOL_GPG_KEY 27F3EA268A97867EAF0BD05C0F386284C03A1162
 
 
 RUN set -euxo pipefail; \
 RUN set -euxo pipefail; \
+	\
+	export GNUPGHOME="$(mktemp -d)"; \
+	gpg --keyserver ha.pool.sks-keyservers.net --recv-keys "$MANIFEST_TOOL_GPG_KEY"; \
 	\
 	\
 	mkdir -p bin; \
 	mkdir -p bin; \
 	\
 	\
-	mkdir -p manifest-tool/src/github.com/estesp/manifest-tool; \
-	wget -qO- "https://github.com/estesp/manifest-tool/archive/v${MANIFEST_TOOL_VERSION}.tar.gz" \
-		| tar -xz --strip-components=1 -C manifest-tool/src/github.com/estesp/manifest-tool; \
-	( cd manifest-tool/src/github.com/estesp/manifest-tool && patch -p1 ) < manifest-tool.patch; \
 	for bashbrewArch in $BASHBREW_ARCHES; do \
 	for bashbrewArch in $BASHBREW_ARCHES; do \
 		( \
 		( \
 			goEnv="$(.bashbrew-arch-to-goenv.sh "$bashbrewArch")"; eval "$goEnv"; \
 			goEnv="$(.bashbrew-arch-to-goenv.sh "$bashbrewArch")"; eval "$goEnv"; \
+			srcBin="manifest-tool-$GOOS-$GOARCH"; \
+			if [ "$GOARCH" = 'arm' ]; then [ -n "$GOARM" ]; srcBin="${srcBin}v$GOARM"; fi; \
 			[ "$GOOS" = 'windows' ] && ext='.exe' || ext=; \
 			[ "$GOOS" = 'windows' ] && ext='.exe' || ext=; \
-			GOPATH="$PWD/manifest-tool" \
-				go build \
-					-a -v \
-					-ldflags '-s -w' \
-# see https://github.com/golang/go/issues/9737#issuecomment-276817652 (and following comments) -- installsuffix is necessary (for now) to keep ARM
-# can remove "$bashbrewArch" from "installsuffix" in Go 1.10+ (https://github.com/golang/go/commit/1b53f15ebb00dd158af674df410c7941abb2b933)
-					-tags netgo -installsuffix "netgo-$bashbrewArch" \
-					-o "$PWD/bin/manifest-tool-$bashbrewArch$ext" \
-					github.com/estesp/manifest-tool \
-			; \
-			ls -lAFh "bin/manifest-tool-$bashbrewArch$ext"; \
-			file "bin/manifest-tool-$bashbrewArch$ext"; \
+			srcBin="$srcBin$ext"; \
+			targetBin="bin/manifest-tool-$bashbrewArch$ext"; \
+			wget -O "$targetBin.asc" "https://github.com/estesp/manifest-tool/releases/download/v${MANIFEST_TOOL_VERSION}/$srcBin.asc"; \
+			wget -O "$targetBin" "https://github.com/estesp/manifest-tool/releases/download/v${MANIFEST_TOOL_VERSION}/$srcBin"; \
+			gpg --batch --verify "$targetBin.asc" "$targetBin"; \
+			ls -lAFh "$targetBin"*; \
+			file "$targetBin"*; \
 		) \
 		) \
 	done; \
 	done; \
 	\
 	\
-	ls -l bin; \
-	file bin/*
+	rm -rf "$GNUPGHOME"; \
+	\
+	ls -lAFh bin/manifest-tool-*; \
+	file bin/manifest-tool-*
 
 
 COPY go .
 COPY go .
 
 
@@ -72,17 +67,18 @@ RUN set -euxo pipefail; \
 			goEnv="$(.bashbrew-arch-to-goenv.sh "$bashbrewArch")"; eval "$goEnv"; \
 			goEnv="$(.bashbrew-arch-to-goenv.sh "$bashbrewArch")"; eval "$goEnv"; \
 			[ "$GOOS" = 'windows' ] && ext='.exe' || ext=; \
 			[ "$GOOS" = 'windows' ] && ext='.exe' || ext=; \
 			\
 			\
+			targetBin="bin/bashbrew-$bashbrewArch$ext"; \
 			go build \
 			go build \
 				-a -v \
 				-a -v \
 				-ldflags '-s -w' \
 				-ldflags '-s -w' \
-	# see https://github.com/golang/go/issues/9737#issuecomment-276817652 (and following comments) -- installsuffix is necessary (for now) to keep ARM
-	# can remove "$bashbrewArch" from "installsuffix" in Go 1.10+ (https://github.com/golang/go/commit/1b53f15ebb00dd158af674df410c7941abb2b933)
-				-tags netgo -installsuffix "netgo-$bashbrewArch" \
-				-o "bin/bashbrew-$bashbrewArch$ext" \
+				-tags netgo -installsuffix netgo \
+				-o "$targetBin" \
 				./src/bashbrew \
 				./src/bashbrew \
 			; \
 			; \
+			ls -lAFh "$targetBin"; \
+			file "$targetBin"; \
 		) \
 		) \
 	done; \
 	done; \
 	\
 	\
-	ls -l bin; \
-	file bin/*
+	ls -lAFh bin/bashbrew-*; \
+	file bin/bashbrew-*

+ 0 - 56
bashbrew/manifest-tool.patch

@@ -1,56 +0,0 @@
-https://github.com/estesp/manifest-tool/issues/47
-
-diff --git a/vendor/github.com/docker/distribution/reference/reference.go b/vendor/github.com/docker/distribution/reference/reference.go
-index 52da523..3cf3d98 100644
---- a/vendor/github.com/docker/distribution/reference/reference.go
-+++ b/vendor/github.com/docker/distribution/reference/reference.go
-@@ -100,6 +100,13 @@ func (f *Field) UnmarshalText(p []byte) error {
- 	return nil
- }
- 
-+func remoteName(name string) string {
-+	if !strings.ContainsRune(name, '/') {
-+		return "library/" + name
-+	}
-+	return name
-+}
-+
- // Named is an object with a full name
- type Named interface {
- 	Reference
-@@ -304,7 +311,7 @@ func (r reference) String() string {
- }
- 
- func (r reference) Name() string {
--	return r.name
-+	return remoteName(r.name)
- }
- 
- func (r reference) Tag() string {
-@@ -322,7 +329,7 @@ func (r repository) String() string {
- }
- 
- func (r repository) Name() string {
--	return string(r)
-+	return remoteName(string(r))
- }
- 
- type digestReference digest.Digest
-@@ -345,7 +352,7 @@ func (t taggedReference) String() string {
- }
- 
- func (t taggedReference) Name() string {
--	return t.name
-+	return remoteName(t.name)
- }
- 
- func (t taggedReference) Tag() string {
-@@ -362,7 +369,7 @@ func (c canonicalReference) String() string {
- }
- 
- func (c canonicalReference) Name() string {
--	return c.name
-+	return remoteName(c.name)
- }
- 
- func (c canonicalReference) Digest() digest.Digest {