[igt-dev] [PATCH v3 6/6] gitlab-ci: introduce containers with IGT inside

Arkadiusz Hiler arkadiusz.hiler at intel.com
Mon Aug 26 14:01:42 UTC 2019


On Mon, Aug 26, 2019 at 04:12:48PM +0300, Oleg Vasilev wrote:
> Currently, the containers are used only to build IGT. We also want to
> have an option to run IGT inside a container. For this, new build stage
> is added.
> 
> Signed-off-by: Oleg Vasilev <oleg.vasilev at intel.com>
> ---
>  .gitlab-ci.yml           | 25 +++++++++++++++++++++++-
>  Dockerfile               | 14 ++++++++++++++
>  gitlab-ci/docker-help.sh | 41 ++++++++++++++++++++++++++++++++++++++++
>  3 files changed, 79 insertions(+), 1 deletion(-)
>  create mode 100644 Dockerfile
>  create mode 100755 gitlab-ci/docker-help.sh
> 
> diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
> index de334cf2..6e317b29 100644
> --- a/.gitlab-ci.yml
> +++ b/.gitlab-ci.yml
> @@ -16,6 +16,7 @@ stages:
>    - build
>    - test
>    - deploy
> +  - containers
>  
>  ################# BUILD CONTAINERS #######################
>  
> @@ -85,12 +86,15 @@ build-containers:build-fedora:
>  build:tests-fedora:
>    stage: build
>    script:
> -    - meson $MESON_OPTIONS build
> +    - meson --prefix=`pwd`/opt-igt $MESON_OPTIONS build
>      - ninja -C build
> +    - ninja -C build install
>      - ninja -C build igt-gpu-tools-doc
> +    - ls opt-igt
>    artifacts:
>      paths:
>        - build
> +      - opt-igt
>  
>  build:tests-fedora-no-libunwind:
>    stage: build
> @@ -273,3 +277,22 @@ pages:
>    only:
>      - master
>  
> +############## CONTAINERS ####################
> +
> +
> +containers:igt:
> +  stage: containers
> +  image: docker:stable
> +  services:
> +    - docker:dind
> +  dependencies:
> +    - build:tests-fedora
> +  variables:
> +    DOCKER_HOST: tcp://docker:2375
> +    DOCKER_DRIVER: overlay2
> +    FORCE_REBUILD: 1
> +  script:
> +    - docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY
> +    - docker pull $CI_REGISTRY/$CI_PROJECT_PATH/build-fedora:$CI_COMMIT_REF_NAME
> +    - docker tag $CI_REGISTRY/$CI_PROJECT_PATH/build-fedora:$CI_COMMIT_REF_NAME build-fedora
> +    - gitlab-ci/pull-or-rebuild.sh Dockerfile igt
> diff --git a/Dockerfile b/Dockerfile
> new file mode 100644
> index 00000000..b23b4aef
> --- /dev/null
> +++ b/Dockerfile
> @@ -0,0 +1,14 @@
> +# Version number to bump for force image rebuild: 0
> +FROM build-fedora
> +
> +RUN dnf install -y findutils && \
> +        dnf clean all
> +
> +COPY opt-igt /opt/igt
> +COPY gitlab-ci/docker-help.sh /usr/local/bin/docker-help.sh
> +
> +ENV PATH="/opt/igt/bin:${PATH}"
> +ENV LD_LIBRARY_PATH="/opt/igt/lib:/opt/igt/lib64:${LD_LIBRARY_PATH}"
> +ENV IGT_TEST_ROOT="/opt/igt/libexec/igt-gpu-tools"
> +
> +CMD docker-help.sh
> diff --git a/gitlab-ci/docker-help.sh b/gitlab-ci/docker-help.sh
> new file mode 100755
> index 00000000..0f0df179
> --- /dev/null
> +++ b/gitlab-ci/docker-help.sh
> @@ -0,0 +1,41 @@
> +#!/bin/sh
> +#
> +# Copyright © 2019 Intel Corporation
> +#
> +# Permission is hereby granted, free of charge, to any person obtaining a
> +# copy of this software and associated documentation files (the "Software"),
> +# to deal in the Software without restriction, including without limitation
> +# the rights to use, copy, modify, merge, publish, distribute, sublicense,
> +# and/or sell copies of the Software, and to permit persons to whom the
> +# Software is furnished to do so, subject to the following conditions:
> +#
> +# The above copyright notice and this permission notice (including the next
> +# paragraph) shall be included in all copies or substantial portions of the
> +# Software.
> +#
> +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
> +# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
> +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
> +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
> +# IN THE SOFTWARE.
> +
> +TEST_LIST=$(find /opt/igt/libexec/igt-gpu-tools -type f -printf "%f ")
> +cat << END
> +This is a docker container, packaged with intel-gpu-tools.
> + - IGT runner is available in PATH. In order for results to be available on a
> +   host system, the directory has to be mounted inside, e.g.
> +     docker run -v results:/tmp/results igt-final igt_runner /tmp/results
> + - Test lists are available in /opt/igt/share/igt-gpu-tools
> + - Test binaries are available in IGT_TEST_ROOT=/opt/igt/libexec.

				  in IGT_TEST_ROOT=$IGT_TEST_ROOT

with that and the ref changes menioned in the other emails - looks good to me

> +
> +In order for devices to be available inside docker container, those either
> +need to be mapped with --device or container needs to be run in --privileged
> +mode.
> +
> +Contents of /opt/igt/libexec: $TEST_LIST
> +PATH: $PATH
> +LD_LIBRARY_PATH: $LD_LIBRARY_PATH
> +IGT_TEST_ROOT: $IGT_TEST_ROOT
> +END
> -- 
> 2.23.0
> 
> _______________________________________________
> igt-dev mailing list
> igt-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/igt-dev


More information about the igt-dev mailing list