d1694d4c98
By setting the auth type to DEVELOPMENT_BECOME_ANY_ACCOUNT and passing --dev to the init process, gerrit will create an initial admin user for us. We leverage this user to create a sample project, change, Zuul user and sample CI result comment. We also update testinfra to take some screenshots of gerrit and report them back. Change-Id: I56cda99790d3c172e10b664e57abeca10efc5566
85 lines
3.5 KiB
YAML
85 lines
3.5 KiB
YAML
- hosts: "review"
|
|
tasks:
|
|
|
|
- name: Wait for Gerrit to be up
|
|
uri:
|
|
url: http://localhost:8081/a/accounts/admin/sshkeys
|
|
method: GET
|
|
user: admin
|
|
password: secret
|
|
register: result
|
|
until: result.status == 200 and not result.redirected
|
|
delay: 1
|
|
retries: 120
|
|
|
|
- name: Create Zuul user
|
|
uri:
|
|
url: http://localhost:8081/a/accounts/zuul
|
|
method: PUT
|
|
user: admin
|
|
password: secret
|
|
body_format: json
|
|
body:
|
|
name: 'Zuul'
|
|
email: 'zuul@example.com'
|
|
http_password: 'secret'
|
|
status_code: 201
|
|
|
|
- name: Create temp dir for project creation
|
|
shell: mktemp -d
|
|
register: project_tmp
|
|
|
|
- name: Create project project in Gerrit
|
|
uri:
|
|
url: http://localhost:8081/a/projects/test-project
|
|
method: PUT
|
|
user: admin
|
|
password: secret
|
|
status_code: 201
|
|
|
|
- name: Create initial commit and change in test-project
|
|
shell:
|
|
executable: /bin/sh
|
|
chdir: "{{ project_tmp.stdout }}"
|
|
cmd: |
|
|
set -x
|
|
git init .
|
|
git config user.name "Admin"
|
|
git config user.email "admin@example.com"
|
|
cat >.gitreview <<EOF
|
|
[gerrit]
|
|
host=localhost
|
|
port=29418
|
|
project=project
|
|
EOF
|
|
git add .gitreview
|
|
git commit -m "Initial commit"
|
|
git remote add gerrit http://admin:secret@localhost:8081/test-project
|
|
git push -f --set-upstream gerrit +HEAD:master
|
|
|
|
curl -Lo .git/hooks/commit-msg http://localhost:8081/tools/hooks/commit-msg
|
|
chmod u+x .git/hooks/commit-msg
|
|
|
|
cat >file.txt <<EOF
|
|
Hello, this is a file
|
|
EOF
|
|
git add file.txt
|
|
git commit -m "Sample review"
|
|
git push gerrit HEAD:refs/for/master
|
|
|
|
- name: Post a sample review
|
|
uri:
|
|
url: http://localhost:8081/a/changes/1/revisions/1/review
|
|
method: POST
|
|
user: zuul
|
|
password: secret
|
|
body_format: json
|
|
body:
|
|
tag: 'autogenerated:zuul:check'
|
|
message: "Patch Set 8: Verified-1\n\nBuild failed (check pipeline). For information on how to proceed, see\nhttps://docs.opendev.org/opendev/infra-manual/latest/developers.html#automated-testing\n\n\n- system-config-puppet-apply-4-ubuntu-xenial https://zuul.opendev.org/t/openstack/build/00b1ce7d5d994339a54dd8142a6813a6 : SUCCESS in 10m 22s\n- system-config-legacy-logstash-filters https://zuul.opendev.org/t/openstack/build/20efbb1b6983453884103e9628a70942 : SUCCESS in 8m 24s\n- opendev-tox-docs https://zuul.opendev.org/t/openstack/build/43a00a7e190b4ce2b3e20a86166c011a : SUCCESS in 3m 40s\n- opendev-buildset-registry https://zuul.opendev.org/t/openstack/build/bc4a4559645b4088a9f8586c043c4764 : SUCCESS in 46m 19s\n- tox-linters https://zuul.opendev.org/t/openstack/build/cb469750b250430b95a02697931d6030 : FAILURE in 19m 14s\n- system-config-run-base https://zuul.opendev.org/t/openstack/build/0897fafc9652480794652fc49e3c9baf : SUCCESS in 12m 48s\n- system-config-run-base-ansible-devel https://zuul.opendev.org/t/openstack/build/57c4eb5174554cbfbb06fd9118eb1ae4 : SUCCESS in 16m 37s (non-voting)\n- system-config-run-gitea https://zuul.opendev.org/t/openstack/build/30afb96669fe4f19b6215e79615ecd90 : SUCCESS in 37m 58s\n- system-config-run-review https://zuul.opendev.org/t/openstack/build/76c69b8062284d959a85b55bc460f822 : FAILURE in 15m 27s"
|
|
|
|
- name: Run selenium container
|
|
include_role:
|
|
name: run-selenium
|
|
|