Change image build logic
* Implement pre-build.sh
Due our CI strategy, its kinda hard to fetch all resources
during docker build stage.
split logic to:
pre-build.sh - script, will be ran by jenkins,
with ssh-agent wrapper
extra/build.sh - script, will be ran during docker build
* Merge RUN into one step, to reduce layer amount
* Fix 'tempest' dependency - always isntall from local
copy
Revert "Add authorization for gerrit repositories"
This reverts commit 920ac7ce0c2b9a67bdc9186cd5e75b0b2b93ed22.
Change-Id: I2edf0c6e337eef21b8f8f1d6c2f1636ccde60932
diff --git a/Dockerfile b/Dockerfile
index b0c5587..07d3671 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -1,29 +1,27 @@
FROM ubuntu:16.04
LABEL maintainer="qa@mirantis.com"
-ARG TEMPEST_TAG="mcp/pike"
-# Tempest plugins
-ARG HORIZON_TAG="mcp/pike"
-ARG BARBICAN_TAG="mcp/pike"
-ARG DESIGNATE_TAG="mcp/pike"
-ARG HEAT_TAG="mcp/pike"
-ARG IRONIC_TAG="mcp/pike"
-ARG MANILA_TAG="mcp/pike"
-ARG TELEMETRY_TAG="mcp/pike"
-ARG OCTAVIA_TAG="mcp/pike"
-ARG PATROLE_TAG="0.4.x"
-ARG TUNGSTEN_TAG="0.1.x"
-# global openstack requirements repo
-# This is the commit where tempest version is 17.2.0 in u-c
-ARG UPPER_CONSTRAINTS_TAG="83b1de74834fbcdbe749e270c29e76cdc28f85d5"
-
ENV DEBIAN_FRONTEND=noninteractive \
DEBCONF_NONINTERACTIVE_SEEN=true \
LANG=C.UTF-8 \
- LANGUAGE=$LANG
-SHELL ["/bin/bash", "-xec"]
+ LANGUAGE=$LANG \
+ LOG_DIR='/root/tempest'
+SHELL ["/bin/bash", "-o", "pipefail", "-xec"]
USER root
-# pre-update
+ADD data /var/lib/
+
+COPY extra/build.sh /
+COPY bin/entrypoint.sh /usr/bin/
+COPY bin/run_tempest.sh /usr/bin/run-tempest
+COPY bin/opencontrail/policy.json /etc/opencontrail/policy.json
+COPY bin/skiplists /var/lib/tempest/skiplists
+
+# Patch junitxml library to include skipped tests in the test report totals header
+COPY bin/patches/junitxml_init.patch /var/lib/junitxml_init.patch
+
+# Patch os_testr library to fix issue ralated with tempest black-list option
+COPY bin/patches/regex_builder.patch /var/lib/regex_builder.patch
+
RUN cd /etc/apt/ && echo > sources.list \
&& echo "deb [arch=amd64] http://cz.archive.ubuntu.com/ubuntu xenial main restricted universe multiverse" >> sources.list \
&& echo "deb [arch=amd64] http://cz.archive.ubuntu.com/ubuntu xenial-updates main restricted universe multiverse" >> sources.list \
@@ -32,108 +30,24 @@
&& echo 'Acquire::GzipIndexes "true"; Acquire::CompressionTypes::Order:: "gz";' > apt.conf.d/docker-gzip-indexes \
&& echo 'APT::Get::Install-Recommends "false"; APT::Get::Install-Suggests "false";' > apt.conf.d/docker-recommends \
&& apt-get update && apt-get upgrade -y \
- && apt-get install -y vim-tiny git-core python-pip libffi-dev libssl-dev python-dev python3-dev iputils-ping patch openssh-server
-
-RUN mkdir -p /root/.ssh
-COPY bin/ssh/config /root/.ssh/
-COPY bin/ssh/mcp-jenkins.key /root/.ssh/
-RUN chmod 400 /root/.ssh/mcp-jenkins.key
-
+ && apt-get install -y vim-tiny git-core python-pip libffi-dev libssl-dev python-dev python3-dev iputils-ping patch \
#Due to upstream bug we should use fixed version of pip
-RUN pip install -U 'pip==9.0.3'
-WORKDIR /var/lib/
-# TODO migrate to downstrem mirror?
-RUN git clone https://github.com/openstack/requirements.git openstack_requirements && \
- pushd openstack_requirements; git checkout $UPPER_CONSTRAINTS_TAG; popd ;
+ && pip install -U 'pip==18.0' \
+# Do main stuff
+ && /build.sh buildme \
+# Cleanup
+ && apt-get -y purge libx11-data xauth libxmuu1 libxcb1 libx11-6 libxext6 \
+ ppp pppconfig pppoeconf popularity-contest cpp gcc g++ libssl-doc \
+ && apt-get -y autoremove; apt-get -y clean \
+ && rm -rf /root/.cache \
+ && rm -rf /var/lib/apt/lists/*
-RUN sed -i -e 's|tempest===17.2.0|git+ssh://mcp-jenkins@gerrit.mcp.mirantis.com:29418/packaging/sources/tempest@mcp/pike#egg=tempest|g' \
- /var/lib/openstack_requirements/upper-constraints.txt;
-RUN git clone ssh://mcp-jenkins@gerrit.mcp.mirantis.com:29418/packaging/sources/tempest-horizon tempest-horizon-plugin; \
- pushd tempest-horizon-plugin ; git checkout $HORIZON_TAG; \
- pip install --constraint /var/lib/openstack_requirements/upper-constraints.txt -r requirements.txt ; \
- popd;
+RUN patch /usr/local/lib/python2.7/dist-packages/junitxml/__init__.py /var/lib/junitxml_init.patch
+RUN patch /usr/local/lib/python2.7/dist-packages/os_testr/regex_builder.py /var/lib/regex_builder.patch
-RUN git clone ssh://mcp-jenkins@gerrit.mcp.mirantis.com:29418/packaging/sources/barbican-tempest-plugin && \
- pushd barbican-tempest-plugin; git checkout $BARBICAN_TAG; \
- pip install --constraint /var/lib/openstack_requirements/upper-constraints.txt -r requirements.txt . ; \
- popd;
-
-RUN git clone ssh://mcp-jenkins@gerrit.mcp.mirantis.com:29418/packaging/sources/designate-tempest-plugin && \
- pushd designate-tempest-plugin; git checkout $DESIGNATE_TAG; \
- pip install --constraint /var/lib/openstack_requirements/upper-constraints.txt -r requirements.txt . ; \
- popd;
-
-RUN git clone ssh://mcp-jenkins@gerrit.mcp.mirantis.com:29418/packaging/sources/heat-tempest-plugin && \
- pushd heat-tempest-plugin; git checkout $HEAT_TAG; \
- pip install --constraint /var/lib/openstack_requirements/upper-constraints.txt -r requirements.txt . ; \
- popd;
-
-RUN git clone ssh://mcp-jenkins@gerrit.mcp.mirantis.com:29418/packaging/sources/ironic-tempest-plugin && \
- pushd ironic-tempest-plugin; git checkout $IRONIC_TAG; \
- pip install --constraint /var/lib/openstack_requirements/upper-constraints.txt -r requirements.txt . ; \
- popd;
-
-RUN git clone ssh://mcp-jenkins@gerrit.mcp.mirantis.com:29418/packaging/sources/manila-tempest-plugin && \
- pushd manila-tempest-plugin; git checkout $MANILA_TAG; \
- pip install --constraint /var/lib/openstack_requirements/upper-constraints.txt -r requirements.txt . ; \
- popd;
-
-RUN git clone ssh://mcp-jenkins@gerrit.mcp.mirantis.com:29418/packaging/sources/telemetry-tempest-plugin && \
- pushd telemetry-tempest-plugin; git checkout $TELEMETRY_TAG; \
- pip install --constraint /var/lib/openstack_requirements/upper-constraints.txt -r requirements.txt . ; \
- popd;
-
-RUN git clone ssh://mcp-jenkins@gerrit.mcp.mirantis.com:29418/packaging/sources/octavia-tempest-plugin && \
- pushd octavia-tempest-plugin; git checkout $OCTAVIA_TAG; \
- pip install --constraint /var/lib/openstack_requirements/upper-constraints.txt -r requirements.txt . ; \
- popd;
-
-RUN git clone ssh://mcp-jenkins@gerrit.mcp.mirantis.com:29418/packaging/sources/patrole patrole-tempest-plugin ; \
- pushd /var/lib/patrole-tempest-plugin; git checkout $PATROLE_TAG; \
- pip install --constraint /var/lib/openstack_requirements/upper-constraints.txt -r requirements.txt . ; \
- popd;
-
-RUN git clone ssh://mcp-jenkins@gerrit.mcp.mirantis.com:29418/contrail/tungsten-tempest tungsten-tempest-plugin ; \
- pushd /var/lib/tungsten-tempest-plugin; git checkout $TUNGSTEN_TAG; \
- pip install --constraint /var/lib/openstack_requirements/upper-constraints.txt -r requirements.txt . ; \
- popd;
-
-RUN git clone ssh://mcp-jenkins@gerrit.mcp.mirantis.com:29418/packaging/sources/tempest && \
- pushd tempest; git checkout $TEMPEST_TAG; \
- pip install --constraint /var/lib/openstack_requirements/upper-constraints.txt -r requirements.txt ; \
- pip install . ; popd;
-
-RUN pip install junitxml
-# Patch junitxml library to include skipped tests in the test report totals header
-COPY bin/patches/junitxml_init.patch /tmp/junitxml_init.patch
-RUN patch /usr/local/lib/python2.7/dist-packages/junitxml/__init__.py /tmp/junitxml_init.patch
-
-# Patch os_testr library to fix issue ralated with tempest black-list option
-COPY bin/patches/regex_builder.patch /tmp/regex_builder.patch
-RUN patch /usr/local/lib/python2.7/dist-packages/os_testr/regex_builder.py /tmp/regex_builder.patch
-
-# Cleanup.
-RUN apt-get -y purge libx11-data xauth libxmuu1 libxcb1 libx11-6 libxext6 \
- ppp pppconfig pppoeconf popularity-contest cpp gcc g++ libssl-doc
-RUN apt-get -y autoremove; apt-get -y clean;
-RUN rm -rf /root/.cache
-RUN rm -rf /var/lib/apt/lists/*
-RUN rm -rf /root/.ssh
-
-RUN echo "BUILD_TIMESTAMP=$(date '+%Y-%m-%d-%H-%M-%S' -u)" > /etc/build_timestamp
-
-#
-COPY bin/entrypoint.sh /usr/bin/entrypoint.sh
-COPY bin/run_tempest.sh /usr/bin/run-tempest
-COPY bin/opencontrail/policy.json /etc/opencontrail/policy.json
-
-ENV LOG_DIR='/root/tempest'
-
-COPY bin/skiplists /var/lib/tempest/skiplists
WORKDIR /var/lib/tempest/
ENTRYPOINT ["/usr/bin/entrypoint.sh"]
-# Build
-# docker build -t docker-ci-tempest:$(date "+%Y_%m_%d_%H_%M_%S") .
+# docker build --no-cache -t docker-ci-tempest:$(date "+%Y_%m_%d_%H_%M_%S") .