in vars/Build.groovy [31:131]
void call() {
BuildContext context
node("master") {
stage("Init") {
context = new BuildContext(this)
String logLevel = context.getLogLevel()
context.logger = new Logger(context.script)
context.logger.init(logLevel)
context.logger.info("Sucessfully inialized logger with level ${logLevel}")
context.namespace = context.getParameterValue("CI_NAMESPACE")
context.logger.debug("Current namespace: ${context.namespace}")
context.deploymentMode = context.getDeploymentMode(context.namespace)
context.logger.debug("Current deployment mode: ${context.deploymentMode}")
context.platform = new PlatformFactory(context).getPlatformImpl()
context.logger.debug("Current platform: ${context.platform.class.name}")
context.logger.info("Initializing docker registry")
context.dockerRegistry = new DockerRegistry(context)
context.dockerRegistry.init()
context.logger.debug(context.dockerRegistry.toString())
context.codebase = new Codebase(context)
context.codebase.init()
context.logger.debug("Codebase config: ${context.codebase.toString()}")
context.stageFactory = new StageFactory(context)
context.stageFactory.init()
context.dnsWildcard = context.platform.getJsonPathValue("jenkins", "jenkins", ".spec.edpSpec.dnsWildcard")
context.logger.debug("Current dns wildcard: ${context.dnsWildcard}")
context.gitServer = new Gerrit(context, "gerrit")
context.gitServer.init()
context.logger.debug("Gitserver config: ${context.gitServer.toString()}")
context.gitClient = new GitClient(context)
context.logger.info("Initializing postgres")
context.postgres = new PostgresOperator(context)
context.postgres.init()
context.logger.debug("PostgresOperator: ${context.postgres.toString()}")
context.logger.info("Initializing redash")
context.redash = new Redash(context)
context.redash.init()
context.logger.info("Initializing kafka")
context.kafka = new Kafka(context)
context.kafka.init()
context.logger.info("Initializing keycloak")
context.keycloak = new Keycloak(context)
context.keycloak.init()
context.logger.debug("Initialized Keycloak: ${context.keycloak.toString()}")
context.jenkinsDeployer = new KeycloakClient(context)
context.jenkinsDeployer.init("admin", "jenkins-deployer", "jenkins-keycloak-client")
context.keycloakCustomHost = context.getKeycloakCustomUrl(context.namespace)
}
}
node(context.codebase.jenkinsAgent) {
context.initWorkDir()
context.codebase.initBuildTool()
context.stageFactory.getStagesToRun().each { stagesBlock ->
dir(context.getWorkDir()) {
dir(context.workDir) {
LinkedHashMap parallelStages = [:]
if (stagesBlock.containsKey('parallelStages')) {
stagesBlock.values().each() { parallelStagesBlock ->
parallelStagesBlock.each { parallelStage ->
parallelStages["${parallelStage.name}"] = {
if (parallelStage instanceof ArrayList) {
parallelStage.each {
context.stageFactory.runStage(it.name, context)
}
} else {
context.stageFactory.runStage(parallelStage.name, context)
}
}
}
context.script.parallel parallelStages
}
} else {
stagesBlock.values().each() { sequenceStage ->
sequenceStage.each {
context.stageFactory.runStage(it.name, context)
}
}
}
}
}
}
}
}