Skip to content

Commit 5edc6fa

Browse files
Pull Docker images before scenario tests (#761)
The previous change to not pull Docker images prior to running scenario tests seems to have introduced potential failures due to the time taken to pull images during chaincode deployment. This change explicitly pulls Docker images prior to running scenario tests in the automated build. Signed-off-by: Mark S. Lewis <Mark.S.Lewis@outlook.com>
1 parent c0ce78a commit 5edc6fa

File tree

5 files changed

+26
-9
lines changed

5 files changed

+26
-9
lines changed

.github/workflows/test.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,8 @@ jobs:
9999
TMPDIR: ${{ runner.temp }}
100100
- name: Generate mocks
101101
run: make generate
102+
- name: Pull Docker images
103+
run: make pull-docker-images
102104
- name: Run scenario tests
103105
run: make scenario-test-go
104106

@@ -147,6 +149,8 @@ jobs:
147149
run: sudo apt install -y softhsm2
148150
env:
149151
TMPDIR: ${{ runner.temp }}
152+
- name: Pull Docker images
153+
run: make pull-docker-images
150154
- name: Run scenario tests
151155
run: make scenario-test-node
152156

@@ -199,5 +203,7 @@ jobs:
199203
- uses: actions/setup-go@v5
200204
with:
201205
go-version: stable
206+
- name: Pull Docker images
207+
run: make pull-docker-images
202208
- name: Run scenario tests
203209
run: make scenario-test-java

Makefile

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,11 @@ machine_hardware := $(shell uname -m)
2020
export SOFTHSM2_CONF ?= $(base_dir)/softhsm2.conf
2121
TMPDIR ?= /tmp
2222

23+
# These should match names in Docker .env file
24+
export FABRIC_VERSION ?= 2.5
25+
export NODEENV_VERSION ?= 2.5
26+
export CA_VERSION ?= 1.5
27+
2328
.PHONY: default
2429
default:
2530
@echo 'No default target.'
@@ -189,6 +194,14 @@ scenario-test: scenario-test-go scenario-test-node scenario-test-java
189194
.PHONY: scenario-test-no-hsm
190195
scenario-test-no-hsm: scenario-test-go-no-hsm scenario-test-node-no-hsm scenario-test-java
191196

197+
.PHONY: pull-docker-images
198+
pull-docker-images:
199+
for IMAGE in peer orderer baseos ccenv tools; do \
200+
docker pull --quiet "hyperledger/fabric-$${IMAGE}:$(FABRIC_VERSION)"; \
201+
done
202+
docker pull --quiet 'hyperledger/fabric-nodeenv:$(NODEENV_VERSION)'
203+
docker pull --quiet 'hyperledger/fabric-ca:$(CA_VERSION)'
204+
192205
.PHONY: fabric-ca-client
193206
fabric-ca-client:
194207
go install -tags pkcs11 github.com/hyperledger/fabric-ca/cmd/fabric-ca-client@latest
Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
# Environment variables will be overridden if set in user environment or Makefile.
22
# Typically we'll want to test with the latest released orderer and tools images from dockerhub, but latest unreleased peer image that has been pulled and tagged
3-
ORDERER_IMAGE_TAG=2.5
4-
TOOLS_IMAGE_TAG=2.5
5-
PEER_IMAGE_TAG=2.5
6-
FABRIC_CA_IMAGE_TAG=1.5
3+
FABRIC_VERSION=2.5
4+
CA_VERSION=1.5
75
DOCKER_DEBUG=info:dockercontroller,gateway=debug
86
DOCKER_SOCK=/var/run/docker.sock

scenario/fixtures/docker-compose/docker-compose-base.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ version: "3.8"
1515

1616
services:
1717
ca0:
18-
image: hyperledger/fabric-ca:${FABRIC_CA_IMAGE_TAG}
18+
image: hyperledger/fabric-ca:${CA_VERSION}
1919
environment:
2020
- FABRIC_CA_HOME=/etc/hyperledger/fabric-ca-server
2121
- FABRIC_CA_SERVER_CA_NAME=ca-org1
@@ -30,7 +30,7 @@ services:
3030
container_name: ca_peerOrg1
3131

3232
ca1:
33-
image: hyperledger/fabric-ca:${FABRIC_CA_IMAGE_TAG}
33+
image: hyperledger/fabric-ca:${CA_VERSION}
3434
environment:
3535
- FABRIC_CA_HOME=/etc/hyperledger/fabric-ca-server
3636
- FABRIC_CA_SERVER_CA_NAME=ca-org2
@@ -45,7 +45,7 @@ services:
4545

4646
orderer:
4747
container_name: orderer
48-
image: hyperledger/fabric-orderer:${ORDERER_IMAGE_TAG}
48+
image: hyperledger/fabric-orderer:${FABRIC_VERSION}
4949
environment:
5050
- ORDERER_GENERAL_LOGLEVEL=${DOCKER_DEBUG}
5151
- ORDERER_GENERAL_LISTENADDRESS=0.0.0.0
@@ -75,7 +75,7 @@ services:
7575

7676
peer:
7777
container_name: peer
78-
image: hyperledger/fabric-peer:${PEER_IMAGE_TAG}
78+
image: hyperledger/fabric-peer:${FABRIC_VERSION}
7979
environment:
8080
- CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock
8181
- CORE_PEER_ADDRESSAUTODETECT=true

scenario/fixtures/docker-compose/docker-compose-cli.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ version: "3.8"
1717
services:
1818
clinopeer:
1919
container_name: cli
20-
image: hyperledger/fabric-tools:${TOOLS_IMAGE_TAG}
20+
image: hyperledger/fabric-tools:${FABRIC_VERSION}
2121
tty: true
2222
environment:
2323
# LOGGING SETTINGS

0 commit comments

Comments
 (0)