X-Git-Url: https://gerrit.opnfv.org/gerrit/gitweb?a=blobdiff_plain;f=build.sh;h=d6726d320bfa457eb4f1ccdb5e37ee238cf3586f;hb=8e297c49c481961959b29c2080cc059fcc84e9ee;hp=3b46cb06e74d7953fa1a1fb13dbae6ca7976dcb6;hpb=b31ae2c8b59619251cffcba1f307e0b7b9acd89d;p=functest.git diff --git a/build.sh b/build.sh index 3b46cb06e..d6726d320 100644 --- a/build.sh +++ b/build.sh @@ -2,32 +2,75 @@ set -e -repo=${repo:-opnfv} -x86_64_dirs=${x86_64_dirs-"\ +repo=${REPO:-opnfv} +amd64_dirs=${amd64_dirs-"\ docker/core \ docker/healthcheck \ docker/smoke \ -docker/features \ -docker/components \ +docker/benchmarking \ docker/vnf \ -docker/parser \ -docker/restapi"} -aarch64_dirs=${aarch64_dirs-$(echo "${x86_64_dirs}" | sed -e "s|docker/vnf||" \ - -e "s|docker/restapi||")} +docker/smoke-cntt \ +docker/benchmarking-cntt"} +arm_dirs=${arm_dirs-"\ +docker/core \ +docker/healthcheck \ +docker/smoke \ +docker/benchmarking \ +docker/smoke-cntt \ +docker/benchmarking-cntt"} +arm64_dirs=${arm64_dirs-${amd64_dirs}} +build_opts=("--pull=true" --no-cache "--force-rm=true") + +find . -name Dockerfile -exec sed -i \ + -e "s|opnfv/functest-core|${repo}/functest-core:amd64-latest|g" {} + +find . -name Dockerfile -exec sed -i \ + -e "s|opnfv/functest-tempest|${repo}/functest-tempest:amd64-latest|g" {} + +for dir in ${amd64_dirs}; do + (cd "${dir}" && + docker build "${build_opts[@]}" \ + -t "${repo}/functest-${dir##**/}:amd64-latest" .) + docker push "${repo}/functest-${dir##**/}:amd64-latest" + [ "${dir}" != "docker/core" ] && + (docker rmi "${repo}/functest-${dir##**/}:amd64-latest" || true) +done +[ -n "${amd64_dirs}" ] && + (docker rmi "${repo}/functest-core:amd64-latest" alpine:3.11 || true) +find . -name Dockerfile -exec git checkout {} + -find . -name Dockerfile -exec sed -i -e "s|opnfv/functest-core|${repo}/functest-core:x86_64-latest|g" {} + -for dir in ${x86_64_dirs}; do - (cd "${dir}" && docker build -t "${repo}/functest-${dir##**/}:x86_64-latest" .) - docker push "${repo}/functest-${dir##**/}:x86_64-latest" +find . -name Dockerfile -exec sed -i \ + -e "s|alpine:3.11|arm64v8/alpine:3.11|g" {} + +find . -name Dockerfile -exec sed -i \ + -e "s|opnfv/functest-core|${repo}/functest-core:arm64-latest|g" {} + +find . -name Dockerfile -exec sed -i \ + -e "s|opnfv/functest-tempest|${repo}/functest-tempest:arm64-latest|g" {} + +for dir in ${arm64_dirs}; do + (cd "${dir}" && docker build "${build_opts[@]}" \ + -t "${repo}/functest-${dir##**/}:arm64-latest" .) + docker push "${repo}/functest-${dir##**/}:arm64-latest" + [ "${dir}" != "docker/core" ] && + (docker rmi "${repo}/functest-${dir##**/}:arm64-latest" || true) done +[ -n "${arm64_dirs}" ] && + (docker rmi "${repo}/functest-core:arm64-latest" \ + arm64v8/alpine:3.11 || true) find . -name Dockerfile -exec git checkout {} + -find . -name Dockerfile -exec sed -i -e "s|alpine:3.6|multiarch/alpine:aarch64-v3.6|g" {} + -find . -name Dockerfile -exec sed -i -e "s|opnfv/functest-core|${repo}/functest-core:aarch64-latest|g" {} + -for dir in ${aarch64_dirs}; do - (cd "${dir}" && docker build -t "${repo}/functest-${dir##**/}:aarch64-latest" .) - docker push "${repo}/functest-${dir##**/}:aarch64-latest" +find . -name Dockerfile -exec sed -i \ + -e "s|alpine:3.11|arm32v6/alpine:3.11|g" {} + +find . -name Dockerfile -exec sed -i \ + -e "s|opnfv/functest-core|${repo}/functest-core:arm-latest|g" {} + +find . -name Dockerfile -exec sed -i \ + -e "s|opnfv/functest-tempest|${repo}/functest-tempest:arm-latest|g" {} + +for dir in ${arm_dirs}; do + (cd "${dir}" && docker build "${build_opts[@]}" \ + -t "${repo}/functest-${dir##**/}:arm-latest" .) + docker push "${repo}/functest-${dir##**/}:arm-latest" + [ "${dir}" != "docker/core" ] && + (docker rmi "${repo}/functest-${dir##**/}:arm-latest" || true) done +[ -n "${arm_dirs}" ] && + (docker rmi "${repo}/functest-core:arm-latest" \ + arm32v6/alpine:3.11 || true) find . -name Dockerfile -exec git checkout {} + exit $?