summaryrefslogtreecommitdiff
path: root/.gitlab-ci
diff options
context:
space:
mode:
authorArkadiusz Hiler <arkadiusz.hiler@intel.com>2019-09-03 10:57:14 +0300
committerArkadiusz Hiler <arkadiusz.hiler@intel.com>2019-09-03 18:27:01 +0300
commit72cdaf6aadc16c42651722b8db71efc673da2b06 (patch)
tree81678b812bdff804acc286c8a7a15235ccbe44be /.gitlab-ci
parent3bf2fc3dfbbbd5a6f5ff0fc8b417ee25e0f338b9 (diff)
.gitlab-ci: Don't pull images until they are needed
We were pulling and tagging images locally ahead of time just in case the next build may need it (i.e. debian-minimal for the fully featured debian). Instead of doing that we can specify the registry in Dockerfile's FROM cluse, so the image is pulled only when we are need it. Signed-off-by: Arkadiusz Hiler <arkadiusz.hiler@intel.com> Reviewed-by: Petri Latvala <petri.latvala@intel.com>
Diffstat (limited to '.gitlab-ci')
-rwxr-xr-x.gitlab-ci/pull-or-rebuild.sh6
1 files changed, 4 insertions, 2 deletions
diff --git a/.gitlab-ci/pull-or-rebuild.sh b/.gitlab-ci/pull-or-rebuild.sh
index 7b3bb84c..a9409db8 100755
--- a/.gitlab-ci/pull-or-rebuild.sh
+++ b/.gitlab-ci/pull-or-rebuild.sh
@@ -34,6 +34,8 @@ REFNAME=$IMAGENAME:$REF
DOCKERNAME=$IMAGENAME:dockerfile-$DOCKERFILE_CHECKSUM
COMMITNAME=$IMAGENAME:commit-$CI_COMMIT_SHA
+PODMAN_BUILD="podman build --build-arg=CI_COMMIT_SHA=$CI_COMMIT_SHA --build-arg=CI_REGISTRY_IMAGE=$CI_REGISTRY_IMAGE"
+
if [ "$TYPE" = "base" ]; then
# base container (building, etc) - we rebuild only if changed or forced
skopeo inspect docker://$DOCKERNAME
@@ -44,7 +46,7 @@ if [ "$TYPE" = "base" ]; then
echo "Skipping, already built"
else
echo "Building!"
- podman build --squash --build-arg=CI_COMMIT_SHA=$CI_COMMIT_SHA -t $DOCKERNAME -f $DOCKERFILE .
+ $PODMAN_BUILD --squash -t $DOCKERNAME -f $DOCKERFILE .
podman push $DOCKERNAME
fi
@@ -53,7 +55,7 @@ elif [ "$TYPE" = "igt" ]; then
# container with IGT, we don't care about Dockerfile changes
# we always rebuild
set -e
- podman build --build-arg=CI_COMMIT_SHA=$CI_COMMIT_SHA -t $COMMITNAME -f $DOCKERFILE .
+ $PODMAN_BUILD -t $COMMITNAME -f $DOCKERFILE .
podman push $COMMITNAME
skopeo copy docker://$COMMITNAME docker://$REFNAME
else