1
0

Первые шаги к новому шагу

This commit is contained in:
kuzja086
2021-07-30 16:52:40 +05:00
parent c5d410bef6
commit cbb1f5618d
6 changed files with 65 additions and 1 deletions

View File

@@ -6,6 +6,7 @@
"storage": "UNKNOWN_ID"
},
"stages": {
"srcEDT" : true,
"initSteps": false,
"sonarqube": false,
"bdd": false,

View File

@@ -53,6 +53,10 @@
"bdd" : {
"type" : "boolean",
"description" : "Запуск BDD сценариев включен"
},
"srcEDT" : {
"type" : "boolean",
"description" : "Конвертировать исходники из формата EDT в формат конфигуратора"
}
}
},

View File

@@ -24,6 +24,9 @@ class StageFlags implements Serializable {
@JsonPropertyDescription("Запуск BDD сценариев включен")
boolean bdd
@JsonPropertyDescription("Исходники в формате EDT")
boolean srcEDT
@Override
@NonCPS
String toString() {
@@ -34,10 +37,11 @@ class StageFlags implements Serializable {
", smoke=" + smoke +
", initSteps=" + initSteps +
", bdd=" + bdd +
", srcEDT=" + srcEDT +
'}';
}
boolean needInfobase() {
return smoke || syntaxCheck || initSteps || bdd
return smoke || syntaxCheck || initSteps || bdd || srcEDT
}
}

View File

@@ -12,6 +12,10 @@ class EdtTransform implements Serializable {
public static final String WORKSPACE = 'build/edt-workspace'
public static final String WORKSPACE_ZIP = 'build/edt-workspace.zip'
public static final String WORKSPACE_ZIP_STASH = 'edt-workspace-zip'
public static final String WORKSPACECFG = 'build/cfg-workspace'
public static final String WORKSPACE_ZIP_CFG = 'build/cfg-workspace.zip'
public static final String WORKSPACE_ZIP_STASH_CFG = 'cfg-workspace-zip'
private final JobConfiguration config;
@@ -49,4 +53,35 @@ class EdtTransform implements Serializable {
steps.stash(WORKSPACE_ZIP_STASH, WORKSPACE_ZIP)
}
def run(boolean srcEDT) {
IStepExecutor steps = ContextRegistry.getContext().getStepExecutor()
Logger.printLocation()
if (!config.stageFlags.srcEDT) {
Logger.println("SRC is not EDT format.")
return
}
def env = steps.env();
def workspaceDir = config.srcDir
def configurationRoot = "$env.WORKSPACE/$WORKSPACECFG"
def PROJECT_NAME = "pb17" // TODO взять из srcDIR
steps.createDir(workspaceDir)
Logger.println("Конвертация исходников из формата EDT в формат конфигуратора")
def ringCommand = "ring edt workspace import --configuration-files '$configurationRoot' --project-name $PROJECT_NAME --workspace-location '$workspaceDir'"
def ringOpts = ['RING_OPTS=-Dfile.encoding=UTF-8 -Dosgi.nl=ru -Duser.language=ru']
steps.withEnv(ringOpts) {
steps.cmd(ringCommand)
}
steps.zip(WORKSPACECFG, WORKSPACE_ZIP_CFG)
steps.stash(WORKSPACE_ZIP_STASH_CFG, WORKSPACE_ZIP_CFG)
}
}

View File

@@ -8,3 +8,10 @@ def call(JobConfiguration config) {
def edtTransform = new EdtTransform(config)
edtTransform.run()
}
def call(JobConfiguration config, boolean srcEDT) {
ContextRegistry.registerDefaultContext(this)
def edtTransform = new EdtTransform(config)
edtTransform.run(true)
}

View File

@@ -49,6 +49,19 @@ void call() {
}
stages {
stage('Трансформация из формата EDT') {
agent {
label 'edt'
}
when {
beforeAgent true
expression { config.stageFlags.srcEDT }
}
steps {
edtTransform config true
}
}
stage('Создание ИБ') {
steps {
printLocation()