From 30a34d0b5dab4381319c145bb156791eb88293e3 Mon Sep 17 00:00:00 2001 From: Jean-Paul Calderone Date: Thu, 4 Apr 2019 11:26:10 -0400 Subject: [PATCH] Move virtualenv and wheelhouse creation into the image --- .circleci/Dockerfile.debian-8 | 13 +++++++++++++ .circleci/config.yml | 12 ++++-------- 2 files changed, 17 insertions(+), 8 deletions(-) diff --git a/.circleci/Dockerfile.debian-8 b/.circleci/Dockerfile.debian-8 index 449bbf8b0..53a30831c 100644 --- a/.circleci/Dockerfile.debian-8 +++ b/.circleci/Dockerfile.debian-8 @@ -1,5 +1,9 @@ FROM debian:8 +ENV WHEELHOUSE_PATH /tmp/wheelhouse +ENV VIRTUALENV_PATH /tmp/venv +ENV BUILD_SRC_ROOT /tmp/image-build-time-source + RUN apt-get --quiet update && \ apt-get --quiet --yes install git && \ apt-get --quiet --yes install \ @@ -11,3 +15,12 @@ RUN apt-get --quiet update && \ libssl-dev \ libyaml-dev \ virtualenv + +# Get the project source. Copying in the whole project source here isn't very +# cache friendly but there's no Docker layer cache on CircleCI anyway! +COPY . ${BUILD_SRC_ROOT} + +RUN usermod --home /tmp/nobody nobody +RUN chown --recursive nobody:nogroup "${BUILD_SRC_ROOT}" +RUN sudo --set-home -u nobody "${BUILD_SRC_ROOT}"/.circleci/create-virtualenv.sh "${WHEELHOUSE_PATH}" "${VIRTUALENV_PATH}" +RUN sudo --set-home -u nobody "${BUILD_SRC_ROOT}"/.circleci/populate-wheelhouse.sh "${WHEELHOUSE_PATH}" "${VIRTUALENV_PATH}" "${BUILD_SRC_ROOT}" diff --git a/.circleci/config.yml b/.circleci/config.yml index 6741f51b8..cf4894f39 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -81,19 +81,12 @@ jobs: steps: - "checkout" - - run: &BOOTSTRAP_TEST_ENVIRONMENT - name: "Bootstrap test environment" - command: | - ~/project/.circleci/bootstrap-test-environment.sh ~/project - - run: &SETUP_VIRTUALENV name: "Setup virtualenv" # pip cannot install packages if the working directory is not # readable. working_directory: "/tmp" command: | - sudo --set-home -u nobody /tmp/project/.circleci/create-virtualenv.sh "${WHEELHOUSE_PATH}" "/tmp/tests" - sudo --set-home -u nobody /tmp/project/.circleci/populate-wheelhouse.sh "${WHEELHOUSE_PATH}" "/tmp/tests" "/tmp/project" sudo --set-home -u nobody /tmp/project/.circleci/setup-virtualenv.sh \ "${TAHOE_LAFS_TOX_ENVIRONMENT}" \ "${TAHOE_LAFS_TOX_ARGS}" @@ -180,8 +173,11 @@ jobs: steps: - "checkout" + - run: + name: "Bootstrap test environment" + command: | + ~/project/.circleci/bootstrap-test-environment.sh ~/project # DRY, YAML-style. See the debian-9 steps. - - run: *BOOTSTRAP_TEST_ENVIRONMENT - run: *SETUP_VIRTUALENV - run: name: "Install Tor"