blob: aa3017a53db5a0c33128934c0447b18af96407e4 [file] [log] [blame]
SF initial configurator15089072022-10-06 13:33:19 +03001---
2- name: "Get workspace directory"
3 command: pwd
4 register: cwd
5 args:
6 chdir: "src/{{ zuul.project.canonical_hostname }}/"
7
8- name: "Set workspace"
9 set_fact:
10 workspace: "{{ cwd.stdout }}"
11 source: "{{ cwd.stdout }}/{{ zuul.project.name }}/{{ src_dir }}"
12
13- name: "Ensure pages-artifacts exists"
14 file:
15 path: "{{ ansible_user_dir }}/zuul-output/logs/pages"
16 state: directory
17
18- name: "Check site content type"
19 stat:
20 path: "{{ item.path }}"
21 loop:
22 - type: sphinx
23 path: "{{ source }}/conf.py"
24 - type: pelican
25 path: "{{ source }}/pelicanconf.py"
26 register: check
27
28- set_fact:
29 success_check: "{{ check.results|selectattr('stat.exists')|list() }}"
30
31- name: "Check wrong site content type detection"
32 fail:
33 msg: "It is confusing more than 1 site type has been detected."
34 when: success_check|length > 1
35
36- name: "Build sphinx site"
37 command: "sphinx-build -b html . {{ ansible_user_dir }}/zuul-output/logs/pages"
38 args:
39 chdir: "{{ source }}"
40 when:
41 - success_check
42 - success_check.0.item.type == "sphinx"
43
44- name: "Build pelican site"
45 command: "pelican content -o {{ ansible_user_dir }}/zuul-output/logs/pages"
46 args:
47 chdir: "{{ source }}"
48 when:
49 - success_check
50 - success_check.0.item.type == "pelican"
51
52- name: "Copy {{ source }} to {{ pages_build_dir }}/"
53 shell: "cp -Rf {{ source }}/* {{ ansible_user_dir }}/zuul-output/logs/pages"
54 when: not success_check
55
56- name: Define zuul artifacts
57 delegate_to: localhost
58 zuul_return:
59 data:
60 zuul:
61 artifacts:
62 - name: "Pages preview"
63 url: "pages/"