From ae9ac191b326c6093ae7928f3bf8405d4975c1c6 Mon Sep 17 00:00:00 2001 From: Matthieu Huin Date: Feb 19 2021 11:02:55 +0000 Subject: Drop dulwich, use gerrit only --- diff --git a/tests/configure_gerrit.yml b/tests/configure_gerrit.yml index f3eeca1..bf6cf8e 100644 --- a/tests/configure_gerrit.yml +++ b/tests/configure_gerrit.yml @@ -117,7 +117,7 @@ - name: create gerrit repo import_tasks: create_gerrit_project.yml vars: - project: test-repo + project: zuul-config - name: Check if zuul user exists uri: diff --git a/tests/configure_zuul_jobs.yml b/tests/configure_zuul_jobs.yml index 8dd4a34..e1e81a6 100644 --- a/tests/configure_zuul_jobs.yml +++ b/tests/configure_zuul_jobs.yml @@ -1,55 +1,3 @@ -- name: Install dulwich - package: - name: python3-dulwich - state: present - become: true - -- name: Create a local git repository - shell: git init {{ ansible_user_dir }}/zuul-config - -- name: Create .zuul.yaml - copy: - src: zuul.yaml - dest: "{{ ansible_user_dir }}/zuul-config/.zuul.yaml" - -- name: Create my-noop.yaml - copy: - src: my-noop.yaml - dest: "{{ ansible_user_dir }}/zuul-config/my-noop.yaml" - -- name: Commit zuul-config changes - shell: "{{ item }}" - register: cmd - failed_when: - - cmd.rc != 0 - - not "'nothing to commit' in cmd.stdout" - args: - chdir: "{{ ansible_user_dir }}/zuul-config/" - loop: - - git config user.name "John Doe" - - git config user.email "john@localhost" - - git add -A . - - git commit -m"Init demo config" - -- name: Ensure dulwich down - shell: pkill -f web-daemon - ignore_errors: true - -# https://bugzilla.redhat.com/show_bug.cgi?id=1866463 -- name: Ensure dulwich running - shell: "python3 /usr/lib64/python3.9/site-packages/dulwich/cli.py web-daemon -l 0.0.0.0 / &" - -- name: Add the git connection into the zuul config - blockinfile: - path: /etc/zuul/zuul.conf - marker: "# {mark} local_git" - block: | - [connection local_git] - driver=git - baseurl=http://localhost:8000/{{ ansible_user_dir }} - poll_delay=30 - become: true - - name: Setup the Zuul default tenant to load zuul-config copy: src: main.yaml @@ -78,20 +26,20 @@ - zuul-web become: true -- name: create a patch on test-repo +- name: create a patch on zuul-config block: - name: get a checkout temp dir shell: mktemp -d register: commit_tmp - - name: checkout test-repo - shell: git clone ssh://admin@gerrit/test-repo + - name: checkout zuul-config + shell: git clone ssh://admin@gerrit/zuul-config args: chdir: "{{ commit_tmp.stdout }}" become: true - - name: patch test-repo + - name: patch zuul-config shell: executable: /bin/sh - chdir: "{{ commit_tmp.stdout }}/test-repo" + chdir: "{{ commit_tmp.stdout }}/zuul-config" cmd: | git config user.name "admin" git config user.email "admin@example.com" @@ -109,5 +57,5 @@ - name: Ensure the my-noop job was executed shell: python -c "import requests; r = requests.get('http://localhost/api/tenant/default/builds').json(); assert r[0]['job_name'] == 'my-noop'; assert r[0]['result'] == 'SUCCESS'" -- name: Ensure test-repo triggers builds - shell: python -c "import requests; r = requests.get('http://localhost/api/tenant/default/builds?project=test-repo').json(); assert len(r[0]) > 0" +- name: Ensure new patchset triggers a build + shell: python -c "import requests; r = requests.get('http://localhost/api/tenant/default/builds?pipeline=check').json(); assert len(r[0]) > 0" diff --git a/tests/create_gerrit_project.yml b/tests/create_gerrit_project.yml index 93ae24e..b0778c3 100644 --- a/tests/create_gerrit_project.yml +++ b/tests/create_gerrit_project.yml @@ -16,7 +16,7 @@ user: admin password: secret status_code: 201 - - name: Create initial commit in {{ project }} + - name: Initialize .gitreview shell: executable: /bin/sh chdir: "{{ project_tmp.stdout }}" @@ -29,6 +29,16 @@ host=gerrit project={{ project }} EOF + - name: Create .zuul.yaml + copy: + src: zuul.yaml + dest: "{{ project_tmp.stdout }}/.zuul.yaml" + + - name: Create my-noop.yaml + copy: + src: my-noop.yaml + dest: "{{ project_tmp.stdout }}/my-noop.yaml" + git add .gitreview git commit -m "Initial commit" git remote add gerrit http://admin:secret@localhost:8081/{{ project }} diff --git a/tests/main.yaml b/tests/main.yaml index cc35ba1..5beba5f 100644 --- a/tests/main.yaml +++ b/tests/main.yaml @@ -1,9 +1,6 @@ - tenant: name: default source: - local_git: + gerrit: config-projects: - zuul-config - gerrit: - untrusted-projects: - - test-repo diff --git a/tests/zuul.yaml b/tests/zuul.yaml index 9cc8b8b..eb177e4 100644 --- a/tests/zuul.yaml +++ b/tests/zuul.yaml @@ -69,8 +69,6 @@ gerrit: Verified: -2 sqlreporter: - window-floor: 20 - window-increase-factor: 2 - job: name: my-noop @@ -82,18 +80,9 @@ periodic: jobs: - my-noop - -- project-template: - name: default - queue: integrated check: jobs: - my-noop gate: jobs: - my-noop - -- project: - name: test-repo - templates: - - default