From 6ed91972b1314b37f00487aefa8ca07dcf500a20 Mon Sep 17 00:00:00 2001 From: Alexander Lutay Date: Tue, 2 Jan 2018 17:36:12 +0100 Subject: [PATCH] TT#29356 Add Jessie based Dockerfile for Jenkins tap-tests It is a popular test, trying to keep the small Docker image size. The image will be used to migrate all Jenkins tap-tests to Docker. It will unblock the nodes "jenkins-slave*" migration to Debian stretch. Later we will be able to switch jenkins on "NGCP release specific Docker images" (using Docker tags like we do for all other Docker images) and then upgrade Docker image to Debian stretch in trunk (while we still be able to keep jessie for some Git repos in case of emergency). The script checkbashisms.pl extracted manually because the package "devscripts" has too big dependencies list which increases the Docker image size three times (till ~600Mb). Also we have to use "/code/source" while normally we have just "/code" because tap_tool_dispatcher from jenkins-debian-glue is strict to the folder name: > if ! [ -d source ] ; then > echo "Error: no source directory found, please run inside Jenkins." >&2 > exit 1 >fi Change-Id: I21fb5c088db3f2966b2e374647061059dda11329 --- t/tap-tests-docker/Dockerfile | 47 +++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 t/tap-tests-docker/Dockerfile diff --git a/t/tap-tests-docker/Dockerfile b/t/tap-tests-docker/Dockerfile new file mode 100644 index 0000000..4f2d158 --- /dev/null +++ b/t/tap-tests-docker/Dockerfile @@ -0,0 +1,47 @@ +# DOCKER_NAME=jenkins-tap-test-jessie +FROM docker.mgm.sipwise.com/sipwise-jessie:latest + +# Important! Update this no-op ENV variable when this Dockerfile +# is updated with the current date. It will force refresh of all +# of the base images and things like `apt-get update` won't be using +# old cached versions when the Dockerfile is built. +ENV REFRESHED_AT 2018-01-03 + +RUN echo "# generated by Dockerfile from jenkins-tap-test-jessie at $(date)\n\ +deb https://deb.sipwise.com/autobuild/ internal-jessie main\n" > /etc/apt/sources.list.d/sipwise-internal.list + +RUN apt-get update && apt-get install --assume-yes --no-install-recommends \ + shellcheck pep8 libperl-critic-perl ruby jenkins-debian-glue parallel \ + file binutils xz-utils && \ + apt-get clean + +# The package devscripts has a huge list of dependencies and +# we need checkbashisms scipt only, providing it manually +RUN mkdir /tmp/zzz && cd /tmp/zzz && \ +apt-get download devscripts && \ +ar x devscripts_*.deb && \ +tar -C / -p -xvf data.tar.xz ./usr/bin/checkbashisms && \ +rm -rf /tmp/zzz + +RUN echo 'SHELL=bash WORKSPACE=/code/ /usr/bin/tap_tool_dispatcher' >>/root/.bash_history + +WORKDIR /code/ + +################################################################################ +# Instructions for usage +# ---------------------- +# When you want to build the base image from scratch +# (jump to the next section if you don't want to build yourself!): +# NOTE: run the following command from root folder of git repository: +# +# % docker build --tag="jenkins-tap-test-jessie" -f t/tap-tests-docker/Dockerfile . +# % docker run --rm -i -t -v $(pwd):/code/source:rw jenkins-tap-test-jessie:latest bash +# +# Use the existing docker image: +# % docker pull docker.mgm.sipwise.com/jenkins-tap-test-jessie +# % docker run --rm -i -t -v $(pwd):/code/source:rw docker.mgm.sipwise.com/jenkins-tap-test-jessie:latest bash +# +# Inside docker (the command is in history, just press UP button): +# SHELL=bash WORKSPACE=/code/ /usr/bin/tap_tool_dispatcher +# +################################################################################