
This adds integration testing to gerritlib with jeepyb and gerrit. Depends-On: https://review.opendev.org/704660 Change-Id: I1815e63693656d52c10a9cb9bf60f999e036dfed
87 lines
2.9 KiB
YAML
87 lines
2.9 KiB
YAML
- hosts: all
|
|
roles:
|
|
- name: install-docker
|
|
tasks:
|
|
# Configure Jeepyb and Gerritlib
|
|
- name: Create jeepyb git directory
|
|
file:
|
|
state: directory
|
|
path: "/tmp/jeepyb-git"
|
|
- name: Create jeepyb cache directory
|
|
file:
|
|
state: directory
|
|
path: "/tmp/jeepyb-cache"
|
|
# TODO(clarkb) add python3 version of job
|
|
- name: Install jeepyb
|
|
command: python2 -m pip install src/opendev.org/opendev/jeepyb
|
|
become: true
|
|
- name: Install gerritlib
|
|
# Install after Jeepyb so that we don't use gerritlib from pypi
|
|
command: python2 -m pip install src/opendev.org/opendev/gerritlib
|
|
become: true
|
|
|
|
# Run a gerrit
|
|
- name: Install docker-compose
|
|
package:
|
|
name:
|
|
- docker-compose
|
|
state: present
|
|
become: true
|
|
- name: Run docker-compose up
|
|
shell:
|
|
cmd: docker-compose up -d
|
|
chdir: src/opendev.org/opendev/gerritlib/tools/
|
|
- name: Wait for Gerrit Admin user to be created
|
|
uri:
|
|
url: http://localhost:8080/a/accounts/admin/sshkeys
|
|
method: GET
|
|
user: admin
|
|
password: secret
|
|
register: result
|
|
until: result.status == 200 and result.redirected == false
|
|
delay: 1
|
|
retries: 120
|
|
- name: fetch ssh host keys from gerrit
|
|
shell: ssh-keyscan -p 29418 localhost >> ~/.ssh/known_hosts
|
|
|
|
- name: Set perms on new ssh private key
|
|
become: true
|
|
file:
|
|
path: src/opendev.org/opendev/gerritlib/tools/sshkey/admin
|
|
owner: zuul
|
|
group: zuul
|
|
- name: Set perms on new ssh public key
|
|
become: true
|
|
file:
|
|
path: src/opendev.org/opendev/gerritlib/tools/sshkey/admin.pub
|
|
owner: zuul
|
|
group: zuul
|
|
|
|
# Configure git
|
|
- name: Set git user name
|
|
command: git config --global user.name Zuul
|
|
- name: Set git user email
|
|
command: git config --global user.email admin@example.com
|
|
|
|
# Test jeepyb and gerritlib
|
|
- name: Manage single gerrit project
|
|
shell:
|
|
cmd: PROJECTS_INI=tools/projects.ini PROJECTS_YAML=tools/projects.yaml manage-projects -v test/test-repo-1
|
|
chdir: src/opendev.org/opendev/gerritlib
|
|
- name: Manage all gerrit projects
|
|
shell:
|
|
cmd: PROJECTS_INI=tools/projects.ini PROJECTS_YAML=tools/projects.yaml manage-projects -v
|
|
chdir: src/opendev.org/opendev/gerritlib
|
|
- name: Check test-repo-1 exists
|
|
shell:
|
|
cmd: ssh -i tools/sshkey/admin -p 29418 admin@localhost gerrit ls-projects | grep test-repo-1
|
|
chdir: src/opendev.org/opendev/gerritlib
|
|
- name: Check test-repo-2 exists
|
|
shell:
|
|
cmd: ssh -i tools/sshkey/admin -p 29418 admin@localhost gerrit ls-projects | grep test-repo-2
|
|
chdir: src/opendev.org/opendev/gerritlib
|
|
- name: Check test-repo-3 does not exist
|
|
shell:
|
|
cmd: ssh -i tools/sshkey/admin -p 29418 admin@localhost gerrit ls-projects | grep -v test-repo-3
|
|
chdir: src/opendev.org/opendev/gerritlib
|