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

Cknieling/msi installer #197

Open
wants to merge 14 commits into
base: develop
Choose a base branch
from
Open
Changes from 1 commit
Commits
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
72 changes: 71 additions & 1 deletion Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import com.esri.zrh.jenkins.ce.CityEnginePipelineLibrary
import com.esri.zrh.jenkins.ce.PrtAppPipelineLibrary
import com.esri.zrh.jenkins.PslFactory
import com.esri.zrh.jenkins.psl.UploadTrackingPsl
import com.esri.zrh.jenkins.ToolInfo

@Field def psl = PslFactory.create(this, UploadTrackingPsl.ID)
@Field def cepl = new CityEnginePipelineLibrary(this, psl)
Expand Down Expand Up @@ -46,6 +47,8 @@ import com.esri.zrh.jenkins.psl.UploadTrackingPsl
[ os: cepl.CFG_OS_WIN10, bc: cepl.CFG_BC_REL, tc: cepl.CFG_TC_VC1427, cc: cepl.CFG_CC_OPT, arch: cepl.CFG_ARCH_X86_64, houdini: '19.5' ],
]

@Field final List INSTALLER_CONFIG = [ [ os: cepl.CFG_OS_WIN10, bc: cepl.CFG_BC_REL, tc: cepl.CFG_TC_VC1427, cc: cepl.CFG_CC_OPT, arch: cepl.CFG_ARCH_X86_64 ] ]
@Field final List INSTALLER_HOUDINI_VERS = [ '18.5', '19.0', '19.5' ]

// -- SETUP

Expand All @@ -68,6 +71,10 @@ stage('build') {
cepl.runParallel(taskGenBuild())
}

stage('installer') {
cepl.runParallel(taskGenInstaller())
}

papl.finalizeRun('palladio', env.BRANCH_NAME)


Expand All @@ -93,6 +100,12 @@ Map taskGenBuild() {
return tasks;
}

Map taskGenInstaller() {
Map tasks = [:]
tasks << cepl.generateTasks('pld-msi', this.&taskCreateInstaller, INSTALLER_CONFIG)
return tasks;
}


// -- TASK BUILDERS

Expand Down Expand Up @@ -123,6 +136,17 @@ def taskBuildPalladio(cfg) {
dir(path: 'build') {
papl.runCMakeBuild(SOURCE, BUILD_TARGET, cfg, defs)
}
final String artifactPattern = "palladio-*"

if(cfg.os == cepl.CFG_OS_WIN10){
dir(path: 'build'){
stashFile = cepl.findOneFile(artifactPattern)
echo("stashFile: '${stashFile}'")
stash(includes: artifactPattern, name: "houdini${cfg.houdini.replaceAll('\\.', '_')}")
stashPath = "${stashFile.path}"
echo("file path to stash: '${stashPath}'")
}
}

def versionExtractor = { p ->
def vers = (p =~ /.*palladio-(.*)\.hdn.*/)
Expand All @@ -132,5 +156,51 @@ def taskBuildPalladio(cfg) {
def cls = (p =~ /.*palladio-.*\.(hdn.*)-(windows|linux)\..*/)
return cls[0][1] + '.' + cepl.getArchiveClassifier(cfg)
}
papl.publish('palladio', env.BRANCH_NAME, "palladio-*", versionExtractor, cfg, classifierExtractor)
papl.publish('palladio', env.BRANCH_NAME, artifactPattern, versionExtractor, cfg, classifierExtractor)
}

def taskCreateInstaller(cfg) {
final String appName = 'palladio-installer'
cepl.cleanCurrentDir()
unstash(name: SOURCE_STASH)

String pyArgs = ""

// fetch outputs from builds
dir(path: 'build'){
dir(path: 'tmp'){
INSTALLER_HOUDINI_VERS.each { mv ->
unstash(name: "houdini${mv.replaceAll('\\.', '_')}")
chr11115 marked this conversation as resolved.
Show resolved Hide resolved
def zipFile = cepl.findOneFile("*hdn${mv.replaceAll('\\.', '-')}*.zip")
final String zipFileName = zipFile.name
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should check if the zipFile has been found or explict error with a message otherwise

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The call to findOneFile already throws an error if the file isn't found

unzip(zipFile:zipFileName)
pyArgs += "-h${mv.replaceAll('\\.', '')} \"build\\tmp\\${zipFileName.take(zipFileName.lastIndexOf('.'))}\" "
}
}
}
pyArgs += "-bv ${env.BUILD_NUMBER} "
pyArgs += "-bd \"build\\build_msi\" "

// Toolchain definition for building MSI installers.
final JenkinsTools compiler = cepl.getToolchainTool(cfg)
final def toolchain = [
new ToolInfo(JenkinsTools.WIX, cfg),
new ToolInfo(compiler, cfg)
]

// Setup environment according to above toolchain definition.
withTool(toolchain) {
psl.runCmd('python "palladio.git\\deploy\\build.py" ' + pyArgs)
chr11115 marked this conversation as resolved.
Show resolved Hide resolved

def buildProps = papl.jpe.readProperties(file: 'build/build_msi/deployment.properties')

final String artifactPattern = "build_msi/${buildProps.package_file}"
final def artifactVersion = { p -> buildProps.package_version }

def classifierExtractor = { p ->
return cepl.getArchiveClassifier(cfg)
}

papl.publish(appName, env.BRANCH_NAME, artifactPattern, artifactVersion, cfg, classifierExtractor)
}
}