From: Zack Cerza Date: Mon, 28 Mar 2022 21:05:37 +0000 (-0600) Subject: docker-compose: Separate build contexts X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=267f0c11cd385ff8653c9aad2edc31d751b84395;p=teuthology.git docker-compose: Separate build contexts Signed-off-by: Zack Cerza --- diff --git a/docs/docker-compose/.teuthology.yaml b/docs/docker-compose/.teuthology.yaml deleted file mode 100644 index bac8ec1aaf..0000000000 --- a/docs/docker-compose/.teuthology.yaml +++ /dev/null @@ -1,9 +0,0 @@ -queue_host: beanstalk -queue_port: 11300 -lock_server: http://paddles:8080 -results_server: http://paddles:8080 -results_ui_server: http://pulpito:8081/ -teuthology_path: /teuthology -archive_base: /archive_dir -reserve_machines: 0 -lab_domain: '' \ No newline at end of file diff --git a/docs/docker-compose/Dockerfile b/docs/docker-compose/Dockerfile deleted file mode 100644 index 11d6deeb6e..0000000000 --- a/docs/docker-compose/Dockerfile +++ /dev/null @@ -1,37 +0,0 @@ -FROM ubuntu:latest -ARG SSH_PRIVKEY_FILE=id_ed25519 -ENV DEBIAN_FRONTEND=noninteractive -RUN apt-get update && \ - apt-get install -y \ - git \ - qemu-utils \ - python3-dev \ - libssl-dev \ - ipmitool \ - python3-pip \ - python3-virtualenv \ - vim \ - libev-dev \ - libvirt-dev \ - libffi-dev \ - libyaml-dev \ - lsb-release && \ - apt-get clean all -COPY . /teuthology -COPY .teuthology.yaml ./root -WORKDIR /teuthology -RUN \ - mkdir ../archive_dir && \ - mkdir log && \ - chmod +x /teuthology/bootstrap && \ - ./bootstrap -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 / -RUN mkdir -p /etc/ansible -COPY ansible_inventory/hosts ansible_inventory/secrets /etc/ansible/ -ENTRYPOINT /teuthology.sh \ No newline at end of file diff --git a/docs/docker-compose/Dockerfile-testnode b/docs/docker-compose/Dockerfile-testnode deleted file mode 100644 index f09ba09dc5..0000000000 --- a/docs/docker-compose/Dockerfile-testnode +++ /dev/null @@ -1,26 +0,0 @@ -FROM ubuntu:latest -ENV DEBIAN_FRONTEND=noninteractive -RUN apt update && \ - apt -y install \ - sudo \ - openssh-server \ - hostname \ - curl \ - python3-pip \ - apache2 \ - nfs-kernel-server && \ - apt clean all -COPY testnode_start.sh / -COPY testnode_stop.sh / -COPY testnode_sudoers /etc/sudoers.d/teuthology -RUN \ - ssh-keygen -t dsa -f /etc/ssh/ssh_host_dsa_key -N '' && \ - sed -i 's/#PermitRootLogin yes/PermitRootLogin yes/' /etc/ssh/sshd_config && \ - mkdir -p /root/.ssh && \ - chmod 700 /root/.ssh && \ - useradd -g sudo ubuntu && \ - mkdir -p /home/ubuntu/.ssh && \ - chmod 700 /home/ubuntu/.ssh && \ - chown -R ubuntu /home/ubuntu -EXPOSE 22 -ENTRYPOINT /testnode_start.sh \ No newline at end of file diff --git a/docs/docker-compose/containerized_node.yaml b/docs/docker-compose/containerized_node.yaml deleted file mode 100644 index 02304886c4..0000000000 --- a/docs/docker-compose/containerized_node.yaml +++ /dev/null @@ -1,8 +0,0 @@ -overrides: - ansible.cephlab: - skip_tags: "timezone,nagios,monitoring-scripts,ssh,hostname,pubkeys,zap,sudoers,kerberos,selinux,lvm,ntp-client,resolvconf,packages,cpan,nfs" - vars: - containerized_node: true - ansible_user: root - cm_user: root - start_rpcbind: false diff --git a/docs/docker-compose/docker-compose.yml b/docs/docker-compose/docker-compose.yml index df8477ac02..1ef829e400 100644 --- a/docs/docker-compose/docker-compose.yml +++ b/docs/docker-compose/docker-compose.yml @@ -76,8 +76,8 @@ services: TESTNODES: testnode: build: - context: . - dockerfile: ./Dockerfile-testnode + context: ./testnode + dockerfile: ./Dockerfile deploy: replicas: 3 depends_on: diff --git a/docs/docker-compose/start.sh b/docs/docker-compose/start.sh index 3d812c6a90..32deb153dd 100755 --- a/docs/docker-compose/start.sh +++ b/docs/docker-compose/start.sh @@ -1,5 +1,6 @@ #!/bin/bash set -e +pushd teuthology if [ -z "$TEUTHOLOGY_BRANCH" -a -n "$GITHUB_HEAD_REF" ]; then TEUTHOLOGY_BRANCH=${GITHUB_HEAD_REF} fi @@ -9,6 +10,7 @@ if [ ! -d ./teuthology ]; then -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 @@ -26,16 +28,10 @@ fi # Dockerfile does not cause a build failure when not using this feature. mkdir -p teuthology/ansible_inventory/hosts teuthology/ansible_inventory/secrets -cp .teuthology.yaml teuthology/ -cp Dockerfile teuthology/ -cp teuthology.sh teuthology/ -cp containerized_node.yaml teuthology/ if [ -n "$CUSTOM_CONF" ]; then cp "$CUSTOM_CONF" teuthology/ fi - - # Generate an SSH keypair to use if necessary if [ -z "$SSH_PRIVKEY_PATH" ]; then SSH_PRIVKEY_PATH=$(mktemp -u /tmp/teuthology-ssh-key-XXXXXX) diff --git a/docs/docker-compose/testnode/Dockerfile b/docs/docker-compose/testnode/Dockerfile new file mode 100644 index 0000000000..f09ba09dc5 --- /dev/null +++ b/docs/docker-compose/testnode/Dockerfile @@ -0,0 +1,26 @@ +FROM ubuntu:latest +ENV DEBIAN_FRONTEND=noninteractive +RUN apt update && \ + apt -y install \ + sudo \ + openssh-server \ + hostname \ + curl \ + python3-pip \ + apache2 \ + nfs-kernel-server && \ + apt clean all +COPY testnode_start.sh / +COPY testnode_stop.sh / +COPY testnode_sudoers /etc/sudoers.d/teuthology +RUN \ + ssh-keygen -t dsa -f /etc/ssh/ssh_host_dsa_key -N '' && \ + sed -i 's/#PermitRootLogin yes/PermitRootLogin yes/' /etc/ssh/sshd_config && \ + mkdir -p /root/.ssh && \ + chmod 700 /root/.ssh && \ + useradd -g sudo ubuntu && \ + mkdir -p /home/ubuntu/.ssh && \ + chmod 700 /home/ubuntu/.ssh && \ + chown -R ubuntu /home/ubuntu +EXPOSE 22 +ENTRYPOINT /testnode_start.sh \ No newline at end of file diff --git a/docs/docker-compose/testnode/testnode_start.sh b/docs/docker-compose/testnode/testnode_start.sh new file mode 100755 index 0000000000..d29c3b6d0a --- /dev/null +++ b/docs/docker-compose/testnode/testnode_start.sh @@ -0,0 +1,13 @@ +#!/usr/bin/bash +set -x +echo "$SSH_PUBKEY" > /root/.ssh/authorized_keys +echo "$SSH_PUBKEY" > /home/ubuntu/.ssh/authorized_keys +chown ubuntu /home/ubuntu/.ssh/authorized_keys +payload="{\"name\": \"$(hostname)\", \"machine_type\": \"testnode\", \"up\": true, \"locked\": false, \"os_type\": \"ubuntu\", \"os_version\": \"20.04\"}" +for i in $(seq 1 5); do + echo "attempt $i" + curl -v -f -d "$payload" http://paddles:8080/nodes/ && break + sleep 1 +done +mkdir -p /run/sshd +exec /usr/sbin/sshd -D diff --git a/docs/docker-compose/testnode/testnode_stop.sh b/docs/docker-compose/testnode/testnode_stop.sh new file mode 100755 index 0000000000..2e1044d807 --- /dev/null +++ b/docs/docker-compose/testnode/testnode_stop.sh @@ -0,0 +1,10 @@ +#!/usr/bin/bash +set -x +hostname=$(hostname) +payload="{\"name\": \"$hostname\", \"machine_type\": \"testnode\", \"up\": false}" +for i in $(seq 1 5); do + echo "attempt $i" + curl -s -f -X PUT -d "$payload" http://paddles:8080/nodes/$hostname/ && break + sleep 1 +done +pkill sshd \ No newline at end of file diff --git a/docs/docker-compose/testnode/testnode_sudoers b/docs/docker-compose/testnode/testnode_sudoers new file mode 100644 index 0000000000..35828ad9be --- /dev/null +++ b/docs/docker-compose/testnode/testnode_sudoers @@ -0,0 +1,4 @@ +%sudo ALL=(ALL) NOPASSWD: ALL +# For ansible pipelining +Defaults !requiretty +Defaults visiblepw diff --git a/docs/docker-compose/testnode_start.sh b/docs/docker-compose/testnode_start.sh deleted file mode 100755 index d29c3b6d0a..0000000000 --- a/docs/docker-compose/testnode_start.sh +++ /dev/null @@ -1,13 +0,0 @@ -#!/usr/bin/bash -set -x -echo "$SSH_PUBKEY" > /root/.ssh/authorized_keys -echo "$SSH_PUBKEY" > /home/ubuntu/.ssh/authorized_keys -chown ubuntu /home/ubuntu/.ssh/authorized_keys -payload="{\"name\": \"$(hostname)\", \"machine_type\": \"testnode\", \"up\": true, \"locked\": false, \"os_type\": \"ubuntu\", \"os_version\": \"20.04\"}" -for i in $(seq 1 5); do - echo "attempt $i" - curl -v -f -d "$payload" http://paddles:8080/nodes/ && break - sleep 1 -done -mkdir -p /run/sshd -exec /usr/sbin/sshd -D diff --git a/docs/docker-compose/testnode_stop.sh b/docs/docker-compose/testnode_stop.sh deleted file mode 100755 index 2e1044d807..0000000000 --- a/docs/docker-compose/testnode_stop.sh +++ /dev/null @@ -1,10 +0,0 @@ -#!/usr/bin/bash -set -x -hostname=$(hostname) -payload="{\"name\": \"$hostname\", \"machine_type\": \"testnode\", \"up\": false}" -for i in $(seq 1 5); do - echo "attempt $i" - curl -s -f -X PUT -d "$payload" http://paddles:8080/nodes/$hostname/ && break - sleep 1 -done -pkill sshd \ No newline at end of file diff --git a/docs/docker-compose/testnode_sudoers b/docs/docker-compose/testnode_sudoers deleted file mode 100644 index 35828ad9be..0000000000 --- a/docs/docker-compose/testnode_sudoers +++ /dev/null @@ -1,4 +0,0 @@ -%sudo ALL=(ALL) NOPASSWD: ALL -# For ansible pipelining -Defaults !requiretty -Defaults visiblepw diff --git a/docs/docker-compose/teuthology.sh b/docs/docker-compose/teuthology.sh deleted file mode 100755 index edc377b54e..0000000000 --- a/docs/docker-compose/teuthology.sh +++ /dev/null @@ -1,36 +0,0 @@ -#!/usr/bin/bash -# We don't want -x yet, in case the private key is sensitive -if [ -n "$SSH_PRIVKEY_FILE" ]; then - echo "$SSH_PRIVKEY" > $HOME/.ssh/$SSH_PRIVKEY_FILE -fi -source /teuthology/virtualenv/bin/activate -set -x -if [ -n "$TESTNODES" ]; then - for node in $(echo $TESTNODES | tr , ' '); do - teuthology-update-inventory -m $MACHINE_TYPE $node - done - CUSTOM_CONF=${CUSTOM_CONF:-} -else - CUSTOM_CONF=/teuthology/containerized_node.yaml -fi -export MACHINE_TYPE=${MACHINE_TYPE:-testnode} -teuthology-suite -v \ - --ceph-repo https://github.com/ceph/ceph.git \ - --suite-repo https://github.com/ceph/ceph.git \ - -c master \ - -m $MACHINE_TYPE \ - --limit 1 \ - -n 100 \ - --suite teuthology:no-ceph \ - --filter-out "libcephfs,kclient,stream,centos,rhel" \ - -d ubuntu -D 20.04 \ - --suite-branch master \ - --subset 9000/100000 \ - -p 75 \ - --seed 349 \ - --force-priority \ - $CUSTOM_CONF -teuthology-dispatcher -v \ - --log-dir /teuthology/log \ - --tube $MACHINE_TYPE \ - --exit-on-empty-queue \ No newline at end of file diff --git a/docs/docker-compose/teuthology/.teuthology.yaml b/docs/docker-compose/teuthology/.teuthology.yaml new file mode 100644 index 0000000000..bac8ec1aaf --- /dev/null +++ b/docs/docker-compose/teuthology/.teuthology.yaml @@ -0,0 +1,9 @@ +queue_host: beanstalk +queue_port: 11300 +lock_server: http://paddles:8080 +results_server: http://paddles:8080 +results_ui_server: http://pulpito:8081/ +teuthology_path: /teuthology +archive_base: /archive_dir +reserve_machines: 0 +lab_domain: '' \ No newline at end of file diff --git a/docs/docker-compose/teuthology/Dockerfile b/docs/docker-compose/teuthology/Dockerfile new file mode 100644 index 0000000000..5c9285f5f4 --- /dev/null +++ b/docs/docker-compose/teuthology/Dockerfile @@ -0,0 +1,39 @@ +FROM ubuntu:latest +ARG SSH_PRIVKEY_FILE=id_ed25519 +ENV DEBIAN_FRONTEND=noninteractive +RUN apt-get update && \ + apt-get install -y \ + git \ + qemu-utils \ + python3-dev \ + libssl-dev \ + ipmitool \ + python3-pip \ + python3-virtualenv \ + vim \ + libev-dev \ + libvirt-dev \ + libffi-dev \ + libyaml-dev \ + lsb-release && \ + apt-get clean all +WORKDIR /teuthology +COPY teuthology /teuthology +RUN \ + cd /teuthology && \ + mkdir ../archive_dir && \ + mkdir log && \ + chmod +x /teuthology/bootstrap && \ + ./bootstrap +COPY containerized_node.yaml /teuthology +COPY .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 / +RUN mkdir -p /etc/ansible +COPY ansible_inventory/hosts ansible_inventory/secrets /etc/ansible/ +ENTRYPOINT /teuthology.sh \ No newline at end of file diff --git a/docs/docker-compose/teuthology/containerized_node.yaml b/docs/docker-compose/teuthology/containerized_node.yaml new file mode 100644 index 0000000000..02304886c4 --- /dev/null +++ b/docs/docker-compose/teuthology/containerized_node.yaml @@ -0,0 +1,8 @@ +overrides: + ansible.cephlab: + skip_tags: "timezone,nagios,monitoring-scripts,ssh,hostname,pubkeys,zap,sudoers,kerberos,selinux,lvm,ntp-client,resolvconf,packages,cpan,nfs" + vars: + containerized_node: true + ansible_user: root + cm_user: root + start_rpcbind: false diff --git a/docs/docker-compose/teuthology/teuthology.sh b/docs/docker-compose/teuthology/teuthology.sh new file mode 100755 index 0000000000..edc377b54e --- /dev/null +++ b/docs/docker-compose/teuthology/teuthology.sh @@ -0,0 +1,36 @@ +#!/usr/bin/bash +# We don't want -x yet, in case the private key is sensitive +if [ -n "$SSH_PRIVKEY_FILE" ]; then + echo "$SSH_PRIVKEY" > $HOME/.ssh/$SSH_PRIVKEY_FILE +fi +source /teuthology/virtualenv/bin/activate +set -x +if [ -n "$TESTNODES" ]; then + for node in $(echo $TESTNODES | tr , ' '); do + teuthology-update-inventory -m $MACHINE_TYPE $node + done + CUSTOM_CONF=${CUSTOM_CONF:-} +else + CUSTOM_CONF=/teuthology/containerized_node.yaml +fi +export MACHINE_TYPE=${MACHINE_TYPE:-testnode} +teuthology-suite -v \ + --ceph-repo https://github.com/ceph/ceph.git \ + --suite-repo https://github.com/ceph/ceph.git \ + -c master \ + -m $MACHINE_TYPE \ + --limit 1 \ + -n 100 \ + --suite teuthology:no-ceph \ + --filter-out "libcephfs,kclient,stream,centos,rhel" \ + -d ubuntu -D 20.04 \ + --suite-branch master \ + --subset 9000/100000 \ + -p 75 \ + --seed 349 \ + --force-priority \ + $CUSTOM_CONF +teuthology-dispatcher -v \ + --log-dir /teuthology/log \ + --tube $MACHINE_TYPE \ + --exit-on-empty-queue \ No newline at end of file