From 380027fffa17e8e7faec150c79ed77e5bbb6c227 Mon Sep 17 00:00:00 2001 From: Sergey Kozinskiy Date: Mon, 6 Dec 2021 08:42:39 +0500 Subject: [PATCH] Test PublishHTML --- .../jenkins/library/steps/Swagger.groovy | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/ru/pulsar/jenkins/library/steps/Swagger.groovy b/src/ru/pulsar/jenkins/library/steps/Swagger.groovy index 2133e58c..e2e6a7e8 100644 --- a/src/ru/pulsar/jenkins/library/steps/Swagger.groovy +++ b/src/ru/pulsar/jenkins/library/steps/Swagger.groovy @@ -1,5 +1,6 @@ package ru.pulsar.jenkins.library.steps +import groovy.io.FileType import ru.pulsar.jenkins.library.IStepExecutor import ru.pulsar.jenkins.library.configuration.JobConfiguration import ru.pulsar.jenkins.library.ioc.ContextRegistry @@ -8,6 +9,7 @@ import ru.pulsar.jenkins.library.utils.OscriptModules class Swagger { public static final String OUT = 'build/out/swagger/' + public static final String OUT_HTML = 'build/out/swagger/html/' private final JobConfiguration config; @@ -31,6 +33,22 @@ class Swagger { steps.cmd(swaggerPath + " generate --src-path $config.srcDir --out $OUT") + def dir = new File(OUT) + dir.eachFile(FileType.FILES){ + String reportdir = "$OUT_HTML$it.name" + Logger.println(it.name) + Logger.println(reportdir) + Logger.println(it.path) + steps.cmd("bootprint openapi $it.path $reportdir") + publishHTML (target : [allowMissing: false, + alwaysLinkToLastBuild: true, + keepAll: true, + reportDir: $reportdir, + reportFiles: 'index.html', + reportName: 'Swagger API', + reportTitles: 'API $it.name']) + } + steps.archiveArtifacts(OUT) } } \ No newline at end of file