-
Notifications
You must be signed in to change notification settings - Fork 64
/
Jenkinsfile
138 lines (103 loc) · 4.6 KB
/
Jenkinsfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
#!/usr/bin/env groovy
import groovy.transform.Field
// -- PIPELINE LIBRARIES
@Library('psl')
import com.esri.zrh.jenkins.PipelineSupportLibrary
import com.esri.zrh.jenkins.PslFactory
import com.esri.zrh.jenkins.psl.UploadTrackingPsl
import com.esri.zrh.jenkins.JenkinsTools
import com.esri.zrh.jenkins.ce.CityEnginePipelineLibrary
import com.esri.zrh.jenkins.ce.PrtAppPipelineLibrary
@Field def psl = PslFactory.create(this, UploadTrackingPsl.ID)
@Field def cepl = new CityEnginePipelineLibrary(this, psl)
@Field def papl = new PrtAppPipelineLibrary(cepl)
// -- SETUP
psl.runsHere('production')
env.PIPELINE_ARCHIVING_ALLOWED = "true"
properties([disableConcurrentBuilds()])
// -- GLOBAL DEFINITIONS
@Field final String REPO = cepl.GIT_REPO_CESDK
@Field final String SOURCES = "cityengine-sdk.git/examples"
@Field final String SOURCE_STASH = 'cesdk-sources'
@Field final String BUILD_TARGET = 'package'
@Field final Map CESDK_LATEST = PrtAppPipelineLibrary.Dependencies.CESDK_LATEST
@Field final Map DOCKER_IMAGE_LINUX_CONFIG = [ ba: psl.BA_LINUX_DOCKER, containerId: "build_tools/ce-tc-prt:almalinux8-gcc11-v2", containerWorkspace: "/tmp/app" ]
@Field final List CONFIGS_PREPARE = [
DOCKER_IMAGE_LINUX_CONFIG + [ os: cepl.CFG_OS_RHEL8, bc: cepl.CFG_BC_REL, tc: cepl.CFG_TC_GCC112, cc: cepl.CFG_CC_OPT, arch: cepl.CFG_ARCH_X86_64 ],
]
@Field final List CONFIGS_BUILD = [
DOCKER_IMAGE_LINUX_CONFIG + [ grp: 'latest', os: cepl.CFG_OS_RHEL8, bc: cepl.CFG_BC_REL, tc: cepl.CFG_TC_GCC112, cc: cepl.CFG_CC_OPT, arch: cepl.CFG_ARCH_X86_64, deps: [ CESDK_LATEST ] ],
[ grp: 'latest', os: cepl.CFG_OS_WIN10, bc: cepl.CFG_BC_REL, tc: cepl.CFG_TC_VC1437, cc: cepl.CFG_CC_OPT, arch: cepl.CFG_ARCH_X86_64, deps: [ CESDK_LATEST ] ],
DOCKER_IMAGE_LINUX_CONFIG + [ grp: 'default', os: cepl.CFG_OS_RHEL8, bc: cepl.CFG_BC_REL, tc: cepl.CFG_TC_GCC112, cc: cepl.CFG_CC_OPT, arch: cepl.CFG_ARCH_X86_64, deps: [] ],
[ grp: 'default', os: cepl.CFG_OS_WIN10, bc: cepl.CFG_BC_REL, tc: cepl.CFG_TC_VC1437, cc: cepl.CFG_CC_OPT, arch: cepl.CFG_ARCH_X86_64, deps: [] ],
]
// -- PIPELINE
stage('prepare') {
cepl.runParallel(taskGenPrepare(CONFIGS_PREPARE))
}
stage('build') {
Map tasks = [:]
tasks << taskGenPRT4CMD(CONFIGS_BUILD)
tasks << taskGenSTLENC(CONFIGS_BUILD)
tasks << taskGenSTLDEC(CONFIGS_BUILD)
cepl.runParallel(tasks)
}
papl.finalizeRun('cityengine-sdk', env.BRANCH_NAME)
// -- TASK GENERATORS
Map taskGenPrepare(configs) {
return cepl.generateTasks('prepare', this.&taskPrepare, configs)
}
Map taskGenPRT4CMD(configs) {
return cepl.generateTasks('prt4cmd', this.&taskBuildPRT4CMD, configs)
}
Map taskGenSTLENC(configs) {
return cepl.generateTasks('stlenc', this.&taskBuildSTLENC, configs)
}
Map taskGenSTLDEC(configs) {
return cepl.generateTasks('stldec', this.&taskBuildSTLDEC, configs)
}
// -- TASK BUILDERS
def taskPrepare(cfg) {
cepl.cleanCurrentDir()
papl.checkout(REPO, env.BRANCH_NAME)
stash(name: SOURCE_STASH)
}
def taskBuildPRT4CMD(cfg) {
final String appName = 'prt4cmd'
final List defs = getPrtDirDefinition(cfg.deps) + [
[ key: 'PRT4CMD_VERSION_MAJOR', val: 0 ],
[ key: 'PRT4CMD_VERSION_MINOR', val: 0 ],
[ key: 'PRT4CMD_VERSION_MICRO', val: env.BUILD_NUMBER ]
]
buildConfig("${SOURCES}/${appName}/src", BUILD_TARGET, cfg, cfg.deps, defs)
papl.publish(appName, env.BRANCH_NAME, "esri_${appName}*.zip", { "0.0.${env.BUILD_NUMBER}" }, cfg, { cepl.getArchiveClassifier(cfg) + '-cesdk_' + cfg.grp })
}
def taskBuildSTLENC(cfg) {
final String appName = 'stlenc'
final List defs = getPrtDirDefinition(cfg.deps) + [
[ key: 'STLENC_VERSION_MICRO', val: env.BUILD_NUMBER ]
]
buildConfig("${SOURCES}/${appName}/src", BUILD_TARGET, cfg, cfg.deps, defs)
papl.publish(appName, env.BRANCH_NAME, "esri_${appName}*.zip", { "0.0.${env.BUILD_NUMBER}" }, cfg, { cepl.getArchiveClassifier(cfg) + '-cesdk_' + cfg.grp })
}
def taskBuildSTLDEC(cfg) {
final String appName = 'stldec'
final List defs = getPrtDirDefinition(cfg.deps) + [
[ key: 'STLDEC_VERSION_MICRO', val: env.BUILD_NUMBER ]
]
buildConfig("${SOURCES}/${appName}/src", BUILD_TARGET, cfg, cfg.deps, defs)
papl.publish(appName, env.BRANCH_NAME, "esri_${appName}*.zip", { "0.0.${env.BUILD_NUMBER}" }, cfg, { cepl.getArchiveClassifier(cfg) + '-cesdk_' + cfg.grp })
}
// -- HELPER FUNCTIONS
List getPrtDirDefinition(deps) {
if (deps.contains(CESDK_LATEST)) {
return [ [ key: 'prt_DIR', val: CESDK_LATEST.p ] ]
}
return []
}
def buildConfig(String src, String tgt, Map cfg, List deps, List defs) {
cepl.cleanCurrentDir()
unstash(name: SOURCE_STASH)
deps.each { d -> papl.fetchDependency(d, cfg) }
papl.runCMakeBuild(src, 'build', tgt, cfg, defs, JenkinsTools.CMAKE327)
}