00_core.ymlΒΆ

---
- include_tasks: utils/once/flag.yml

- name: "🧩 load docker, proxy for '{{ application_id }}'"
  include_role:
    name: sys-stk-full
  vars:
    compose_handlers_flush: false

- name: "🎬 Stage the Sphinx tooling into the build context of '{{ application_id }}'"
  stack_host_copy:
    src: "{{ item }}/"
    dest: "{{ [DOCS_TOOLING_DIR, item] | path_join }}/"
    directory_mode: "0755"
  loop:
    - python
    - javascript
  notify:
    - compose-build
    - compose-up

- name: "πŸ“‚ Reserve a controller file for the snapshot of '{{ application_id }}'"
  ansible.builtin.tempfile:
    suffix: .tar.zst
  register: docs_snapshot_archive
  delegate_to: localhost
  become: false
  run_once: true

- name: "πŸ“Έ Archive the deployed working tree for '{{ application_id }}'"
  ansible.builtin.shell: >-
    set -o pipefail &&
    find {{ DOCS_SNAPSHOT_PATHS | join(' ') }}
    -name __pycache__ -prune -o -name node_modules -prune -o -name '*.pyc' -prune -o -print0
    | LC_ALL=C sort -z
    | tar --no-recursion --null --sort=name --mtime=@0 --owner=0 --group=0 --numeric-owner -cf - -T -
    | zstd -q -9 -T2 --long=27 > {{ docs_snapshot_archive.path | quote }}
  args:
    chdir: "{{ lookup('path_absolute', '.') }}"
    executable: /bin/bash
  delegate_to: localhost
  become: false
  run_once: true
  changed_when: false

- name: "πŸ“¦ Stage the snapshot into the build context of '{{ application_id }}'"
  stack_host_copy:
    src: "{{ docs_snapshot_archive.path }}"
    dest: "{{ [DOCS_TOOLING_DIR, 'snapshot.tar.zst'] | path_join }}"
  notify:
    - compose-build
    - compose-up

- name: "🧹 Remove the retired gzip snapshot of '{{ application_id }}'"
  when: IS_STACK_HOST | bool
  ansible.builtin.file:
    path: "{{ [DOCS_TOOLING_DIR, 'snapshot.tar.gz'] | path_join }}"
    state: absent

- name: "🧹 Remove the controller snapshot of '{{ application_id }}'"
  ansible.builtin.file:
    path: "{{ docs_snapshot_archive.path }}"
    state: absent
  delegate_to: localhost
  become: false
  run_once: true

- name: "🚿 Flush compose handlers for '{{ application_id }}'"
  ansible.builtin.meta: flush_handlers

- name: "πŸ”₯ Queue the build of the deployed working tree for '{{ application_id }}'"
  uri_retry:
    url: "{{ DOCS_LOCAL_BASE_URL }}/deployed/{{ item }}"
    status_code: [200, 202]
    timeout: "{{ lookup('timeout', 30) | int }}"
  loop: "{{ DOCS_I18N_PRELOAD_PATHS }}"
  register: docs_deployed_warm
  until: docs_deployed_warm is not failed
  retries: 12
  delay: 10
  changed_when: false