From fb967c4ce3b2972379274ff179a5f4986017d336 Mon Sep 17 00:00:00 2001 From: Zack Cerza Date: Fri, 1 Apr 2022 14:02:05 -0400 Subject: [PATCH] docker-compose: Use repo root as build context Rather than add more logic to support things like cloning different forks of the repo, let's just not clone at all. Signed-off-by: Zack Cerza --- docs/docker-compose/README.md | 7 ++----- docs/docker-compose/docker-compose.yml | 3 ++- docs/docker-compose/start.sh | 11 ----------- docs/docker-compose/teuthology/Dockerfile | 13 +++++++------ 4 files changed, 11 insertions(+), 23 deletions(-) diff --git a/docs/docker-compose/README.md b/docs/docker-compose/README.md index f7d0a8809b..eae95c8361 100644 --- a/docs/docker-compose/README.md +++ b/docs/docker-compose/README.md @@ -14,6 +14,8 @@ Currently, there are two modes of execution: * Advantage: Can run all Ceph tests * Disadvantage: Requires lab access +In both cases, the teuthology container will be built with code from the repository clone that's currently in use. + ## Prerequisites ### Installing and Running Docker @@ -66,11 +68,6 @@ This repo will be cloned locally, using your existing `git` configuration, and c ## Running Tests -If you want the teuthology container to use a different teuthology branch: -```bash -export TEUTHOLOGY_BRANCH=my-branch -``` - When you are ready to run tests: ```bash ./start.sh diff --git a/docs/docker-compose/docker-compose.yml b/docs/docker-compose/docker-compose.yml index a170752207..1a049efd4f 100644 --- a/docs/docker-compose/docker-compose.yml +++ b/docs/docker-compose/docker-compose.yml @@ -60,7 +60,8 @@ services: - "11300:11300" teuthology: build: - context: ./teuthology + context: ../../ + dockerfile: ./docs/docker-compose/teuthology/Dockerfile args: SSH_PRIVKEY_FILE: $SSH_PRIVKEY_FILE depends_on: diff --git a/docs/docker-compose/start.sh b/docs/docker-compose/start.sh index a408892d6a..0c9ba89b6e 100755 --- a/docs/docker-compose/start.sh +++ b/docs/docker-compose/start.sh @@ -1,16 +1,5 @@ #!/bin/bash set -e -pushd teuthology -if [ -z "$TEUTHOLOGY_BRANCH" -a -n "$GITHUB_HEAD_REF" ]; then - TEUTHOLOGY_BRANCH=${GITHUB_HEAD_REF} -fi -if [ ! -d ./teuthology ]; then - git clone \ - --depth 1 \ - -b ${TEUTHOLOGY_BRANCH:-$(git branch --show-current)} \ - https://github.com/ceph/teuthology.git -fi -popd if [ -n "$ANSIBLE_INVENTORY_REPO" ]; then basename=$(basename $ANSIBLE_INVENTORY_REPO | cut -d. -f1) if [ ! -d "$basename" ]; then diff --git a/docs/docker-compose/teuthology/Dockerfile b/docs/docker-compose/teuthology/Dockerfile index fcc9341a60..06fb5a3f8b 100644 --- a/docs/docker-compose/teuthology/Dockerfile +++ b/docs/docker-compose/teuthology/Dockerfile @@ -19,22 +19,23 @@ RUN apt-get update && \ lsb-release && \ apt-get clean all WORKDIR /teuthology -COPY teuthology /teuthology +COPY . /teuthology RUN \ cd /teuthology && \ mkdir ../archive_dir && \ mkdir log && \ chmod +x /teuthology/bootstrap && \ - ./bootstrap -COPY containerized_node.yaml /teuthology -COPY .teuthology.yaml /root + VENV=$VENV ./bootstrap +COPY docs/docker-compose/teuthology/containerized_node.yaml /teuthology +COPY docs/docker-compose/teuthology/.teuthology.yaml /root RUN \ mkdir $HOME/.ssh && \ touch $HOME/.ssh/${SSH_PRIVKEY_FILE} && \ chmod 600 $HOME/.ssh/${SSH_PRIVKEY_FILE} && \ echo "StrictHostKeyChecking=no" > $HOME/.ssh/config && \ echo "UserKnownHostsFile=/dev/null" >> $HOME/.ssh/config -COPY teuthology.sh / +COPY docs/docker-compose/teuthology/teuthology.sh / RUN mkdir -p /etc/ansible -COPY ansible_inventory/hosts ansible_inventory/secrets /etc/ansible/ +COPY docs/docker-compose/teuthology/ansible_inventory/hosts /etc/ansible/ +COPY docs/docker-compose/teuthology/ansible_inventory/secrets /etc/ansible/ ENTRYPOINT /teuthology.sh \ No newline at end of file -- 2.39.5