diff --git a/jenkins_jobs/modules/publishers.py b/jenkins_jobs/modules/publishers.py index 724b5680f..8f1126dd6 100644 --- a/jenkins_jobs/modules/publishers.py +++ b/jenkins_jobs/modules/publishers.py @@ -2446,6 +2446,9 @@ def html_publisher(parser, xml_parent, data): :arg str files: Specify the pages to display :arg bool keep-all: keep HTML reports for each past build (Default False) :arg bool allow-missing: Allow missing HTML reports (Default False) + :arg bool link-to-last-build: If this and 'keep-all' both are true, it + publishes the link on project level even if build failed. + (default false) Example: @@ -2460,6 +2463,8 @@ def html_publisher(parser, xml_parent, data): XML.SubElement(ptarget, 'reportName').text = data['name'] XML.SubElement(ptarget, 'reportDir').text = data['dir'] XML.SubElement(ptarget, 'reportFiles').text = data['files'] + XML.SubElement(ptarget, 'alwaysLinkToLastBuild').text = str( + data.get('link-to-last-build', False)).lower() keep_all = str(data.get('keep-all', False)).lower() XML.SubElement(ptarget, 'keepAll').text = keep_all allow_missing = str(data.get('allow-missing', False)).lower() diff --git a/tests/publishers/fixtures/html-publisher001.xml b/tests/publishers/fixtures/html-publisher001.xml index f2ac8758d..296f6225e 100644 --- a/tests/publishers/fixtures/html-publisher001.xml +++ b/tests/publishers/fixtures/html-publisher001.xml @@ -7,6 +7,7 @@ <reportName>some name</reportName> <reportDir>path/</reportDir> <reportFiles>index.html</reportFiles> + <alwaysLinkToLastBuild>true</alwaysLinkToLastBuild> <keepAll>true</keepAll> <allowMissing>true</allowMissing> <wrapperName>htmlpublisher-wrapper.html</wrapperName> diff --git a/tests/publishers/fixtures/html-publisher001.yaml b/tests/publishers/fixtures/html-publisher001.yaml index aa85be6cb..8379d6eac 100644 --- a/tests/publishers/fixtures/html-publisher001.yaml +++ b/tests/publishers/fixtures/html-publisher001.yaml @@ -5,3 +5,4 @@ publishers: files: "index.html" keep-all: true allow-missing: true + link-to-last-build: true