Browse Source

Merge "Create a job to run Tobiko tests from a Docker container"

changes/39/822539/6
Zuul 5 months ago committed by Gerrit Code Review
parent
commit
c1ee187865
  1. 9
      playbooks/docker/pre.yaml
  2. 7
      playbooks/docker/run.yaml
  3. 8
      roles/tobiko-docker-compose/defaults/main.yaml
  4. 8
      roles/tobiko-docker-compose/tasks/build.yaml
  5. 3
      roles/tobiko-docker-compose/tasks/main.yaml
  6. 8
      roles/tobiko-docker-compose/tasks/run.yaml
  7. 3
      roles/tobiko-ensure-docker-compose/defaults/main.yaml
  8. 17
      roles/tobiko-ensure-docker-compose/tasks/main.yaml
  9. 41
      zuul.d/docker.yaml
  10. 1
      zuul.d/project.yaml

9
playbooks/docker/pre.yaml

@ -0,0 +1,9 @@
---
- hosts: all
roles:
- role: ensure-docker
- role: tobiko-ensure-docker-compose
- role: tobiko-docker-compose
vars:
docker_compose_command: build

7
playbooks/docker/run.yaml

@ -0,0 +1,7 @@
---
- hosts: all
roles:
- role: tobiko-docker-compose
vars:
docker_compose_command: run

8
roles/tobiko-docker-compose/defaults/main.yaml

@ -0,0 +1,8 @@
---
docker_compose_command: run
docker_compose_dir: '{{ zuul_work_dir }}'
docker_compose_environment: {}
docker_compose_executable: /usr/local/bin/docker-compose
zuul_work_dir: "{{ zuul.project.src_dir }}"

8
roles/tobiko-docker-compose/tasks/build.yaml

@ -0,0 +1,8 @@
---
- name: "Build image for service {{ docker_compose_service }} at {{ docker_compose_dir }}"
command:
chdir: '{{ docker_compose_dir }}'
cmd: '{{ docker_compose_executable }} build {{ docker_compose_service }}'
register: docker_compose_build
environment: '{{ docker_compose_environment }}'

3
roles/tobiko-docker-compose/tasks/main.yaml

@ -0,0 +1,3 @@
---
- include_tasks: '{{ docker_compose_command }}.yaml'

8
roles/tobiko-docker-compose/tasks/run.yaml

@ -0,0 +1,8 @@
---
- name: "Run service {{ docker_compose_service }} at {{ docker_compose_dir }}"
command:
chdir: '{{ docker_compose_dir }}'
cmd: '{{ docker_compose_executable }} run {{ docker_compose_service }}'
register: docker_compose_run
environment: '{{ docker_compose_environment }}'

3
roles/tobiko-ensure-docker-compose/defaults/main.yaml

@ -0,0 +1,3 @@
---
docker_compose_executable: /usr/local/bin/docker-compose

17
roles/tobiko-ensure-docker-compose/tasks/main.yaml

@ -0,0 +1,17 @@
---
- name: "Install latest Docker compose"
become: true
shell: |
set -x
VERSION=$(
git ls-remote https://github.com/docker/compose |
grep refs/tags |
grep -oE "[0-9]+\.[0-9][0-9]+\.[0-9]+$" |
sort --version-sort |
tail -n 1)
ARCH=$(uname -s)-$(uname -m)
URL=https://github.com/docker/compose/releases/download/${VERSION}/docker-compose-${ARCH}
mkdir -p $(dirname '{{ docker_compose_executable }}')
curl -L ${URL} > '{{ docker_compose_executable }}'
chmod +x '{{ docker_compose_executable }}'

41
zuul.d/docker.yaml

@ -0,0 +1,41 @@
---
- project-template:
name: tobiko-docker
description: |
Docker jobs intended to gate Tobiko container related changes
check: &CHECK
jobs:
- tobiko-docker-unit
- tobiko-docker-functional
gate:
jobs:
- tobiko-docker-unit
periodic: *CHECK
# ----------------------------------------------------------------------------
- job:
name: tobiko-docker-unit
description: |
Run unit tests for an OpenStack Python project inside a Docker container.
voting: true
parent: base
timeout: 2400
pre-run: playbooks/docker/pre.yaml
run: playbooks/docker/run.yaml
# post-run: playbooks/docker/post.yaml
vars:
docker_compose_service: unit
- job:
name: tobiko-docker-functional
description: |
Run functional tests for an OpenStack Python project inside a Docker container.
voting: false
parent: tobiko-docker-unit
timeout: 3600
vars:
docker_compose_service: functional

1
zuul.d/project.yaml

@ -19,6 +19,7 @@
- openstack-lower-constraints-jobs
- openstack-python3-wallaby-jobs
- publish-to-pypi
- tobiko-docker
- tobiko-infrared
vars:
rtd_webhook_id: '84947'

Loading…
Cancel
Save