From 49975e98816a8494f2f204ee916b9dc99993acf5 Mon Sep 17 00:00:00 2001 From: Clark Boylan Date: Wed, 7 Feb 2018 16:37:59 -0800 Subject: [PATCH] Handle tags in infra docs publishing We publish docs for infra projects on tags for projects like bindep. Previously the afs publishing role for this assumed zuul.branch was always going to be present but it isn't when operating on a tag in the release pipeline. Update the conditionals to properly handle the case of zuul.tag being present and zuul.branch missing. Change-Id: Iee2a7f43a92a63c1943755ff46a03c94f096d6bc --- roles/prepare-infra-docs-for-afs/tasks/main.yaml | 15 +++++++++++---- .../prepare-infra-docs-for-afs/tasks/tagged.yaml | 2 +- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/roles/prepare-infra-docs-for-afs/tasks/main.yaml b/roles/prepare-infra-docs-for-afs/tasks/main.yaml index 0d44332a..1cf10fd0 100644 --- a/roles/prepare-infra-docs-for-afs/tasks/main.yaml +++ b/roles/prepare-infra-docs-for-afs/tasks/main.yaml @@ -2,19 +2,26 @@ set_fact: doc_build_dir: "{{ zuul_work_dir }}/{{ sphinx_build_dir }}" -- name: Write marker text +- name: Write branch marker text copy: dest: "{{ doc_build_dir }}/html/.root-marker" content: "Project: {{ zuul.project.name }} Branch: {{ zuul.branch }} Build: {{ zuul.build }} Revision: {{ zuul.ref }}" + when: "zuul.branch is defined" + +- name: Write tag marker text + copy: + dest: "{{ doc_build_dir }}/html/.root-marker" + content: "Project: {{ zuul.project.name }} Tag: {{ zuul.tag }} Build: {{ zuul.build }} Revision: {{ zuul.ref }}" + when: "zuul.tag is defined" - name: Process tagged build include: tagged.yaml - when: "zuul.branch != 'master' and zuul.tag is defined" + when: "zuul.tag is defined" - name: Process stable branch build include: stable.yaml - when: "'stable' in zuul.branch and zuul.tag is not defined" + when: "zuul.branch is defined and 'stable' in zuul.branch and zuul.tag is not defined" - name: Process branch build include: branch.yaml - when: "zuul.branch != 'master' and 'stable' not in zuul.branch and zuul.tag is not defined" + when: "zuul.branch is defined and zuul.branch != 'master' and 'stable' not in zuul.branch and zuul.tag is not defined" diff --git a/roles/prepare-infra-docs-for-afs/tasks/tagged.yaml b/roles/prepare-infra-docs-for-afs/tasks/tagged.yaml index ee6da208..06fac6d9 100644 --- a/roles/prepare-infra-docs-for-afs/tasks/tagged.yaml +++ b/roles/prepare-infra-docs-for-afs/tasks/tagged.yaml @@ -14,5 +14,5 @@ path: "{{ doc_build_dir }}/html/{{ zuul.tag | dirname }}" state: directory -- name: Move html to branch location +- name: Move html to tag location command: "mv {{ doc_build_dir }}/tmp {{ doc_build_dir }}/html/{{ zuul.tag }}"