Skip to content

Commit 9603b0e

Browse files
committed
[FAB-3136] Include install script with release package
Since we distribute our runtime(s) as Docker images and there are several of them to download, it's convenient to provide a script which will download the correct version as well as iamges for the correct architecture. The script basically has a list of the various fabric images and the make target uses substituion to set the right variables for each platform. NOTE: I hard-coded VERSION to 1.0.0-alpha for now because we do need to publish these packages and update the docs to ensure things will still work with the alpha Change-Id: I76d6db3ab638e13e65c4b4c0ce23d4af4e6ef068 Signed-off-by: Gari Singh <[email protected]>
1 parent c9ecf9e commit 9603b0e

File tree

2 files changed

+44
-17
lines changed

2 files changed

+44
-17
lines changed

Makefile

+27-17
Original file line numberDiff line numberDiff line change
@@ -276,41 +276,49 @@ release: $(patsubst %,release/%, $(shell go env GOOS)-$(shell go env GOARCH))
276276
release-all: $(patsubst %,release/%, $(RELEASE_PLATFORMS))
277277

278278
release/windows-amd64: GOOS=windows
279-
release/windows-amd64: GOARCH=amd64
280279
release/windows-amd64: GO_TAGS+= nopkcs11
281-
release/windows-amd64: $(patsubst %,release/windows-amd64/%, $(RELEASE_PKGS))
280+
release/windows-amd64: $(patsubst %,release/windows-amd64/bin/%, $(RELEASE_PKGS)) release/windows-amd64/install
282281

283282
release/darwin-amd64: GOOS=darwin
284-
release/darwin-amd64: GOARCH=amd64
285283
release/darwin-amd64: GO_TAGS+= nopkcs11
286-
release/darwin-amd64: $(patsubst %,release/darwin-amd64/%, $(RELEASE_PKGS))
284+
release/darwin-amd64: $(patsubst %,release/darwin-amd64/bin/%, $(RELEASE_PKGS)) release/darwin-amd64/install
287285

288286
release/linux-amd64: GOOS=linux
289-
release/linux-amd64: GOARCH=amd64
290287
release/linux-amd64: GO_TAGS+= nopkcs11
291-
release/linux-amd64: $(patsubst %,release/linux-amd64/%, $(RELEASE_PKGS))
288+
release/linux-amd64: $(patsubst %,release/linux-amd64/bin/%, $(RELEASE_PKGS)) release/linux-amd64/install
289+
290+
release/%-amd64: DOCKER_ARCH=x86_64
291+
release/%-amd64: GOARCH=amd64
292+
release/linux-%: GOOS=linux
292293

293-
release/linux-ppc64le: GOOS=linux
294294
release/linux-ppc64le: GOARCH=ppc64le
295+
release/linux-ppc64le: DOCKER_ARCH=ppc64le
295296
release/linux-ppc64le: GO_TAGS+= nopkcs11
296-
release/linux-ppc64le: $(patsubst %,release/linux-ppc64le/%, $(RELEASE_PKGS))
297+
release/linux-ppc64le: $(patsubst %,release/linux-ppc64le/bin/%, $(RELEASE_PKGS)) release/linux-ppc64le/install
297298

298-
release/linux-s390x: GOOS=linux
299299
release/linux-s390x: GOARCH=s390x
300+
release/linux-s390x: DOCKER_ARCH=s390x
300301
release/linux-s390x: GO_TAGS+= nopkcs11
301-
release/linux-s390x: $(patsubst %,release/linux-s390x/%, $(RELEASE_PKGS))
302+
release/linux-s390x: $(patsubst %,release/linux-s390x/bin/%, $(RELEASE_PKGS)) release/linux-s390x/install
302303

303-
release/%/configtxgen: $(PROJECT_FILES)
304+
release/%/bin/configtxgen: $(PROJECT_FILES)
304305
@echo "Building $@ for $(GOOS)-$(GOARCH)"
305306
mkdir -p $(@D)
306307
$(CGO_FLAGS) GOOS=$(GOOS) GOARCH=$(GOARCH) go build -o $(abspath $@) -tags "$(GO_TAGS)" -ldflags "$(GO_LDFLAGS)" $(pkgmap.$(@F))
307-
@touch $@
308308

309-
release/%/cryptogen: $(PROJECT_FILES)
309+
release/%/bin/cryptogen: $(PROJECT_FILES)
310310
@echo "Building $@ for $(GOOS)-$(GOARCH)"
311311
mkdir -p $(@D)
312312
$(CGO_FLAGS) GOOS=$(GOOS) GOARCH=$(GOARCH) go build -o $(abspath $@) -tags "$(GO_TAGS)" -ldflags "$(GO_LDFLAGS)" $(pkgmap.$(@F))
313-
@touch $@
313+
314+
release/%/install: $(PROJECT_FILES)
315+
mkdir -p $@
316+
@cat $@/../../templates/get-docker-images.in \
317+
| sed -e 's/_NS_/$(DOCKER_NS)/g' \
318+
| sed -e 's/_ARCH_/$(DOCKER_ARCH)/g' \
319+
| sed -e 's/_VERSION_/$(PROJECT_VERSION)/g' \
320+
> $@/get-docker-images.sh
321+
@chmod +x $@/get-docker-images.sh
314322

315323
.PHONY: protos
316324
protos: buildenv
@@ -331,9 +339,11 @@ clean: docker-clean unit-test-clean
331339
dist-clean: clean gotools-clean
332340
-@rm -rf /var/hyperledger/* ||:
333341

334-
.PHONY: release-clean
335-
release-clean:
336-
-@rm -rf release
342+
%-release-clean:
343+
$(eval TARGET = ${patsubst %-release-clean,%,${@}})
344+
-@rm -rf release/$(TARGET)
345+
346+
release-clean: $(patsubst %,%-release-clean, $(RELEASE_PLATFORMS))
337347

338348
.PHONY: unit-test-clean
339349
unit-test-clean:
+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#!/bin/bash -eu
2+
3+
# This script pulls docker images from the Dockerhub hyperledger repositories
4+
5+
# set the default Docker namespace and tag
6+
DOCKER_NS=_NS_
7+
ARCH=_ARCH_
8+
VERSION=1.0.0-alpha
9+
10+
# set of Hyperledger Fabric images
11+
FABRIC_IMAGES=(fabric-peer fabric-orderer fabric-ccenv fabric-javaenv fabric-kafka fabric-zookeeper fabric-couchdb)
12+
13+
for image in ${FABRIC_IMAGES[@]}; do
14+
echo "Pulling ${DOCKER_NS}/$image:${ARCH}-${VERSION}"
15+
docker pull ${DOCKER_NS}/$image:${ARCH}-${VERSION}
16+
done
17+

0 commit comments

Comments
 (0)