Skip to content

Commit

Permalink
Test PublishHTML
Browse files Browse the repository at this point in the history
  • Loading branch information
kozstlink committed Dec 6, 2021
1 parent 8a39f16 commit 0794f27
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions src/ru/pulsar/jenkins/library/steps/Swagger.groovy
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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;

Expand All @@ -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)
}
}

0 comments on commit 0794f27

Please sign in to comment.