diff --git a/playbooks/roles/gerrit/defaults/main.yaml b/playbooks/roles/gerrit/defaults/main.yaml index c82db6b8da..c1cfa1f840 100644 --- a/playbooks/roles/gerrit/defaults/main.yaml +++ b/playbooks/roles/gerrit/defaults/main.yaml @@ -4,6 +4,7 @@ gerrit_home_dir: /home/gerrit2 gerrit_site_dir: "{{ gerrit_home_dir }}/review_site" gerrit_run_compose_up: false gerrit_run_init: false +gerrit_run_init_dev_mode: false gerrit_packed_git_open_files: 4096 gerrit_container_image: docker.io/opendevorg/gerrit:3.2 gerrit_container_volumes: diff --git a/playbooks/roles/gerrit/tasks/start.yaml b/playbooks/roles/gerrit/tasks/start.yaml index 33e7d399f5..f393ba8ace 100644 --- a/playbooks/roles/gerrit/tasks/start.yaml +++ b/playbooks/roles/gerrit/tasks/start.yaml @@ -2,7 +2,7 @@ shell: cmd: > docker-compose run shell - java -jar /var/gerrit/bin/gerrit.war init -d /var/gerrit -b --no-auto-start --skip-plugins --skip-all-downloads + java -jar /var/gerrit/bin/gerrit.war init -d /var/gerrit -b --no-auto-start --skip-plugins --skip-all-downloads {% if gerrit_run_init_dev_mode %} --dev {% endif %} chdir: /etc/gerrit-compose/ when: gerrit_run_init | bool diff --git a/playbooks/roles/gerrit/templates/gerrit.config.j2 b/playbooks/roles/gerrit/templates/gerrit.config.j2 index 56107ad4e0..84b4784b17 100644 --- a/playbooks/roles/gerrit/templates/gerrit.config.j2 +++ b/playbooks/roles/gerrit/templates/gerrit.config.j2 @@ -9,13 +9,17 @@ reportBugUrl = https://docs.openstack.org/infra/system-config/project.html#contributing gitHttpUrl = https://{{ gerrit_vhost_name }}/ serverId = {{ gerrit_serverid }} +{% if not gerrit_run_init_dev_mode %} [auth] contributorAgreements = true type = OPENID_SSO cookieSecure = true enableRunAs = true openIdSsoUrl = https://login.ubuntu.com/+openid - +{% else %} +[auth] + type = DEVELOPMENT_BECOME_ANY_ACCOUNT +{% endif %} [sendemail] smtpServer = localhost from = MIXED diff --git a/playbooks/test-review.yaml b/playbooks/test-review.yaml new file mode 100644 index 0000000000..1d7ef3d577 --- /dev/null +++ b/playbooks/test-review.yaml @@ -0,0 +1,84 @@ +- 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 <file.txt <