diff --git a/doc/developer/howtos/index.md b/doc/developer/howtos/index.md index 034e446e..40fad465 100644 --- a/doc/developer/howtos/index.md +++ b/doc/developer/howtos/index.md @@ -34,21 +34,10 @@ This Prometheus instance is configured to collect metrics from a deployed Softwa ## How to open a review on the test Gerrit -First checkout the **config** repository. - -```sh -# Get the Gerrit admin user API key -gerrit_admin_api_key=$(./tools/get-secret.sh gerrit-admin-api-key) -# Then checkout the config repository -git -c http.sslVerify=false clone "https://admin:${gerrit_admin_api_key}@gerrit.sfop.me/a/config" /tmp/config -cd /tmp/config -git config http.sslverify false -git remote add gerrit "https://admin:${gerrit_admin_api_key}@gerrit.sfop.me/a/config" -``` - -Then add a change and send the review: +The checkout of the **config** repository is done by the `dev prepare` command. ```sh +cd deploy/config touch myfile git add myfile && git commit -m"Add myfile" git review diff --git a/playbooks/group_vars/all.yaml b/playbooks/group_vars/all.yaml index 8924603b..482cf260 100644 --- a/playbooks/group_vars/all.yaml +++ b/playbooks/group_vars/all.yaml @@ -1,5 +1,5 @@ --- -config_path: /tmp/config +config_path: "{{ zuul.project.src_dir }}/deploy/config" fqdn: sfop.me validate_certs: false diff --git a/roles/health-check/config-update-nodepool-builder/tasks/main.yaml b/roles/health-check/config-update-nodepool-builder/tasks/main.yaml index 7f067cca..c7382c10 100644 --- a/roles/health-check/config-update-nodepool-builder/tasks/main.yaml +++ b/roles/health-check/config-update-nodepool-builder/tasks/main.yaml @@ -24,7 +24,7 @@ args: chdir: "{{ config_path }}" loop: - - "git add {{ config_path }}/nodepool/nodepool-builder.yaml" + - "git add nodepool/nodepool-builder.yaml" - "git commit -m 'Add nodepool/nodepool-builder.yaml'" - ansible.builtin.include_role: @@ -126,9 +126,9 @@ args: chdir: "{{ config_path }}" loop: - - "git add {{ config_path }}/nodepool/nodepool-builder.yaml" - - "git add {{ config_path }}/nodepool/dib-ansible/dummy.yaml" - - "git add {{ config_path }}/nodepool/dib-ansible/inventory.yaml" + - "git add nodepool/nodepool-builder.yaml" + - "git add nodepool/dib-ansible/dummy.yaml" + - "git add nodepool/dib-ansible/inventory.yaml" - "git commit -m 'Add nodepool builder image config'" - name: Update config repo change @@ -163,4 +163,4 @@ kubectl exec nodepool-builder-0 -- bash -c "grep 'in callback plugin' /var/lib/nodepool/builds/logs/*" register: timestamp_error failed_when: timestamp_error is success - ignore_errors: true \ No newline at end of file + ignore_errors: true diff --git a/roles/health-check/config-update-nodepool-launcher/tasks/main.yaml b/roles/health-check/config-update-nodepool-launcher/tasks/main.yaml index 1ad3610d..644201a0 100644 --- a/roles/health-check/config-update-nodepool-launcher/tasks/main.yaml +++ b/roles/health-check/config-update-nodepool-launcher/tasks/main.yaml @@ -21,7 +21,7 @@ args: chdir: "{{ config_path }}" loop: - - "git add {{ config_path }}/nodepool/nodepool.yaml" + - "git add nodepool/nodepool.yaml" - "git commit -m 'Add nodepool/nodepool.yaml'" - ansible.builtin.include_role: @@ -113,7 +113,7 @@ args: chdir: "{{ config_path }}" loop: - - "git add {{ config_path }}/nodepool/nodepool.yaml" + - "git add nodepool/nodepool.yaml" - "git commit -m 'Add nodepool/nodepool.yaml'" - name: Update config repo change diff --git a/roles/health-check/config-update-zuul/tasks/main.yaml b/roles/health-check/config-update-zuul/tasks/main.yaml index e6802813..d5f720c5 100644 --- a/roles/health-check/config-update-zuul/tasks/main.yaml +++ b/roles/health-check/config-update-zuul/tasks/main.yaml @@ -32,8 +32,8 @@ args: chdir: "{{ config_path }}" loop: - - "git add {{ config_path }}/zuul/main.yaml" - - "git commit -m 'Add {{ config_path }}/zuul/main.yaml'" + - "git add zuul/main.yaml" + - "git commit -m 'Add zuul/main.yaml'" - ansible.builtin.include_role: name: "health-check/config-repo-submit-change" @@ -58,7 +58,7 @@ args: chdir: "{{ config_path }}" loop: - - "git add {{ config_path }}/zuul/main.yaml" + - "git add zuul/main.yaml" - "git commit --amend --no-edit" - name: Submit change and verify Zuul console output diff --git a/roles/run-tests/tasks/main.yaml b/roles/run-tests/tasks/main.yaml index e38135ff..7a50e9dc 100644 --- a/roles/run-tests/tasks/main.yaml +++ b/roles/run-tests/tasks/main.yaml @@ -12,7 +12,7 @@ when: "{{ mode == 'standalone' }}" - name: utils/manage-hosts - name: utils/get-gerrit-admin-user-api-key - - name: utils/config-repo-get-or-reset + - name: utils/config-repo-reset loop_control: loop_var: role diff --git a/roles/utils/config-repo-get-or-reset/tasks/main.yml b/roles/utils/config-repo-get-or-reset/tasks/main.yml deleted file mode 100644 index cb94a34a..00000000 --- a/roles/utils/config-repo-get-or-reset/tasks/main.yml +++ /dev/null @@ -1,56 +0,0 @@ ---- -- name: Reset config_path checkout and update to origin/master - block: - - name: Set required facts - ansible.builtin.set_fact: - config_url: "https://admin:{{ gerrit_admin_api_key }}@{{ gerrit_host }}/a/config" - - - name: "Ensure dir is not available {{ config_path }}" - ansible.builtin.file: - path: "{{ config_path }}" - state: absent - - - name: Clone config repo - ansible.builtin.command: "git -c http.sslVerify={{ validate_certs }} clone {{ config_url }} {{ config_path }}" - tags: - - skip_ansible_lint - - - name: Config repo, ensure config repo cert is trusted - ansible.builtin.command: git config http.sslverify {{ validate_certs }} - args: - chdir: "{{ config_path }}" - tags: - - skip_ansible_lint - - - name: Config repo, add git remote - ansible.builtin.command: "git remote add gerrit {{ config_url }}" - args: - chdir: "{{ config_path }}" - tags: - - skip_ansible_lint - - - name: Config repo, set user - ansible.builtin.command: "{{ git_user }}" - args: - chdir: "{{ config_path }}" - loop: - - git config user.email "admin@{{ fqdn }}" - - git config user.name "admin" - loop_control: - loop_var: git_user - tags: - - skip_ansible_lint - - - name: Config repo, reset - ansible.builtin.command: "{{ git_cmd }}" - args: - chdir: "{{ config_path }}" - loop: - - git fetch --all - - git checkout master - - git reset --hard origin/master -- - - git clean -f -d - loop_control: - loop_var: git_cmd - tags: - - skip_ansible_lint diff --git a/roles/utils/config-repo-reset/tasks/main.yml b/roles/utils/config-repo-reset/tasks/main.yml new file mode 100644 index 00000000..b6d7ffc1 --- /dev/null +++ b/roles/utils/config-repo-reset/tasks/main.yml @@ -0,0 +1,14 @@ +--- +- name: Config repo, reset + ansible.builtin.command: "{{ git_cmd }}" + args: + chdir: "{{ config_path }}" + loop: + - git fetch --all + - git checkout master + - git reset --hard origin/master -- + - git clean -f -d + loop_control: + loop_var: git_cmd + tags: + - skip_ansible_lint