public inbox for igt-dev@lists.freedesktop.org
 help / color / mirror / Atom feed
From: Arkadiusz Hiler <arkadiusz.hiler@intel.com>
To: igt-dev@lists.freedesktop.org
Cc: Petri Latvala <petri.latvala@intel.com>
Subject: [igt-dev] [PATCH i-g-t 7/8] .gitlab-ci: Don't pull images until they are needed
Date: Tue, 3 Sep 2019 11:38:23 +0300	[thread overview]
Message-ID: <20190903083823.31626-1-arkadiusz.hiler@intel.com> (raw)
In-Reply-To: <20190903083614.31305-1-arkadiusz.hiler@intel.com>

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>
---
 .gitlab-ci.yml                | 4 ----
 .gitlab-ci/pull-or-rebuild.sh | 6 ++++--
 Dockerfile                    | 3 ++-
 Dockerfile.build-debian       | 3 ++-
 4 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 07c9a628..c57d86c3 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -28,8 +28,6 @@ build-containers:build-debian:
   script:
     - podman login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY
     - .gitlab-ci/pull-or-rebuild.sh base Dockerfile.build-debian-minimal build-debian-minimal
-    - podman pull $CI_REGISTRY/$CI_PROJECT_PATH/build-debian-minimal:commit-$CI_COMMIT_SHA
-    - podman tag $CI_REGISTRY/$CI_PROJECT_PATH/build-debian-minimal:commit-$CI_COMMIT_SHA build-debian-minimal:commit-$CI_COMMIT_SHA
     - .gitlab-ci/pull-or-rebuild.sh base Dockerfile.build-debian build-debian
 
 build-containers:build-debian-armhf:
@@ -266,6 +264,4 @@ containers:igt:
     FORCE_REBUILD: 1
   script:
     - podman login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY
-    - podman pull $CI_REGISTRY/$CI_PROJECT_PATH/build-fedora:commit-$CI_COMMIT_SHA
-    - podman tag $CI_REGISTRY/$CI_PROJECT_PATH/build-fedora:commit-$CI_COMMIT_SHA build-fedora:commit-$CI_COMMIT_SHA
     - .gitlab-ci/pull-or-rebuild.sh igt Dockerfile igt
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
diff --git a/Dockerfile b/Dockerfile
index 6f2f62ec..2fe0e340 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -1,5 +1,6 @@
 ARG CI_COMMIT_SHA
-FROM build-fedora:commit-$CI_COMMIT_SHA
+ARG CI_REGISTRY_IMAGE
+FROM $CI_REGISTRY_IMAGE/build-fedora:commit-$CI_COMMIT_SHA
 
 COPY opt-igt /opt/igt
 COPY .gitlab-ci/docker-help.sh /usr/local/bin/docker-help.sh
diff --git a/Dockerfile.build-debian b/Dockerfile.build-debian
index de2adca6..69f63157 100644
--- a/Dockerfile.build-debian
+++ b/Dockerfile.build-debian
@@ -1,5 +1,6 @@
 ARG CI_COMMIT_SHA
-FROM build-debian-minimal:commit-$CI_COMMIT_SHA
+ARG CI_REGISTRY_IMAGE
+FROM $CI_REGISTRY_IMAGE/build-debian-minimal:commit-$CI_COMMIT_SHA
 
 RUN apt-get update
 RUN apt-get install -y \
-- 
2.21.0

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

  parent reply	other threads:[~2019-09-03  8:38 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-03  8:36 [igt-dev] [PATCH i-g-t 1/8] Dockerfile: Avoid messing with WORKDIR Arkadiusz Hiler
2019-09-03  8:36 ` [igt-dev] [PATCH i-g-t 2/8] Dockerfile: Make sure that we use correct base image Arkadiusz Hiler
2019-09-03  8:36 ` [igt-dev] [PATCH i-g-t 3/8] .gitlab-ci: Remove dead code Arkadiusz Hiler
2019-09-03  8:36 ` [igt-dev] [PATCH i-g-t 4/8] .gitalb-ci: Use only the necessary tags Arkadiusz Hiler
2019-09-03  8:36 ` [igt-dev] [PATCH i-g-t 5/8] .gitlab-ci: Switch to podman/buildah/skopeo Arkadiusz Hiler
2019-09-03  8:37 ` [igt-dev] [PATCH i-g-t 6/8] Dockerfile: Clean package manager caches and squash images Arkadiusz Hiler
2019-09-03  8:38 ` Arkadiusz Hiler [this message]
2019-09-03  8:38 ` [igt-dev] [PATCH i-g-t 8/8] .gitlab-ci: Use true --prefix Arkadiusz Hiler
2019-09-03  9:10 ` [igt-dev] ✓ Fi.CI.BAT: success for series starting with [i-g-t,1/8] Dockerfile: Avoid messing with WORKDIR Patchwork
2019-09-03  9:35 ` [igt-dev] [PATCH i-g-t 1/8] " Petri Latvala
2019-09-03 11:06   ` Arkadiusz Hiler
2019-09-03 11:41 ` [igt-dev] ✗ Fi.CI.IGT: failure for series starting with [i-g-t,1/8] " Patchwork
2019-09-03 12:46   ` Arkadiusz Hiler

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190903083823.31626-1-arkadiusz.hiler@intel.com \
    --to=arkadiusz.hiler@intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=petri.latvala@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox