1 def isPr
= (env
.ghprbPullId
&& !env
.ghprbPullId
.empty ?
true : false)
2 def monoBranch
= (isPr ?
"pr" : env
.BRANCH_NAME
)
3 def isReleaseJob
= (!isPr
&& monoBranch
==~
/201\d-\d\d/) // check if we're on a 2017-xx branch, i.e. release
4 def jobName
= (isPr ?
"build-package-win-mono-pullrequest" : "build-package-win-mono")
5 def macJobName
= (isPr ?
"build-package-osx-mono-pullrequest" : "build-package-osx-mono/${monoBranch}")
6 def packageFileNameX86
= null
7 def packageFileNameX64
= null
10 // compression is incompatible with JEP-210 right now
11 properties([ /* compressBuildLog() */])
16 ws("workspace/${jobName}/${monoBranch}") {
18 echo
"Running on ${env.NODE_NAME}"
20 // clone and checkout repo
23 // we need to reset to the commit sha passed to us by the upstream Mac build
24 sh (script
: "git reset --hard ${env.sha1} && git submodule update --recursive")
26 // get current commit sha
27 commitHash
= sh (script
: 'git rev-parse HEAD', returnStdout
: true).trim()
28 currentBuild
.displayName
= "${commitHash.substring(0,7)}"
30 utils
= load
"scripts/ci/pipeline/utils.groovy"
33 stage('Download Mac .pkg from Azure') {
34 azureDownload(storageCredentialId
: "fbd29020e8166fbede5518e038544343",
35 downloadType
: "project",
36 buildSelector
: upstream(),
37 projectName
: "${macJobName}",
38 flattenDirectories
: true,
39 includeFilesPattern
: "**/*.pkg")
43 utils
.reportGitHubStatus (isPr ? env
.ghprbActualCommit
: commitHash
, 'MSI-mono_x86', env
.BUILD_URL
, 'PENDING', 'Building...')
44 utils
.reportGitHubStatus (isPr ? env
.ghprbActualCommit
: commitHash
, 'MSI-mono_x64', env
.BUILD_URL
, 'PENDING', 'Building...')
47 timeout (time
: 420, unit
: 'MINUTES') {
48 def macPackageName
= sh (script
: "ls MonoFramework-MDK-*.pkg", returnStdout
: true).trim()
49 def macPackageNameAbs
= sh (script
: "realpath ${macPackageName}", returnStdout
: true).trim()
50 def fourPartVersion
= sh (script
: "echo ${macPackageName} | sed 's#.*MDK-##; s#\\.macos10.*##; s#.*-dirty-##' | cut -f1-4 -d'.'", returnStdout
: true).trim()
51 def gtksharpVersion
= sh (script
: "sed -n 's/GTKSHARP_VERSION=\\(.*\\)/\\1/p' packaging/Windows/defs/gtksharp", returnStdout
: true).trim()
53 sh
"sed -i \"s/\\(GTKSHARP_VERSION=\\).*/\\1${gtksharpVersion}/\" packaging/Windows/resources/build.bat"
54 sh
"sed -i \"s/\\(MONO_VERSION=\\).*/\\1${fourPartVersion}/\" packaging/Windows/resources/build.bat"
55 sh
"sed -i \"s/\\(MONO_VERSION=\\).*/\\1${fourPartVersion}/\" packaging/Windows/resources/build64.bat"
56 sh
"sed -i \"s/\\(echo Mono version \\).*/\\1${fourPartVersion}/\" packaging/Windows/resources/bat/setmonopath.bat"
58 withEnv (["PATH+TOOLS=/usr/bin:/usr/local/bin:/cygdrive/c/Program Files (x86)/Mono/bin", "mdk=${macPackageNameAbs}"]) {
60 dir ('packaging/Windows') { sh
"./mono-MDK-windows" }
62 sh
"git clean -xdff --exclude 'mono-*.msi' --exclude ${macPackageName}"
63 sh
"git submodule foreach git clean -xdff"
66 dir ('packaging/Windows') { sh
"./mono-MDK-windows-x64" }
70 // move .msi files to the workspace root
71 sh
'mv packaging/Windows/resources/bin/Release/mono-*.msi .'
72 packageFileNameX86
= findFiles (glob
: "mono-*-win32-0.msi")[0].name
73 packageFileNameX64
= findFiles (glob
: "mono-*-x64-0.msi")[0].name
75 stage('Upload .msi to Azure') {
76 azureUpload(storageCredentialId
: "fbd29020e8166fbede5518e038544343",
77 storageType
: "blobstorage",
78 containerName
: "${jobName}",
79 virtualPath
: "${monoBranch}/${env.BUILD_NUMBER}/${commitHash}/",
80 filesPath
: "${packageFileNameX86},${packageFileNameX64}",
81 allowAnonymousAccess
: true,
83 doNotWaitForPreviousBuild
: true,
84 uploadArtifactsOnlyIfSuccessful
: true)
93 timeout(time
: 30, unit
: 'MINUTES') {
94 // waits until the signing job posts completion signal to this pipeline input
95 input id
: 'FinishedSigning', message
: 'Waiting for signing to finish (please be patient)...', submitter
: 'monojenkins'
101 echo
"Not a release job, skipping signing."
104 def packageUrlX86
= "https://xamjenkinsartifact.azureedge.net/${jobName}/${monoBranch}/${env.BUILD_NUMBER}/${commitHash}/${packageFileNameX86}"
105 def packageUrlX64
= "https://xamjenkinsartifact.azureedge.net/${jobName}/${monoBranch}/${env.BUILD_NUMBER}/${commitHash}/${packageFileNameX64}";
107 currentBuild
.description
= "<hr/><h2>DOWNLOAD: <a href=\"${packageUrlX86}\">${packageFileNameX86}</a> -- <a href=\"${packageUrlX64}\">${packageFileNameX64}</a></h2><hr/>"
108 utils
.reportGitHubStatus (isPr ? env
.ghprbActualCommit
: commitHash
, 'MSI-mono_x86', packageUrlX86
, 'SUCCESS', packageFileNameX86
)
109 utils
.reportGitHubStatus (isPr ? env
.ghprbActualCommit
: commitHash
, 'MSI-mono_x64', packageUrlX64
, 'SUCCESS', packageFileNameX64
)
112 catch (Exception e
) {
113 utils
.reportGitHubStatus (isPr ? env
.ghprbActualCommit
: commitHash
, 'MSI-mono_x86', env
.BUILD_URL
, 'FAILURE', "Build failed.")
114 utils
.reportGitHubStatus (isPr ? env
.ghprbActualCommit
: commitHash
, 'MSI-mono_x64', env
.BUILD_URL
, 'FAILURE', "Build failed.")