From 287eecd9d2bc20c63442f455f01df3cf9b31d256 Mon Sep 17 00:00:00 2001 From: "James E. Blair" Date: Mon, 18 Feb 2019 17:20:35 -0800 Subject: [PATCH] Run zuul-preview Change-Id: Ib72e2bd29d1061822e0c16c201445115a5e5c58f --- .zuul.yaml | 18 ++++++++++++++++ inventory/groups.yaml | 2 ++ playbooks/base.yaml | 6 ++++++ playbooks/roles/zuul-preview/README.rst | 2 ++ .../zuul-preview-docker/docker-compose.yaml | 11 ++++++++++ playbooks/roles/zuul-preview/tasks/main.yaml | 13 ++++++++++++ testinfra/test_zuul_preview.py | 21 +++++++++++++++++++ 7 files changed, 73 insertions(+) create mode 100644 playbooks/roles/zuul-preview/README.rst create mode 100644 playbooks/roles/zuul-preview/files/zuul-preview-docker/docker-compose.yaml create mode 100644 playbooks/roles/zuul-preview/tasks/main.yaml create mode 100644 testinfra/test_zuul_preview.py diff --git a/.zuul.yaml b/.zuul.yaml index 33d2f04ed6..4b42522712 100644 --- a/.zuul.yaml +++ b/.zuul.yaml @@ -533,6 +533,22 @@ - testinfra/test_gitea.py - testinfra/test_gitea_lb.py +- job: + name: system-config-run-zuul-preview + parent: system-config-run + description: | + Run the playbook for the docker registry. + nodeset: + nodes: + - name: bridge.openstack.org + label: ubuntu-bionic + - name: zp01.opendev.org + label: ubuntu-bionic + files: + - .zuul.yaml + - playbooks/roles/zuul-preview/ + - testinfra/test_zuul_preview.py + - job: name: infra-prod-playbook description: | @@ -583,6 +599,7 @@ - system-config-run-docker - system-config-run-docker-registry - system-config-run-gitea + - system-config-run-zuul-preview - system-config-build-image-jinja-init - system-config-build-image-gitea-init - system-config-build-image-gitea @@ -603,6 +620,7 @@ - system-config-run-docker - system-config-run-docker-registry - system-config-run-gitea + - system-config-run-zuul-preview - system-config-upload-image-jinja-init - system-config-upload-image-gitea-init - system-config-upload-image-gitea diff --git a/inventory/groups.yaml b/inventory/groups.yaml index 9c27c1b06d..2c6d9d4cb6 100644 --- a/inventory/groups.yaml +++ b/inventory/groups.yaml @@ -253,5 +253,7 @@ groups: - ze[0-9]*.open*.org zuul-merger: - zm[0-9]*.open*.org + zuul-preview: + - zp[0-9]*.open*.org zuul-scheduler: - zuul[0-9]*.open*.org diff --git a/playbooks/base.yaml b/playbooks/base.yaml index 253ff78fdc..8f82bf2e9f 100644 --- a/playbooks/base.yaml +++ b/playbooks/base.yaml @@ -85,3 +85,9 @@ roles: - install-docker - haproxy + +- hosts: "zuul-preview:!disabled" + name: "Base: configure zuul-preview" + roles: + - install-docker + - zuul-preview diff --git a/playbooks/roles/zuul-preview/README.rst b/playbooks/roles/zuul-preview/README.rst new file mode 100644 index 0000000000..8f5540ce7d --- /dev/null +++ b/playbooks/roles/zuul-preview/README.rst @@ -0,0 +1,2 @@ +Install, configure, and run zuul-preview. + diff --git a/playbooks/roles/zuul-preview/files/zuul-preview-docker/docker-compose.yaml b/playbooks/roles/zuul-preview/files/zuul-preview-docker/docker-compose.yaml new file mode 100644 index 0000000000..3cc4cc2e8a --- /dev/null +++ b/playbooks/roles/zuul-preview/files/zuul-preview-docker/docker-compose.yaml @@ -0,0 +1,11 @@ +# Version 2 is the latest that is supported by docker-compose in +# Ubuntu Xenial. +version: '2' + +services: + zuul-preview: + restart: always + image: zuul/zuul-preview:latest + network_mode: host + environment: + ZUUL_API_URL: https://zuul.opendev.org/ diff --git a/playbooks/roles/zuul-preview/tasks/main.yaml b/playbooks/roles/zuul-preview/tasks/main.yaml new file mode 100644 index 0000000000..b55694e1c5 --- /dev/null +++ b/playbooks/roles/zuul-preview/tasks/main.yaml @@ -0,0 +1,13 @@ +- name: Synchronize docker-compose directory + synchronize: + src: zuul-preview-docker/ + dest: /etc/zuul-preview-docker/ +- name: Install docker-compose + package: + name: + - docker-compose + state: present +- name: Run docker-compose up + shell: + cmd: docker-compose up -d + chdir: /etc/zuul-preview-docker/ diff --git a/testinfra/test_zuul_preview.py b/testinfra/test_zuul_preview.py new file mode 100644 index 0000000000..599bcaa65c --- /dev/null +++ b/testinfra/test_zuul_preview.py @@ -0,0 +1,21 @@ +# Copyright 2018 Red Hat, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. + + +testinfra_hosts = ['zp01.opendev.org'] + + +def test_apache_listening(host): + apache = host.socket("tcp://0.0.0.0:80") + assert apache.is_listening