From 30da877039e88a516c2a08753b9d7b4fa304faac Mon Sep 17 00:00:00 2001 From: Andreas Jaeger Date: Thu, 26 Oct 2017 13:13:05 +0200 Subject: [PATCH] Do not publish docs when building fails We just lost the docs.o.o index page: The tox run failed and only a few files were ready. Since we delete existing content when pushing new, this removed all our static pages. Add a safe guard for all doc building: Only collect and publish documents when we have build them with success. Add this to related roles like creating/destroying afs as well. Change-Id: Ife2496fe920bd40d52803705b409e6e621532254 --- playbooks/publish/api-guide.yaml | 6 ++++++ playbooks/publish/api-ref.yaml | 6 ++++++ playbooks/publish/contributor-guide-afs.yaml | 5 +++++ playbooks/publish/deploy-guide.yaml | 6 ++++++ playbooks/publish/infra-afs.yaml | 3 +++ playbooks/publish/infra-index.yaml | 5 +++++ playbooks/publish/infra-manual.yaml | 3 +++ playbooks/publish/install-guide.yaml | 6 ++++++ playbooks/publish/manuals.yaml | 4 ++++ playbooks/publish/openstack-afs.yaml | 3 +++ playbooks/publish/openstack-specs-site.yaml | 2 ++ playbooks/publish/openstack-specs.yaml | 2 ++ playbooks/publish/placement-api-ref.yaml | 5 +++++ playbooks/publish/releasenotes.yaml | 5 +++++ playbooks/publish/service-types.yaml | 2 ++ playbooks/publish/static-special.yaml | 2 ++ playbooks/publish/static.yaml | 2 ++ 17 files changed, 67 insertions(+) diff --git a/playbooks/publish/api-guide.yaml b/playbooks/publish/api-guide.yaml index d88488d1c1..830551e405 100644 --- a/playbooks/publish/api-guide.yaml +++ b/playbooks/publish/api-guide.yaml @@ -3,14 +3,20 @@ - fetch-tox-output - role: write-root-marker root_marker_dir: "src/{{ zuul.project.canonical_name }}/api-guide/build/html" + when: zuul_success | bool - role: fetch-sphinx-output sphinx_output_src: "{{ zuul.project.src_dir }}/api-guide/build/html/" zuul_executor_dest: "{{ zuul.executor.work_root }}/artifacts" + when: zuul_success | bool - hosts: localhost roles: - set-service-type-data-fact + when: zuul_success | bool - create-afs-token + when: zuul_success | bool - role: upload-afs afs_target: "{{ afs.path }}/api-guide/{{ service_type_data.service_type }}" + when: zuul_success | bool - destroy-afs-token + when: zuul_success | bool diff --git a/playbooks/publish/api-ref.yaml b/playbooks/publish/api-ref.yaml index eb4e5b86be..754bb0da97 100644 --- a/playbooks/publish/api-ref.yaml +++ b/playbooks/publish/api-ref.yaml @@ -3,14 +3,20 @@ - fetch-tox-output - role: write-root-marker root_marker_dir: "src/{{ zuul.project.canonical_name }}/api-ref/build/html" + when: zuul_success | bool - role: fetch-sphinx-output sphinx_output_src: "{{ zuul.project.src_dir }}/api-ref/build/html/" zuul_executor_dest: "{{ zuul.executor.work_root }}/artifacts" + when: zuul_success | bool - hosts: localhost roles: - set-service-type-data-fact + when: zuul_success | bool - create-afs-token + when: zuul_success | bool - role: upload-afs afs_target: "{{ afs.path }}/api-ref/{{ service_type_data.service_type }}" + when: zuul_success | bool - destroy-afs-token + when: zuul_success | bool diff --git a/playbooks/publish/contributor-guide-afs.yaml b/playbooks/publish/contributor-guide-afs.yaml index 6b7d9301c1..599e6d714a 100644 --- a/playbooks/publish/contributor-guide-afs.yaml +++ b/playbooks/publish/contributor-guide-afs.yaml @@ -3,13 +3,18 @@ - fetch-tox-output - role: write-root-marker root_marker_dir: "src/{{ zuul.project.canonical_name }}/doc/build/html" + when: zuul_success | bool - role: fetch-sphinx-output sphinx_output_src: "{{ zuul.project.src_dir }}/doc/build/html/" zuul_executor_dest: "{{ zuul.executor.work_root }}/artifacts" + when: zuul_success | bool - hosts: localhost roles: - create-afs-token + when: zuul_success | bool - role: upload-afs afs_target: "{{ afs.path }}/contributors" + when: zuul_success | bool - destroy-afs-token + when: zuul_success | bool diff --git a/playbooks/publish/deploy-guide.yaml b/playbooks/publish/deploy-guide.yaml index 41efd2caf8..12a6d29955 100644 --- a/playbooks/publish/deploy-guide.yaml +++ b/playbooks/publish/deploy-guide.yaml @@ -2,16 +2,22 @@ roles: - prepare-docs-for-afs doc_build_dir: "{{ zuul_work_dir }}/deploy-guide/build" + when: zuul_success | bool - fetch-tox-output - role: write-root-marker root_marker_dir: "src/{{ zuul.project.canonical_name }}/deploy-guide/build/html" + when: zuul_success | bool - role: fetch-sphinx-output sphinx_output_src: "{{ zuul.project.src_dir }}/deploy-guide/build/html/" zuul_executor_dest: "{{ zuul.executor.work_root }}/artifacts" + when: zuul_success | bool - hosts: localhost roles: - create-afs-token + when: zuul_success | bool - role: upload-afs afs_target: "{{ afs.path }}/project-deploy-guide/{{ zuul.project.short_name }}" + when: zuul_success | bool - destroy-afs-token + when: zuul_success | bool diff --git a/playbooks/publish/infra-afs.yaml b/playbooks/publish/infra-afs.yaml index f51945aea6..7af575e90f 100644 --- a/playbooks/publish/infra-afs.yaml +++ b/playbooks/publish/infra-afs.yaml @@ -1,6 +1,9 @@ - hosts: localhost roles: - create-afs-token + when: zuul_success | bool - role: upload-afs afs_target: "{{ afs.path }}/infra/{{ zuul.project.short_name }}" + when: zuul_success | bool - destroy-afs-token + when: zuul_success | bool diff --git a/playbooks/publish/infra-index.yaml b/playbooks/publish/infra-index.yaml index 89dc7c57cd..ddc4b5ecc8 100644 --- a/playbooks/publish/infra-index.yaml +++ b/playbooks/publish/infra-index.yaml @@ -3,13 +3,18 @@ - fetch-tox-output - role: write-root-marker root_marker_dir: "src/{{ zuul.project.canonical_name }}/docs-site/output" + when: zuul_success | bool - role: fetch-sphinx-output sphinx_output_src: "src/{{ zuul.project.canonical_name }}/docs-site/output/" zuul_executor_dest: "{{ zuul.executor.work_root }}/artifacts" + when: zuul_success | bool - hosts: localhost roles: - create-afs-token + when: zuul_success | bool - role: upload-afs afs_target: "{{ afs.path }}/infra" + when: zuul_success | bool - destroy-afs-token + when: zuul_success | bool diff --git a/playbooks/publish/infra-manual.yaml b/playbooks/publish/infra-manual.yaml index a1b1f3b385..088c49be02 100644 --- a/playbooks/publish/infra-manual.yaml +++ b/playbooks/publish/infra-manual.yaml @@ -1,6 +1,9 @@ - hosts: localhost roles: - create-afs-token + when: zuul_success | bool - role: upload-afs afs_target: "{{ afs.path }}/infra/manual" + when: zuul_success | bool - destroy-afs-token + when: zuul_success | bool diff --git a/playbooks/publish/install-guide.yaml b/playbooks/publish/install-guide.yaml index 9e6e238173..49318803f3 100644 --- a/playbooks/publish/install-guide.yaml +++ b/playbooks/publish/install-guide.yaml @@ -2,16 +2,22 @@ roles: - prepare-docs-for-afs doc_build_dir: "{{ zuul_work_dir }}/install-guide/build" + when: zuul_success | bool - fetch-tox-output - role: write-root-marker root_marker_dir: "src/{{ zuul.project.canonical_name }}/install-guide/build/html" + when: zuul_success | bool - role: fetch-sphinx-output sphinx_output_src: "{{ zuul.project.src_dir }}/install-guide/build/html/" zuul_executor_dest: "{{ zuul.executor.work_root }}/artifacts" + when: zuul_success | bool - hosts: localhost roles: - create-afs-token + when: zuul_success | bool - role: upload-afs afs_target: "{{ afs.path }}/project-install-guide/{{ zuul.project.short_name }}" + when: zuul_success | bool - destroy-afs-token + when: zuul_success | bool diff --git a/playbooks/publish/manuals.yaml b/playbooks/publish/manuals.yaml index efb0dd4581..2c712f7d73 100644 --- a/playbooks/publish/manuals.yaml +++ b/playbooks/publish/manuals.yaml @@ -4,10 +4,14 @@ - role: fetch-sphinx-output sphinx_output_src: "{{ zuul.project.src_dir }}/publish-docs/" zuul_executor_dest: "{{ zuul.executor.work_root }}/artifacts" + when: zuul_success | bool - hosts: localhost roles: - create-afs-token + when: zuul_success | bool - role: upload-afs afs_target: "{{ afs.path }}" + when: zuul_success | bool - destroy-afs-token + when: zuul_success | bool diff --git a/playbooks/publish/openstack-afs.yaml b/playbooks/publish/openstack-afs.yaml index d6fdc68680..ccbe5fb82c 100644 --- a/playbooks/publish/openstack-afs.yaml +++ b/playbooks/publish/openstack-afs.yaml @@ -1,6 +1,9 @@ - hosts: localhost roles: - create-afs-token + when: zuul_success | bool - role: upload-afs afs_target: "{{ afs.path }}/{{ zuul.project.short_name }}" + when: zuul_success | bool - destroy-afs-token + when: zuul_success | bool diff --git a/playbooks/publish/openstack-specs-site.yaml b/playbooks/publish/openstack-specs-site.yaml index a3d74b092c..e2f73f2a6d 100644 --- a/playbooks/publish/openstack-specs-site.yaml +++ b/playbooks/publish/openstack-specs-site.yaml @@ -4,6 +4,7 @@ - role: fetch-sphinx-output sphinx_output_src: "src/{{ zuul.project.canonical_name }}/specs/output/" zuul_executor_dest: "{{ zuul.executor.work_root }}/artifacts" + when: zuul_success | bool - hosts: localhost roles: @@ -19,3 +20,4 @@ src: "{{ zuul.executor.work_root }}/artifacts/" dest: "/srv/static/specs/" no_log: true + when: zuul_success | bool diff --git a/playbooks/publish/openstack-specs.yaml b/playbooks/publish/openstack-specs.yaml index 551841ca36..a6ebc32906 100644 --- a/playbooks/publish/openstack-specs.yaml +++ b/playbooks/publish/openstack-specs.yaml @@ -4,6 +4,7 @@ - role: fetch-sphinx-output sphinx_output_src: "src/{{ zuul.project.canonical_name }}/doc/build/html/" zuul_executor_dest: "{{ zuul.executor.work_root }}/artifacts" + when: zuul_success | bool - hosts: localhost roles: @@ -19,3 +20,4 @@ src: "{{ zuul.executor.work_root }}/artifacts/" dest: "/srv/static/specs/{{ zuul.project.name }}" no_log: true + when: zuul_success | bool diff --git a/playbooks/publish/placement-api-ref.yaml b/playbooks/publish/placement-api-ref.yaml index feb6ed9e60..8eb9b00a5c 100644 --- a/playbooks/publish/placement-api-ref.yaml +++ b/playbooks/publish/placement-api-ref.yaml @@ -3,13 +3,18 @@ - fetch-tox-output - role: write-root-marker root_marker_dir: "src/{{ zuul.project.canonical_name }}/placement-api-ref/build/html" + when: zuul_success | bool - role: fetch-sphinx-output sphinx_output_src: "{{ zuul.project.src_dir }}/placement-api-ref/build/html/" zuul_executor_dest: "{{ zuul.executor.work_root }}/artifacts" + when: zuul_success | bool - hosts: localhost roles: - create-afs-token + when: zuul_success | bool - role: upload-afs afs_target: "{{ afs.path }}/api-ref/placement" + when: zuul_success | bool - destroy-afs-token + when: zuul_success | bool diff --git a/playbooks/publish/releasenotes.yaml b/playbooks/publish/releasenotes.yaml index 85a36dd405..3cb2ac52d6 100644 --- a/playbooks/publish/releasenotes.yaml +++ b/playbooks/publish/releasenotes.yaml @@ -4,13 +4,18 @@ tox_envlist: releasenotes - role: write-root-marker root_marker_dir: "{{ zuul.project.src_dir }}/releasenotes/build/html/" + when: zuul_success | bool - role: fetch-sphinx-output sphinx_output_src: "{{ zuul.project.src_dir }}/releasenotes/build/html/" zuul_executor_dest: "{{ zuul.executor.work_root }}/artifacts" + when: zuul_success | bool - hosts: localhost roles: - create-afs-token + when: zuul_success | bool - role: upload-afs afs_target: "{{ afs.path }}/releasenotes/{{ zuul.project.short_name }}" + when: zuul_success | bool - destroy-afs-token + when: zuul_success | bool diff --git a/playbooks/publish/service-types.yaml b/playbooks/publish/service-types.yaml index 35510f246f..7044488825 100644 --- a/playbooks/publish/service-types.yaml +++ b/playbooks/publish/service-types.yaml @@ -4,6 +4,7 @@ - role: fetch-sphinx-output sphinx_output_src: "src/{{ zuul.project.canonical_name }}/doc/build/html/" zuul_executor_dest: "{{ zuul.executor.work_root }}/artifacts" + when: zuul_success | bool - hosts: localhost roles: @@ -19,3 +20,4 @@ src: "{{ zuul.executor.work_root }}/artifacts/" dest: "/srv/static/service-types/" no_log: true + when: zuul_success | bool diff --git a/playbooks/publish/static-special.yaml b/playbooks/publish/static-special.yaml index fa866c1bd1..3ec9e2397b 100644 --- a/playbooks/publish/static-special.yaml +++ b/playbooks/publish/static-special.yaml @@ -4,6 +4,7 @@ - role: fetch-sphinx-output sphinx_output_src: "src/{{ zuul.project.canonical_name }}/doc/build/html/" zuul_executor_dest: "{{ zuul.executor.work_root }}/artifacts" + when: zuul_success | bool - hosts: localhost roles: @@ -17,3 +18,4 @@ copy: src: "{{ zuul.executor.work_root }}/artifacts/" dest: "{{ fileserver.path }}/{{ static_target }}/" + when: zuul_success | bool diff --git a/playbooks/publish/static.yaml b/playbooks/publish/static.yaml index 2887b81dbd..328e53dacd 100644 --- a/playbooks/publish/static.yaml +++ b/playbooks/publish/static.yaml @@ -4,6 +4,7 @@ - role: fetch-sphinx-output sphinx_output_src: "src/{{ zuul.project.canonical_name }}/doc/build/html/" zuul_executor_dest: "{{ zuul.executor.work_root }}/artifacts" + when: zuul_success | bool - hosts: localhost roles: @@ -16,3 +17,4 @@ synchronize: src: "{{ zuul.executor.work_root }}/artifacts/" dest: "{{ fileserver.path }}/{{ zuul.project.short_name }}/" + when: zuul_success | bool