Goncharov, Artem 1bec551697 Support sync with deletion
Reviewed-by: gtema <artem.goncharov@gmail.com>
Co-authored-by: Goncharov, Artem <artem.goncharov@t-systems.com>
Co-committed-by: Goncharov, Artem <artem.goncharov@t-systems.com>
2022-07-28 12:40:22 +00:00

77 lines
3.2 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: Generate RSTs
include_role:
name: "convert_doc"
vars:
doc_label: "{{ doc.label }}"
dest: "{{ ansible_user_dir }}/{{ doc.repository }}/{{ doc.project_location }}"
source: "{{ zuul.project.src_dir }}/{{ doc.html_location }}"
doc_title: "{{ doc.title | default(omit) }}"
doc_service: "{{ doc.service | default(omit) }}"
doc_repo_name: "{{ doc.repository | default(omit) }}"
doc_pdf_name: "{{ [doc.doc_type, doc.service_type] | join('-') }}"
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: 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: 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')"