diff --git a/playbooks/test-review.yaml b/playbooks/test-review.yaml index 1d7ef3d577..9913161374 100644 --- a/playbooks/test-review.yaml +++ b/playbooks/test-review.yaml @@ -12,6 +12,17 @@ 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 @@ -25,6 +36,75 @@ 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 @@ -43,9 +123,8 @@ chdir: "{{ project_tmp.stdout }}" cmd: | set -x + git init . - git config user.name "Admin" - git config user.email "admin@example.com" cat >.gitreview <file.txt <file-1.txt <file-2.txt <file-3.txt <