diff options
author | Arkadiusz Hiler <arkadiusz.hiler@intel.com> | 2019-09-02 10:35:56 +0300 |
---|---|---|
committer | Arkadiusz Hiler <arkadiusz.hiler@intel.com> | 2019-09-03 18:26:53 +0300 |
commit | 764c858dd5362058ce865c178dc2f19bb8809e70 (patch) | |
tree | c578321d7e8073861852cc3e1a3debe6e9d9930a /.gitlab-ci | |
parent | dc2ba64f8965f8e7db5db49b8260dbfc5834faa5 (diff) |
.gitlab-ci: Switch to podman/buildah/skopeo
The current setup uses docker-inside-docker setup which seems to fail
quite often:
WARNING: Service runner-HnMPegeT-project-3185-concurrent-0-docker-0 probably didn't start properly.
Using docker image XYZ for docker:stable ...
ERROR: Job failed (system failure): Error response from daemon: No such container: XYZ (executor_docker.go:743:0s)
Switching over to buildah (invoked via podman - docker's drop-in
replacement) everything will happen locally without the need to engage
any daemons, which should make the build more reliable.
We force using docker format for the containers as only the very latest
docker can understand OCI and it does not have widespread adoption yet.
Buildah can also use chroot for isolation which simplifies network
handling for nested containers and have a potential of being a tad bit
faster.
To query remotes and manage remote tags we can use skopeo, which saves
us from pulling full images from the remote without an actual need.
Fixes: https://gitlab.freedesktop.org/freedesktop/freedesktop/issues/187
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.sh | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/.gitlab-ci/pull-or-rebuild.sh b/.gitlab-ci/pull-or-rebuild.sh index 3f00e831..3d71e821 100755 --- a/.gitlab-ci/pull-or-rebuild.sh +++ b/.gitlab-ci/pull-or-rebuild.sh @@ -36,28 +36,26 @@ COMMITNAME=$IMAGENAME:commit-$CI_COMMIT_SHA if [ "$TYPE" = "base" ]; then # base container (building, etc) - we rebuild only if changed or forced - docker pull $DOCKERNAME + skopeo inspect docker://$DOCKERNAME IMAGE_PRESENT=$? set -e if [ $IMAGE_PRESENT -eq 0 ] && [ ${FORCE_REBUILD:-0} -eq 0 ] ; then echo "Skipping, already built" - docker tag $DOCKERNAME $COMMITNAME else echo "Building!" - docker build --build-arg=CI_COMMIT_SHA=$CI_COMMIT_SHA \ - -t $DOCKERNAME -t $COMMITNAME -f $DOCKERFILE . - docker push $DOCKERNAME - fi - docker push $COMMITNAME + podman build --build-arg=CI_COMMIT_SHA=$CI_COMMIT_SHA -t $DOCKERNAME -f $DOCKERFILE . + podman push $DOCKERNAME + fi + + skopeo copy docker://$DOCKERNAME docker://$COMMITNAME elif [ "$TYPE" = "igt" ]; then # container with IGT, we don't care about Dockerfile changes # we always rebuild set -e - docker build --build-arg=CI_COMMIT_SHA=$CI_COMMIT_SHA \ - -t $REFNAME -t $COMMITNAME -f $DOCKERFILE . - docker push $REFNAME - docker push $COMMITNAME + podman build --build-arg=CI_COMMIT_SHA=$CI_COMMIT_SHA -t $COMMITNAME -f $DOCKERFILE . + podman push $COMMITNAME + skopeo copy docker://$COMMITNAME docker://$REFNAME else echo "unknown build type $TYPE" exit 1 |