From 8bca70aadc1df8989dc03145845389447ebe4b02 Mon Sep 17 00:00:00 2001 From: "James E. Blair" Date: Mon, 15 Oct 2018 11:31:23 -0700 Subject: [PATCH] Add mysql to quick-start This allows us to show build history in the web ui. Also add a local test playbook for the quickstart which basically does what the zuul-quick-start job does, but expects to run locally on a workstation (ie, does not install the docker registry and docker). Change-Id: Id62dcf69f48399dab3d1259679bf2fc2ce50460e --- doc/source/admin/examples/docker-compose.yaml | 11 ++++++++++- doc/source/admin/examples/etc_zuul/zuul.conf | 5 +++++ .../admin/examples/zuul-config/zuul.d/pipelines.yaml | 4 ++++ playbooks/quick-start/localtest.yaml | 10 ++++++++++ playbooks/quick-start/main.yaml | 8 ++++++++ playbooks/quick-start/run.yaml | 1 + 6 files changed, 38 insertions(+), 1 deletion(-) create mode 100644 playbooks/quick-start/localtest.yaml diff --git a/doc/source/admin/examples/docker-compose.yaml b/doc/source/admin/examples/docker-compose.yaml index 67c429c76a..45efaea804 100644 --- a/doc/source/admin/examples/docker-compose.yaml +++ b/doc/source/admin/examples/docker-compose.yaml @@ -27,11 +27,19 @@ services: - "./playbooks/:/var/playbooks/" command: "ansible-playbook /var/playbooks/setup.yaml" zk: - image: zookeeper + image: zookeeper + mysql: + image: mariadb + environment: + MYSQL_ROOT_PASSWORD: rootpassword + MYSQL_DATABASE: zuul + MYSQL_USER: zuul + MYSQL_PASSWORD: secret scheduler: depends_on: - gerritconfig - zk + - mysql environment: no_proxy: "${no_proxy},gerrit" command: "sh -c 'ansible-playbook /var/playbooks/scheduler.yaml; zuul-scheduler -d'" @@ -45,6 +53,7 @@ services: command: "zuul-web -d" depends_on: - scheduler + - mysql ports: - "9000:9000" image: zuul/zuul-web diff --git a/doc/source/admin/examples/etc_zuul/zuul.conf b/doc/source/admin/examples/etc_zuul/zuul.conf index 5a4fe3e747..1bb0cf7b3e 100644 --- a/doc/source/admin/examples/etc_zuul/zuul.conf +++ b/doc/source/admin/examples/etc_zuul/zuul.conf @@ -25,6 +25,11 @@ name=zuul-ci driver=git baseurl=https://git.zuul-ci.org/ +[connection "mysql"] +name=mysql +driver=sql +dburi=mysql+pymysql://zuul:secret@mysql/zuul + [web] listen_address=0.0.0.0 diff --git a/doc/source/admin/examples/zuul-config/zuul.d/pipelines.yaml b/doc/source/admin/examples/zuul-config/zuul.d/pipelines.yaml index 0154279260..fae837c2d3 100644 --- a/doc/source/admin/examples/zuul-config/zuul.d/pipelines.yaml +++ b/doc/source/admin/examples/zuul-config/zuul.d/pipelines.yaml @@ -17,9 +17,11 @@ success: gerrit: Verified: 1 + mysql: failure: gerrit: Verified: -1 + mysql: - pipeline: name: gate @@ -46,6 +48,8 @@ gerrit: Verified: 2 submit: true + mysql: failure: gerrit: Verified: -2 + mysql: diff --git a/playbooks/quick-start/localtest.yaml b/playbooks/quick-start/localtest.yaml new file mode 100644 index 0000000000..ce0ef4362c --- /dev/null +++ b/playbooks/quick-start/localtest.yaml @@ -0,0 +1,10 @@ +- hosts: localhost + vars: + workspace: /tmp/quickstart-test + local: true + ssh_public_key: "{{ lookup('file', '~/.ssh/id_rsa.pub') }}" + ssh_agent: + stdout: '' + tasks: + - name: Run tasks in ssh agent + include_tasks: main.yaml diff --git a/playbooks/quick-start/main.yaml b/playbooks/quick-start/main.yaml index acf5fbb13b..97550ecd1b 100644 --- a/playbooks/quick-start/main.yaml +++ b/playbooks/quick-start/main.yaml @@ -1,8 +1,14 @@ - name: Run docker-compose up + when: not local shell: cmd: docker-compose up -d chdir: src/git.openstack.org/openstack-infra/zuul/doc/source/admin/examples become: true +- name: Run docker-compose up + when: local + shell: + cmd: docker-compose up -d + chdir: ../../doc/source/admin/examples - name: Wait for Gerrit to start wait_for: host: localhost @@ -18,6 +24,7 @@ delay: 1 retries: 120 - name: fetch ssh host keys from gerrit + when: not local shell: ssh-keyscan -p 29418 localhost >> ~/.ssh/known_hosts - name: Check if example user exists in Gerrit uri: @@ -49,6 +56,7 @@ shell: chdir: "{{ workspace }}/zuul-config/" executable: /bin/bash + warn: false cmd: | {{ ssh_agent.stdout }} rm zuul.d/jobs.yaml diff --git a/playbooks/quick-start/run.yaml b/playbooks/quick-start/run.yaml index e60178b8bb..12945e7ea1 100644 --- a/playbooks/quick-start/run.yaml +++ b/playbooks/quick-start/run.yaml @@ -1,6 +1,7 @@ - hosts: all vars: workspace: /tmp/quickstart-test + local: false roles: - name: install-docker use_upstream_docker: false