
New urllib3 and python requests break python docker-compose. Pin requests back which should use an older urllib3. Hopefully this fixes docker-compose. Note this should probably only be used as a temporary workaround. A more permanent fix should change the way we install docker-compose. Also stop relying on six since it's no longer available and we dropped Python 2.7 support quite some time back anyway. Clean up some things in tox.ini which regressed in Tox v4. Co-Authored-By: Clark Boylan <cboylan@sapwetik.org> Change-Id: I69a7ba09f737130a403f0657708877ce986f751c
107 lines
4.0 KiB
YAML
107 lines
4.0 KiB
YAML
- hosts: all
|
|
roles:
|
|
- name: ensure-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"
|
|
- name: Install jeepyb
|
|
command: python3 -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: python3 -m pip install src/opendev.org/opendev/gerritlib
|
|
become: true
|
|
|
|
# Run a gerrit
|
|
- name: Install docker-compose
|
|
pip:
|
|
name:
|
|
- requests<2.30.0
|
|
- 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 127.0.0.1 >> ~/.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 -d 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 -d
|
|
chdir: src/opendev.org/opendev/gerritlib
|
|
- name: Change test-repo-2 acls but don't change groups
|
|
# Lineinfile only replaces the last match so we do this twice
|
|
lineinfile:
|
|
path: src/opendev.org/opendev/gerritlib/tools/projects.yaml
|
|
regexp: '^ acl-config: tools/acls/test/test.config'
|
|
line: ' acl-config: tools/acls/test/test2.config'
|
|
- name: Change test-repo-1 acls but don't change groups
|
|
# Lineinfile only replaces the last match so we do this twice
|
|
lineinfile:
|
|
path: src/opendev.org/opendev/gerritlib/tools/projects.yaml
|
|
regexp: '^ acl-config: tools/acls/test/test.config'
|
|
line: ' acl-config: tools/acls/test/test2.config'
|
|
- name: Update single gerrit project with new acl
|
|
shell:
|
|
cmd: PROJECTS_INI=tools/projects.ini PROJECTS_YAML=tools/projects.yaml manage-projects -d test/test-repo-1
|
|
chdir: src/opendev.org/opendev/gerritlib
|
|
- name: Manage all gerrit projects again after acl update
|
|
shell:
|
|
cmd: PROJECTS_INI=tools/projects.ini PROJECTS_YAML=tools/projects.yaml manage-projects -d
|
|
chdir: src/opendev.org/opendev/gerritlib
|
|
- name: Check test-repo-1 exists
|
|
shell:
|
|
cmd: ssh -i tools/sshkey/admin -p 29418 admin@127.0.0.1 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@127.0.0.1 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@127.0.0.1 gerrit ls-projects | grep -v test-repo-3
|
|
chdir: src/opendev.org/opendev/gerritlib
|