From 5c6b3411b7fd54311e09f8b50a393961d4b82fd3 Mon Sep 17 00:00:00 2001 From: Monty Taylor Date: Thu, 11 Jul 2019 10:23:41 -0400 Subject: [PATCH] Run actual full project creation in gitea test Add the full remote_puppet_git playbook that we actually use in production so that we can test the whole kit and caboodle. For now don't add a review.o.o server to the mix, because we aren't testing anything about it. Change-Id: If1112a363e96148c06f8edf1e3adeaa45fc7271c --- .zuul.yaml | 2 + playbooks/remote_puppet_git.yaml | 3 +- .../library/gitea_create_repos.py | 4 +- playbooks/roles/gitea/tasks/main.yaml | 8 +--- playbooks/test-gitea.yaml | 38 +++---------------- 5 files changed, 14 insertions(+), 41 deletions(-) diff --git a/.zuul.yaml b/.zuul.yaml index 716e4452ff..ba2e566c1e 100644 --- a/.zuul.yaml +++ b/.zuul.yaml @@ -614,6 +614,7 @@ description: | Run the playbook for the gitea servers. dependencies: opendev-buildset-registry + timeout: 3600 nodeset: nodes: - name: bridge.openstack.org @@ -625,6 +626,7 @@ vars: run_playbooks: - playbooks/service-gitea-lb.yaml + - playbooks/remote_puppet_git.yaml run_test_playbook: playbooks/test-gitea.yaml host-vars: gitea01.opendev.org: diff --git a/playbooks/remote_puppet_git.yaml b/playbooks/remote_puppet_git.yaml index 2f9bfcb948..3ea1abeb07 100644 --- a/playbooks/remote_puppet_git.yaml +++ b/playbooks/remote_puppet_git.yaml @@ -27,8 +27,7 @@ strategy: free max_fail_percentage: 1 roles: - - role: gitea-git-repos - project_config_ref: "{{ hostvars.localhost.gitinfo.after }}" + - gitea-git-repos - hosts: "review:!disabled" name: "Puppet-git: Run puppet on the Gerrit server" diff --git a/playbooks/roles/gitea-git-repos/library/gitea_create_repos.py b/playbooks/roles/gitea-git-repos/library/gitea_create_repos.py index 7f0492eb6b..2681985716 100755 --- a/playbooks/roles/gitea-git-repos/library/gitea_create_repos.py +++ b/playbooks/roles/gitea-git-repos/library/gitea_create_repos.py @@ -14,6 +14,7 @@ # License for the specific language governing permissions and limitations # under the License. +import datetime import time import requests import urllib.parse @@ -38,7 +39,8 @@ class Gitea(object): self._log = [] def log(self, *args): - self._log.append(" ".join(args)) + now = datetime.datetime.utcnow().isoformat() + self._log.append(" ".join((now,) + args)) def get_log(self): return "\n".join(self._log) diff --git a/playbooks/roles/gitea/tasks/main.yaml b/playbooks/roles/gitea/tasks/main.yaml index 7e51a49a9a..879ea07c22 100644 --- a/playbooks/roles/gitea/tasks/main.yaml +++ b/playbooks/roles/gitea/tasks/main.yaml @@ -32,15 +32,11 @@ template: src: app.ini.j2 dest: /var/gitea/conf/app.ini -- name: Install requests - package: - name: - - python3-requests - state: present -- name: Install docker-compose +- name: Install distro packages package: name: - docker-compose + - python3-requests state: present - name: Run docker-compose pull shell: diff --git a/playbooks/test-gitea.yaml b/playbooks/test-gitea.yaml index 252bcc5e7a..54e48b1aea 100644 --- a/playbooks/test-gitea.yaml +++ b/playbooks/test-gitea.yaml @@ -1,38 +1,12 @@ -- hosts: "localhost" - name: "Setup test project data" - vars: - projects: - - project: opendev/base-jobs - description: Zuul configuration common to all OpenDev tenants - tasks: - - name: Create test project-config directory - file: - path: "/opt/project-config/gerrit/" - state: directory - - name: Write test project configuration - copy: - dest: "/opt/project-config/gerrit/projects.yaml" - content: "{{ projects }}" - -# TODO(mordred) This should be part of the service, once we refactor -# the project creation and are running remote_puppet_git. -- hosts: "gitea" - name: "Install and configure gitea" - roles: - - install-docker - - gitea - -- hosts: "gitea" - name: "Create repos on gitea servers" - strategy: free - max_fail_percentage: 1 - roles: - - role: gitea-git-repos - - hosts: "gitea" tasks: - - name: Test project was created in gitea + - name: Test base jobs project was created in gitea uri: url: "https://localhost:3000/opendev/base-jobs" validate_certs: false status_code: 200 + - name: Test zuul project was created in gitea + uri: + url: "https://localhost:3000/zuul/zuul" + validate_certs: false + status_code: 200