-
Notifications
You must be signed in to change notification settings - Fork 70
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Добавил стадию документирования Swagger #63
Open
kuzja086
wants to merge
22
commits into
firstBitMarksistskaya:develop
Choose a base branch
from
kuzja086:SwaggerUpdate
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
00df82f
Поправил таймаут
kozstlink 06dca77
Update README.md
nixel2007 c440d05
Возможность загрузки базы из хранилища, если исходники в формате EDT
kozstlink fd3700c
Возможность загрузки базы из хранилища, если исходники в формате EDT
kozstlink 7712b80
Update pipeline1C.groovy
kuzja086 2343ddf
Правки
kozstlink f09b9a4
Merge branch 'firstBitSemenovskaya:develop' into develop
kuzja086 b970133
Возможность загрузки базы из хранилища, если исходники в формате EDT
kozstlink 1b8c2e8
Возможность загрузки базы из хранилища, если исходники в формате EDT
kozstlink 6fc81d8
Update pipeline1C.groovy
kuzja086 06c6c1d
Правки
kozstlink 696f7b1
Update pipeline1C.groovy
kuzja086 577460b
Merge branch 'firstBitSemenovskaya:develop' into develop
kuzja086 f5ae473
Merge remote-tracking branch 'origin/develop'
kozstlink 15d346f
Merge branch 'firstBitSemenovskaya:develop' into SwagerUpdate
kuzja086 713c423
Доработка стадии документирования swagger
kozstlink c8259bf
Рефакторинг
kozstlink 312e775
Рефакторинг
kozstlink b2d5f38
Рефакторинг
kozstlink 8a39f16
Рефакторинг
nixel2007 380027f
Test PublishHTML
kozstlink c5cb8fa
Test PublishHTML
kozstlink File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
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 | ||
import ru.pulsar.jenkins.library.utils.Logger | ||
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; | ||
|
||
Swagger(JobConfiguration config) { | ||
this.config = config | ||
} | ||
|
||
def run() { | ||
if (!config.stageFlags.swagger) { | ||
Logger.println("Swagger documentation is disabled") | ||
return | ||
} | ||
|
||
IStepExecutor steps = ContextRegistry.getContext().getStepExecutor() | ||
|
||
Logger.printLocation() | ||
|
||
steps.installLocalDependencies() | ||
|
||
String swaggerPath = OscriptModules.getAppExecutable("swagger"); | ||
|
||
steps.cmd(swaggerPath + " generate --src-path $config.srcDir --out $OUT") | ||
|
||
def dir = new File("$env.WORKSPACE/$OUT") | ||
dir.eachFile(FileType.FILES){ | ||
Logger.println(it.name) | ||
Logger.println(it.path) | ||
steps.cmd("bootprint openapi $it.path $OUT_HTML") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Потыкал bootprint, страшненький :) |
||
} | ||
publishHTML (target : [allowMissing: false, | ||
alwaysLinkToLastBuild: true, | ||
keepAll: true, | ||
reportDir: $OUT_HTML, | ||
reportFiles: 'index.html', | ||
reportName: 'Swagger API', | ||
reportTitles: 'API $it.name']) | ||
|
||
steps.archiveArtifacts(OUT) | ||
nixel2007 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package ru.pulsar.jenkins.library.utils | ||
|
||
import ru.pulsar.jenkins.library.IStepExecutor | ||
import ru.pulsar.jenkins.library.ioc.ContextRegistry | ||
|
||
class OscriptModules { | ||
static String getAppExecutable(String executableName) { | ||
|
||
IStepExecutor steps = ContextRegistry.getContext().getStepExecutor() | ||
|
||
String executableBinary = steps.isUnix() ? executableName : "${executableName}.bat"; | ||
String executablePath = "oscript_modules/bin/$executableBinary"; | ||
if (!steps.fileExists(executablePath)) { | ||
executablePath = executableBinary; | ||
} | ||
|
||
return executablePath; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import ru.pulsar.jenkins.library.configuration.JobConfiguration | ||
import ru.pulsar.jenkins.library.ioc.ContextRegistry | ||
import ru.pulsar.jenkins.library.steps.Swagger | ||
|
||
def call(JobConfiguration config) { | ||
ContextRegistry.registerDefaultContext(this) | ||
|
||
def swagger = new Swagger(config) | ||
swagger.run() | ||
} | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Разве там несколько сайтов? Я не пробовал запускать ещё, но думал, что там каталог с набором файлов и единственным index.html.
Если он там один, то достаточно один раз вызвать publishHTML на каталог
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
посмотрел, да, там их несколько.
раньше у publishHTML была особенность - его нельзя было вызывать несколько раз. нужно было подготовить массив из описаний публикаций и вызывать publishHTML один раз, передавая туда массив.