From 0c8c5aa0e3b995e0a4f4f8daf30628afa4e853aa Mon Sep 17 00:00:00 2001 From: Udith Indrakantha <45740208+Udith-Gayan@users.noreply.github.com> Date: Wed, 16 Nov 2022 12:18:26 +0530 Subject: [PATCH] Updating docker image tags with version number (#372) --- CMakeLists.txt | 2 +- test/docker/build.sh | 10 +++++----- test/local-cluster/cluster-start.sh | 3 ++- test/local-cluster/consensus-test-continuous.sh | 3 ++- test/local-cluster/consensus-test-loop.sh | 3 ++- test/local-cluster/rundir.sh | 3 ++- 6 files changed, 14 insertions(+), 10 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 260fd8cd..93d3df59 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -88,7 +88,7 @@ add_custom_target(docker COMMAND mkdir -p ./test/local-cluster/bin COMMAND cp ./build/hpcore ./test/local-cluster/bin/ COMMAND cp ./test/bin/libblake3.so ./test/bin/hpws ./test/bin/hpfs ./test/local-cluster/bin/ - COMMAND docker build -t hpcore:latest -f ./test/local-cluster/Dockerfile ./test/local-cluster/bin/ + COMMAND docker build -t hpcore:latest -t hpcore:0.6.0 -f ./test/local-cluster/Dockerfile ./test/local-cluster/bin/ ) set_target_properties(docker PROPERTIES EXCLUDE_FROM_ALL TRUE) add_dependencies(docker hpcore) diff --git a/test/docker/build.sh b/test/docker/build.sh index 0738d634..19430c8e 100755 --- a/test/docker/build.sh +++ b/test/docker/build.sh @@ -12,12 +12,12 @@ cp $hpcoredir/build/hpcore $hpcoredir/test/bin/{hpfs,hpws,libblake3.so} $tmp/ strip $tmp/hpcore # Remove the revision component from hp version to make up the image version. -# hpversion=$($tmp/hpcore version | head -n 1) -# imgversion=$(echo "${hpversion%.*}") -imgversion="latest" +hpversion=$($tmp/hpcore version | head -n 1) +imgversion=$(echo "${hpversion}") +# imgversion="latest" # Ubuntu base image -docker build -t $img:$imgversion-ubt.20.04 -f ./$basefile $tmp/ +docker build -t $img:$imgversion-ubt.20.04 -t $img:latest-ubt.20.04 -f ./$basefile $tmp/ rm -r $tmp/* # NodeJs image @@ -27,6 +27,6 @@ tar -xvJf $tmp/nodejs.tar.xz --strip-components=2 -C $tmp/ node-v16.14.0-linux-x rm $tmp/nodejs.tar.xz cp ./$njsfile $tmp/ sed -i "s/%ver%/$imgversion/g" $tmp/$njsfile -docker build -t $img:$imgversion-ubt.20.04-njs.16 -f $tmp/$njsfile $tmp +docker build -t $img:$imgversion-ubt.20.04-njs.16 -t $img:latest-ubt.20.04-njs.16 -f $tmp/$njsfile $tmp rm -r $tmp \ No newline at end of file diff --git a/test/local-cluster/cluster-start.sh b/test/local-cluster/cluster-start.sh index ad9b15f9..2a8d605c 100755 --- a/test/local-cluster/cluster-start.sh +++ b/test/local-cluster/cluster-start.sh @@ -14,6 +14,7 @@ fi clusterloc=$(pwd)/hpcluster n=$1 +hpversion=0.6.0 let pubport=8080+$n let peerport=22860+$n @@ -26,4 +27,4 @@ docker run --rm -t -i --network=hpnet --ip=172.1.1.${n} --name=node${n} \ -p ${peerport}:${peerport} \ --device /dev/fuse --cap-add SYS_ADMIN --security-opt apparmor:unconfined \ --mount type=bind,source=${clusterloc}/node${n},target=/contract \ - hpcore:latest run /contract + hpcore:${hpversion} run /contract diff --git a/test/local-cluster/consensus-test-continuous.sh b/test/local-cluster/consensus-test-continuous.sh index 16304fc2..317a9dde 100644 --- a/test/local-cluster/consensus-test-continuous.sh +++ b/test/local-cluster/consensus-test-continuous.sh @@ -5,6 +5,7 @@ WINDOWSIZE=60 # size of window in seconds to examine for successful consensus ro PIPE=concon.pipe clusterloc=$(pwd)/hpcluster n=1 +hpversion=0.6.0 let pubport=8080+$n while true; do @@ -24,7 +25,7 @@ while true; do -p ${pubport}:${pubport} -a stderr -a stdout \ --device /dev/fuse --cap-add SYS_ADMIN --security-opt apparmor:unconfined \ --mount type=bind,source=${clusterloc}/node${n},target=/contract \ - hpcore:latest run /contract > $PIPE 2>> $PIPE 3>MARKER & + hpcore:${hpversion} run /contract > $PIPE 2>> $PIPE 3>MARKER & PID=$! sleep 1 diff --git a/test/local-cluster/consensus-test-loop.sh b/test/local-cluster/consensus-test-loop.sh index 100e3881..4cfef585 100644 --- a/test/local-cluster/consensus-test-loop.sh +++ b/test/local-cluster/consensus-test-loop.sh @@ -3,6 +3,7 @@ clusterloc=$(pwd)/hpcluster n=1 +hpversion=0.6.0 let pubport=8080+$n while true; do CONSENSUS="0" @@ -11,7 +12,7 @@ while true; do -p ${pubport}:${pubport} -a stderr -a stdout \ --device /dev/fuse --cap-add SYS_ADMIN --security-opt apparmor:unconfined \ --mount type=bind,source=${clusterloc}/node${n},target=/contract \ - hpcore:latest run /contract > contest.out 2>> contest.out & + hpcore:${hpversion} run /contract > contest.out 2>> contest.out & PID=$! sleep 1 kill -s 0 $PID 2> /dev/null 1> /dev/null diff --git a/test/local-cluster/rundir.sh b/test/local-cluster/rundir.sh index 4a7ebdfe..7c2871c0 100755 --- a/test/local-cluster/rundir.sh +++ b/test/local-cluster/rundir.sh @@ -15,6 +15,7 @@ fi dir=$(realpath $1) dirname=$(basename $dir) n=$1 +hpversion=0.6.0 let pubport=8080 @@ -25,4 +26,4 @@ docker run --rm -t -i --network=hpnet --name=hp_$dirname \ -p ${pubport}:${pubport} \ --device /dev/fuse --cap-add SYS_ADMIN --security-opt apparmor:unconfined \ --mount type=bind,source=$dir,target=/contract \ - hpcore:latest run /contract \ No newline at end of file + hpcore:${hpversion} run /contract \ No newline at end of file