- 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 CI group uri: url: 'http://localhost:8081/a/groups/CI-tools' method: PUT user: admin password: secret body_format: json body: description: 'Continuous Integration Tools' status_code: 201 - 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: Add Zuul to group uri: url: 'http://localhost:8081/a/groups/CI-tools/members/zuul' method: PUT user: admin password: secret status_code: 201 - name: Get group UUID uri: url: 'http://localhost:8081/a/groups/CI-tools' method: GET user: admin password: secret status_code: 200 return_content: yes register: group_raw - name: Debug serialized json debug: var: group_raw - name: Deserialize returned data to internal variable. set_fact: # The first 4 bytes of the returned data are )]}' which is # invalid json. group_json: '{{ group_raw.content | regex_replace("^....", "") | from_json }}' - name: Debug deserialized json debug: var: group_json - name: Setup key and initial gerrit config shell: executable: /bin/bash cmd: | set -xe ssh-keygen -t ed25519 -f /root/.ssh/id_25519 -P "" curl -X POST --user "admin:secret" -H "Content-Type: text/plain" -d@/root/.ssh/id_25519.pub http://localhost:8081/a/accounts/admin/sshkeys ssh-keyscan -p 29418 localhost >> /root/.ssh/known_hosts git config --global user.name "Admin" git config --global user.email "admin@example.com" git clone http://admin:secret@localhost:8081/a/All-Projects pushd All-Projects echo "{{ group_json.id }} CI-tools" >> groups # noqa 203 git commit -a -m "Add CI-tools group" git push origin HEAD:refs/meta/config cat >> project.config << EOF [label "Verified"] function = MaxWithBlock value = -2 Fails value = -1 Doesn't seem to work value = 0 No score value = +1 Works for me value = +2 Verified [access "refs/heads/*"] label-Verified = -2..+2 group CI-tools EOF git commit -a -m 'Update verify tags' git push origin HEAD:refs/meta/config popd - 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/x%2Ftest-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 . cat >.gitreview <file-1.txt <file-2.txt <file-3.txt <