Set max_microversion for placement and volume
[functest.git] / build.sh
1 #!/bin/bash
2
3 set -e
4
5 repo=${REPO:-opnfv}
6 amd64_dirs=${amd64_dirs-"\
7 docker/core \
8 docker/tempest \
9 docker/healthcheck \
10 docker/smoke \
11 docker/benchmarking \
12 docker/features \
13 docker/components \
14 docker/vnf"}
15 arm64_dirs=${arm64_dirs-${amd64_dirs}}
16 build_opts=(--pull=true --no-cache --force-rm=true)
17
18 find . -name Dockerfile -exec sed -i \
19     -e "s|opnfv/functest-core:gambia|${repo}/functest-core:amd64-gambia|g" {} +
20 find . -name Dockerfile -exec sed -i \
21     -e "s|opnfv/functest-tempest:gambia|${repo}/functest-tempest:amd64-gambia|g" {} +
22 for dir in ${amd64_dirs}; do
23     (cd "${dir}" &&
24         docker build "${build_opts[@]}" \
25             -t "${repo}/functest-${dir##**/}:amd64-gambia" .)
26         docker push "${repo}/functest-${dir##**/}:amd64-gambia"
27     [ "${dir}" != "docker/core" ] &&
28         (docker rmi "${repo}/functest-${dir##**/}:amd64-gambia" || true)
29 done
30 [ ! -z "${amd64_dirs}" ] &&
31     (docker rmi "${repo}/functest-core:amd64-gambia" alpine:3.8 || true)
32 find . -name Dockerfile -exec git checkout {} +
33
34 find . -name Dockerfile -exec sed -i \
35     -e "s|alpine:3.8|multiarch/alpine:arm64-v3.8|g" {} +
36 find . -name Dockerfile -exec sed -i \
37     -e "s|opnfv/functest-core:gambia|${repo}/functest-core:arm64-gambia|g" {} +
38 find . -name Dockerfile -exec sed -i \
39     -e "s|opnfv/functest-tempest:gambia|${repo}/functest-tempest:arm64-gambia|g" {} +
40 for dir in ${arm64_dirs}; do
41     (cd "${dir}" && docker build "${build_opts[@]}" \
42         -t "${repo}/functest-${dir##**/}:arm64-gambia" .)
43     docker push "${repo}/functest-${dir##**/}:arm64-gambia"
44     [ "${dir}" != "docker/core" ] &&
45         (docker rmi "${repo}/functest-${dir##**/}:arm64-gambia" || true)
46 done
47 [ ! -z "${arm64_dirs}" ] &&
48     (docker rmi "${repo}/functest-core:arm64-gambia" \
49         multiarch/alpine:arm64-v3.8 || true)
50 find . -name Dockerfile -exec git checkout {} +
51
52 exit $?