Goncharov, Artem argoncha e6efbb3881 Enable propose jobs
Reviewed-by: gtema <artem.goncharov@gmail.com>
Co-authored-by: Goncharov, Artem argoncha <artem.goncharov@t-systems.com>
Co-committed-by: Goncharov, Artem argoncha <artem.goncharov@t-systems.com>
2022-07-23 10:12:02 +00:00

73 lines
2.7 KiB
YAML

---
- hosts: all
tasks:
- name: Read project docs configuration
include_vars: "{{ docs_update_data_file }}"
- name: Save doc var
ansible.builtin.set_fact:
doc_exports_var: "{{ docs }}"
cacheable: true
- name: Detect list of changes
command: "git log -1 --name-only --pretty="
args:
chdir: "{{ zuul.project.src_dir }}"
register: git_log
ignore_errors: true
- name: Configure git user name
command: "git config --global user.name 'OpenTelekomCloud Proposal Bot'"
- name: Configure git user email
command: "git config --global user.email otcbot@otc-service.com"
- name: Generate new RSTs
include_role:
name: "convert_doc"
vars:
doc_label: "{{ doc.label }}"
dest: "{{ ansible_user_dir }}/{{ docs_rst_location }}/{{ doc.label }}/{{ docs_new_location }}"
source: "{{ zuul.project.src_dir }}/{{ doc.html_location }}"
loop: "{{ docs }}"
loop_control:
loop_var: "doc"
label: "{{ doc.label }}"
when: "git_log.stdout is search(doc.html_location) or git_log.stdout is search('otc_doc_convertor') or git_log.stdout is search('playbooks')"
- name: Restore to the previous git state
command: "git checkout HEAD^1"
args:
chdir: "{{ zuul.project.src_dir }}"
- name: Generate base RSTs
include_role:
name: "convert_doc"
vars:
doc_label: "{{ doc.label }}"
dest: "{{ ansible_user_dir }}/{{ docs_rst_location }}/{{ doc.label }}/{{ docs_base_location }}"
source: "{{ zuul.project.src_dir }}/{{ doc.html_location }}"
loop: "{{ docs }}"
loop_control:
loop_var: "doc"
label: "{{ doc.label }}"
when: "git_log.stdout is search(doc.html_location) or git_log.stdout is search('otc_doc_convertor')"
- name: Generate patch file
include_role:
name: "generate_doc_patch"
vars:
doc_label: "{{ doc.label }}"
generate_doc_patch_base_location: "{{ docs_base_location }}"
generate_doc_patch_new_location: "{{ docs_new_location }}"
generate_doc_patch_repository: "{{ doc.repository }}"
generate_doc_patch_project_location: "{{ doc.project_location }}"
generate_doc_patch_base: "{{ ansible_user_dir }}/{{ docs_rst_location }}/{{ doc.label }}"
generate_doc_patch_diff_patch_location: "{{ ansible_user_dir }}/{{ doc.label }}.patch"
generate_doc_patch_git_patch_location: "{{ ansible_user_dir }}/{{ doc.label }}.git.patch"
loop: "{{ docs }}"
loop_control:
loop_var: "doc"
label: "{{ doc.label }}"
when: "git_log.stdout is search(doc.html_location) or git_log.stdout is search('otc_doc_convertor')"