Skip to content
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
wants to merge 22 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 16 commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
00df82f
Поправил таймаут
kozstlink Nov 10, 2021
06dca77
Update README.md
nixel2007 Nov 8, 2021
c440d05
Возможность загрузки базы из хранилища, если исходники в формате EDT
kozstlink Nov 15, 2021
fd3700c
Возможность загрузки базы из хранилища, если исходники в формате EDT
kozstlink Nov 15, 2021
7712b80
Update pipeline1C.groovy
kuzja086 Nov 15, 2021
2343ddf
Правки
kozstlink Nov 17, 2021
f09b9a4
Merge branch 'firstBitSemenovskaya:develop' into develop
kuzja086 Nov 17, 2021
b970133
Возможность загрузки базы из хранилища, если исходники в формате EDT
kozstlink Nov 15, 2021
1b8c2e8
Возможность загрузки базы из хранилища, если исходники в формате EDT
kozstlink Nov 15, 2021
6fc81d8
Update pipeline1C.groovy
kuzja086 Nov 15, 2021
06c6c1d
Правки
kozstlink Nov 17, 2021
696f7b1
Update pipeline1C.groovy
kuzja086 Nov 20, 2021
577460b
Merge branch 'firstBitSemenovskaya:develop' into develop
kuzja086 Nov 20, 2021
f5ae473
Merge remote-tracking branch 'origin/develop'
kozstlink Nov 20, 2021
15d346f
Merge branch 'firstBitSemenovskaya:develop' into SwagerUpdate
kuzja086 Nov 29, 2021
713c423
Доработка стадии документирования swagger
kozstlink Nov 29, 2021
c8259bf
Рефакторинг
kozstlink Dec 3, 2021
312e775
Рефакторинг
kozstlink Dec 3, 2021
b2d5f38
Рефакторинг
kozstlink Dec 3, 2021
8a39f16
Рефакторинг
nixel2007 Dec 3, 2021
380027f
Test PublishHTML
kozstlink Dec 6, 2021
c5cb8fa
Test PublishHTML
kozstlink Dec 8, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion resources/globalConfiguration.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
"bdd": false,
"syntaxCheck": false,
"edtValidate": false,
"smoke": false
"smoke": false,
"swagger": false
},
"initInfobase": {
"initMethod": "fromStorage",
Expand Down
4 changes: 4 additions & 0 deletions resources/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,10 @@
"bdd" : {
"type" : "boolean",
"description" : "Запуск BDD сценариев включен"
},
"swagger" : {
"type" : "boolean",
"description" : "Подготовка Swagger документации"
}
}
},
Expand Down
4 changes: 4 additions & 0 deletions src/ru/pulsar/jenkins/library/configuration/StageFlags.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ class StageFlags implements Serializable {
@JsonPropertyDescription("Запуск BDD сценариев включен")
boolean bdd

@JsonPropertyDescription("Подготовка Swagger документации")
boolean swagger

@Override
@NonCPS
String toString() {
Expand All @@ -34,6 +37,7 @@ class StageFlags implements Serializable {
", smoke=" + smoke +
", initSteps=" + initSteps +
", bdd=" + bdd +
", swagger=" + swagger +
'}';
}

Expand Down
39 changes: 39 additions & 0 deletions src/ru/pulsar/jenkins/library/steps/Swagger.groovy
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
package ru.pulsar.jenkins.library.steps

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 java.nio.file.Paths

class Swagger {
public static final String OUT = 'build/out/'
kuzja086 marked this conversation as resolved.
Show resolved Hide resolved

private final JobConfiguration config;

Swagger(JobConfiguration config) {
this.config = config
}

def run() {
IStepExecutor steps = ContextRegistry.getContext().getStepExecutor()
kuzja086 marked this conversation as resolved.
Show resolved Hide resolved

Logger.printLocation()

def env = steps.env();
kuzja086 marked this conversation as resolved.
Show resolved Hide resolved

if (!config.stageFlags.swagger) {
Logger.println("Swagger documentation is disabled")
return
}

steps.installLocalDependencies()

String SRC_PATH = new File("$env.WORKSPACE/$config.srcDir").getCanonicalPath()
kuzja086 marked this conversation as resolved.
Show resolved Hide resolved

steps.cmd("oscript_modules/bin/swagger generate --src-path $SRC_PATH --out $OUT")
kuzja086 marked this conversation as resolved.
Show resolved Hide resolved

steps.archiveArtifacts(OUT)
nixel2007 marked this conversation as resolved.
Show resolved Hide resolved
}
}
17 changes: 17 additions & 0 deletions vars/pipeline1C.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import groovy.transform.Field
import ru.pulsar.jenkins.library.configuration.JobConfiguration
import ru.pulsar.jenkins.library.configuration.SourceFormat
import ru.pulsar.jenkins.library.steps.Swagger

import java.util.concurrent.TimeUnit

Expand Down Expand Up @@ -201,6 +202,22 @@ void call() {
sonarScanner config
}
}

stage('Документирование'){
parallel {
nixel2007 marked this conversation as resolved.
Show resolved Hide resolved
stage('Swagger') {
agent {
label 'oscript'
}
steps {
script {
def swagger = new Swagger(config)
nixel2007 marked this conversation as resolved.
Show resolved Hide resolved
swagger.run()
}
}
}
}
}
}

post('post-stage') {
Expand Down