debian: --cache avoid pulling builder images
Changed the "--cache" option to skip pulling images that already exist locally. Otherwise a locally-built image would be overwritten by a downloaded one. TESTS =============================== Call the script with various permutations of --cache & --rebuild, with & without deleting cached images prior. Story: 2009897 Task: 45225 Signed-off-by: Davlet Panech <davlet.panech@windriver.com> Change-Id: I37435d3d7a6d1a20b87794530cc937d759674685
This commit is contained in:
parent
011af73b11
commit
c7e4e6b236
19
stx-init-env
19
stx-init-env
@ -18,10 +18,12 @@ Initialize StarlingX build environment & (re-)start builder pods
|
|||||||
--rebuild[=IMG,...]
|
--rebuild[=IMG,...]
|
||||||
build specified pod images instead of downloading them
|
build specified pod images instead of downloading them
|
||||||
|
|
||||||
--cache allow docker to use its filesystem cache (with --rebuild)
|
--cache when rebuilding, allow docker to use its filesystem cache
|
||||||
CAUTION: this option may not pick up all the changes to
|
when pulling, skip images that already exist locally
|
||||||
docker source files and is meant for debugging
|
|
||||||
the build scripts.
|
CAUTION: this option may not pick up all the changes to
|
||||||
|
docker source files and is meant for debugging
|
||||||
|
the build scripts.
|
||||||
|
|
||||||
END
|
END
|
||||||
}
|
}
|
||||||
@ -281,20 +283,21 @@ fi
|
|||||||
# Pull images that we didn't rebuild
|
# Pull images that we didn't rebuild
|
||||||
PULL_DOCKER_IMAGES=$(
|
PULL_DOCKER_IMAGES=$(
|
||||||
for img in ${DOCKER_IMAGES} ; do
|
for img in ${DOCKER_IMAGES} ; do
|
||||||
found=no
|
built=no
|
||||||
for build_img in ${BUILD_DOCKER_IMAGES} ; do
|
for build_img in ${BUILD_DOCKER_IMAGES} ; do
|
||||||
if [[ "$img" == "$build_img" ]] ; then
|
if [[ "$img" == "$build_img" ]] ; then
|
||||||
found=yes
|
built=yes
|
||||||
break
|
break
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
if [[ "$found" != "yes" ]] ; then
|
if [[ "$built" != "yes" ]] && \
|
||||||
|
{ [[ "$USE_DOCKER_CACHE" != 1 ]] || ! docker image inspect ${img}:${DOCKER_TAG_LOCAL} >/dev/null 2>&1 ; } ; then
|
||||||
echo "$img"
|
echo "$img"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
)
|
)
|
||||||
if [[ -n "$PULL_DOCKER_IMAGES" ]] ; then
|
if [[ -n "$PULL_DOCKER_IMAGES" ]] ; then
|
||||||
notice "Pulling docker images"
|
notice "Pulling docker images: "$PULL_DOCKER_IMAGES
|
||||||
for img in $PULL_DOCKER_IMAGES; do
|
for img in $PULL_DOCKER_IMAGES; do
|
||||||
docker pull ${DOCKER_PREFIX}${img}:${DOCKER_TAG} || exit 1
|
docker pull ${DOCKER_PREFIX}${img}:${DOCKER_TAG} || exit 1
|
||||||
docker tag ${DOCKER_PREFIX}${img}:${DOCKER_TAG} ${img}:${DOCKER_TAG_LOCAL} || exit 1
|
docker tag ${DOCKER_PREFIX}${img}:${DOCKER_TAG} ${img}:${DOCKER_TAG_LOCAL} || exit 1
|
||||||
|
Loading…
x
Reference in New Issue
Block a user