diff options
author | Alexander Köplinger <alex.koeplinger@outlook.com> | 2019-07-17 15:26:24 +0300 |
---|---|---|
committer | Alexander Köplinger <alex.koeplinger@outlook.com> | 2019-07-17 15:26:24 +0300 |
commit | 0509ceccb6088ece18425600cc1bed0a92b17c55 (patch) | |
tree | 58ba5b7722391e00a26e2dd6309fc1d895a95732 /scripts | |
parent | 4febac951ee1c04a024f3a64e0f2380903a7954d (diff) |
Revert "[ci] Remove separate utils.groovy file" and run step on master instead
This reverts commit d732cef5fc740cdb88e50d078f634202d140e6a9.
The github commit status setter step requires a node context so we now just use on on master instead.
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/ci/pipeline/osx-package.groovy | 21 | ||||
-rw-r--r-- | scripts/ci/pipeline/sdks-archive.groovy | 19 | ||||
-rw-r--r-- | scripts/ci/pipeline/utils.groovy | 13 | ||||
-rw-r--r-- | scripts/ci/pipeline/win-package.groovy | 25 |
4 files changed, 35 insertions, 43 deletions
diff --git a/scripts/ci/pipeline/osx-package.groovy b/scripts/ci/pipeline/osx-package.groovy index 3a2eab86b4f..b34b5f4d2ad 100644 --- a/scripts/ci/pipeline/osx-package.groovy +++ b/scripts/ci/pipeline/osx-package.groovy @@ -7,6 +7,7 @@ def windowsJobName = (isPr ? "build-package-win-mono-pullrequest" : isPrivate ? def isWindowsPrBuild = (isPr && env.ghprbCommentBody.contains("@monojenkins build pkg and msi")) def packageFileName = null def commitHash = null +def utils = null // compression is incompatible with JEP-210 right now properties([ /* compressBuildLog() */ ]) @@ -26,10 +27,12 @@ try { // get current commit sha commitHash = sh (script: 'git rev-parse HEAD', returnStdout: true).trim() currentBuild.displayName = "${commitHash.substring(0,7)}" + + utils = load "scripts/ci/pipeline/utils.groovy" } stage('Build') { - reportGitHubStatus (isPr ? env.ghprbActualCommit : commitHash, 'PKG-mono', env.BUILD_URL, 'PENDING', 'Building...') + utils.reportGitHubStatus (isPr ? env.ghprbActualCommit : commitHash, 'PKG-mono', env.BUILD_URL, 'PENDING', 'Building...') // build the .pkg timeout (time: 420, unit: 'MINUTES') { @@ -79,12 +82,12 @@ try { def packageUrl = "https://${downloadHost}/${jobName}/${monoBranch}/${env.BUILD_NUMBER}/${commitHash}" currentBuild.description = "<hr/><h2>DOWNLOAD: <a href=\"${packageUrl}/${packageFileName}\">${packageFileName}</a></h2><hr/>" - if (isReleaseJob) { reportGitHubStatus (isPr ? env.ghprbActualCommit : commitHash, 'artifacts.json', "${packageUrl}/artifacts.json", 'SUCCESS', '') } - reportGitHubStatus (isPr ? env.ghprbActualCommit : commitHash, 'PKG-mono', "${packageUrl}/${packageFileName}", 'SUCCESS', packageFileName) + if (isReleaseJob) { utils.reportGitHubStatus (isPr ? env.ghprbActualCommit : commitHash, 'artifacts.json', "${packageUrl}/artifacts.json", 'SUCCESS', '') } + utils.reportGitHubStatus (isPr ? env.ghprbActualCommit : commitHash, 'PKG-mono', "${packageUrl}/${packageFileName}", 'SUCCESS', packageFileName) } } catch (Exception e) { - reportGitHubStatus (isPr ? env.ghprbActualCommit : commitHash, 'PKG-mono', env.BUILD_URL, 'FAILURE', "Build failed.") + utils.reportGitHubStatus (isPr ? env.ghprbActualCommit : commitHash, 'PKG-mono', env.BUILD_URL, 'FAILURE', "Build failed.") throw e } @@ -104,13 +107,3 @@ if (!isPr || isWindowsPrBuild) { // trigger the Windows build build(job: "${windowsJobName}", wait: false, parameters: parameters) } - -def reportGitHubStatus(commitHash, context, backref, statusResult, statusResultMessage) { - step([ - $class: 'GitHubCommitStatusSetter', - commitShaSource: [$class: "ManuallyEnteredShaSource", sha: commitHash], - contextSource: [$class: 'ManuallyEnteredCommitContextSource', context: context], - statusBackrefSource: [$class: 'ManuallyEnteredBackrefSource', backref: backref], - statusResultSource: [$class: 'ConditionalStatusResultSource', results: [[$class: 'AnyBuildResult', state: statusResult, message: statusResultMessage]]] - ]) -} diff --git a/scripts/ci/pipeline/sdks-archive.groovy b/scripts/ci/pipeline/sdks-archive.groovy index 25c6cf2181d..ae00ebc3942 100644 --- a/scripts/ci/pipeline/sdks-archive.groovy +++ b/scripts/ci/pipeline/sdks-archive.groovy @@ -60,22 +60,13 @@ parallel ( } ) -def reportGitHubStatus(commitHash, context, backref, statusResult, statusResultMessage) { - step([ - $class: 'GitHubCommitStatusSetter', - commitShaSource: [$class: "ManuallyEnteredShaSource", sha: commitHash], - contextSource: [$class: 'ManuallyEnteredCommitContextSource', context: context], - statusBackrefSource: [$class: 'ManuallyEnteredBackrefSource', backref: backref], - statusResultSource: [$class: 'ConditionalStatusResultSource', results: [[$class: 'AnyBuildResult', state: statusResult, message: statusResultMessage]]] - ]) -} - def archive (product, configuration, platform, chrootname = "", chrootadditionalpackages = "", chrootBindMounts = "") { def isPr = (env.ghprbPullId && !env.ghprbPullId.empty ? true : false) def monoBranch = (isPr ? "pr" : env.BRANCH_NAME) def jobName = (isPr ? "archive-mono-pullrequest" : "archive-mono") def packageFileName = null def commitHash = null + def utils = null ws ("workspace/${jobName}/${monoBranch}/${product}/${configuration}") { timestamps { @@ -85,6 +76,8 @@ def archive (product, configuration, platform, chrootname = "", chrootadditional // clone and checkout repo checkout scm + utils = load "scripts/ci/pipeline/utils.groovy" + // remove old stuff sh 'git reset --hard HEAD' // homebrew Git 2.22.0 misparses the submodule command and passes arguments like --hard and -xdff @@ -100,7 +93,7 @@ def archive (product, configuration, platform, chrootname = "", chrootadditional } try { stage('Build') { - reportGitHubStatus (isPr ? env.ghprbActualCommit : commitHash, "Archive-${product}-${configuration}-${platform}", env.BUILD_URL, 'PENDING', 'Building...') + utils.reportGitHubStatus (isPr ? env.ghprbActualCommit : commitHash, "Archive-${product}-${configuration}-${platform}", env.BUILD_URL, 'PENDING', 'Building...') // build the Archive timeout (time: 300, unit: 'MINUTES') { @@ -135,10 +128,10 @@ def archive (product, configuration, platform, chrootname = "", chrootadditional uploadArtifactsOnlyIfSuccessful: true) } - reportGitHubStatus (isPr ? env.ghprbActualCommit : commitHash, "Archive-${product}-${configuration}-${platform}", "https://xamjenkinsartifact.azureedge.net/mono-sdks/${packageFileName}", 'SUCCESS', packageFileName) + utils.reportGitHubStatus (isPr ? env.ghprbActualCommit : commitHash, "Archive-${product}-${configuration}-${platform}", "https://xamjenkinsartifact.azureedge.net/mono-sdks/${packageFileName}", 'SUCCESS', packageFileName) } catch (Exception e) { - reportGitHubStatus (isPr ? env.ghprbActualCommit : commitHash, "Archive-${product}-${configuration}-${platform}", env.BUILD_URL, 'FAILURE', "Build failed.") + utils.reportGitHubStatus (isPr ? env.ghprbActualCommit : commitHash, "Archive-${product}-${configuration}-${platform}", env.BUILD_URL, 'FAILURE', "Build failed.") throw e } } diff --git a/scripts/ci/pipeline/utils.groovy b/scripts/ci/pipeline/utils.groovy new file mode 100644 index 00000000000..2b2efd4d381 --- /dev/null +++ b/scripts/ci/pipeline/utils.groovy @@ -0,0 +1,13 @@ +def reportGitHubStatus(commitHash, context, backref, statusResult, statusResultMessage) { + node("master") { + step([ + $class: 'GitHubCommitStatusSetter', + commitShaSource: [$class: "ManuallyEnteredShaSource", sha: commitHash], + contextSource: [$class: 'ManuallyEnteredCommitContextSource', context: context], + statusBackrefSource: [$class: 'ManuallyEnteredBackrefSource', backref: backref], + statusResultSource: [$class: 'ConditionalStatusResultSource', results: [[$class: 'AnyBuildResult', state: statusResult, message: statusResultMessage]]] + ]) + } +} + +return this diff --git a/scripts/ci/pipeline/win-package.groovy b/scripts/ci/pipeline/win-package.groovy index 2f6f288da98..1f163f7c613 100644 --- a/scripts/ci/pipeline/win-package.groovy +++ b/scripts/ci/pipeline/win-package.groovy @@ -6,6 +6,7 @@ def macJobName = (isPr ? "build-package-osx-mono-pullrequest" : "build-package-o def packageFileNameX86 = null def packageFileNameX64 = null def commitHash = null +def utils = null // compression is incompatible with JEP-210 right now properties([ /* compressBuildLog() */]) @@ -25,6 +26,8 @@ try { // get current commit sha commitHash = sh (script: 'git rev-parse HEAD', returnStdout: true).trim() currentBuild.displayName = "${commitHash.substring(0,7)}" + + utils = load "scripts/ci/pipeline/utils.groovy" } stage('Download Mac .pkg from Azure') { @@ -37,8 +40,8 @@ try { } stage('Build') { - reportGitHubStatus (isPr ? env.ghprbActualCommit : commitHash, 'MSI-mono_x86', env.BUILD_URL, 'PENDING', 'Building...') - reportGitHubStatus (isPr ? env.ghprbActualCommit : commitHash, 'MSI-mono_x64', env.BUILD_URL, 'PENDING', 'Building...') + utils.reportGitHubStatus (isPr ? env.ghprbActualCommit : commitHash, 'MSI-mono_x86', env.BUILD_URL, 'PENDING', 'Building...') + utils.reportGitHubStatus (isPr ? env.ghprbActualCommit : commitHash, 'MSI-mono_x64', env.BUILD_URL, 'PENDING', 'Building...') // build the .msi timeout (time: 420, unit: 'MINUTES') { @@ -100,22 +103,12 @@ try { def packageUrlX64 = "https://xamjenkinsartifact.azureedge.net/${jobName}/${monoBranch}/${env.BUILD_NUMBER}/${commitHash}/${packageFileNameX64}"; currentBuild.description = "<hr/><h2>DOWNLOAD: <a href=\"${packageUrlX86}\">${packageFileNameX86}</a> -- <a href=\"${packageUrlX64}\">${packageFileNameX64}</a></h2><hr/>" - reportGitHubStatus (isPr ? env.ghprbActualCommit : commitHash, 'MSI-mono_x86', packageUrlX86, 'SUCCESS', packageFileNameX86) - reportGitHubStatus (isPr ? env.ghprbActualCommit : commitHash, 'MSI-mono_x64', packageUrlX64, 'SUCCESS', packageFileNameX64) + utils.reportGitHubStatus (isPr ? env.ghprbActualCommit : commitHash, 'MSI-mono_x86', packageUrlX86, 'SUCCESS', packageFileNameX86) + utils.reportGitHubStatus (isPr ? env.ghprbActualCommit : commitHash, 'MSI-mono_x64', packageUrlX64, 'SUCCESS', packageFileNameX64) } } catch (Exception e) { - reportGitHubStatus (isPr ? env.ghprbActualCommit : commitHash, 'MSI-mono_x86', env.BUILD_URL, 'FAILURE', "Build failed.") - reportGitHubStatus (isPr ? env.ghprbActualCommit : commitHash, 'MSI-mono_x64', env.BUILD_URL, 'FAILURE', "Build failed.") + utils.reportGitHubStatus (isPr ? env.ghprbActualCommit : commitHash, 'MSI-mono_x86', env.BUILD_URL, 'FAILURE', "Build failed.") + utils.reportGitHubStatus (isPr ? env.ghprbActualCommit : commitHash, 'MSI-mono_x64', env.BUILD_URL, 'FAILURE', "Build failed.") throw e } - -def reportGitHubStatus(commitHash, context, backref, statusResult, statusResultMessage) { - step([ - $class: 'GitHubCommitStatusSetter', - commitShaSource: [$class: "ManuallyEnteredShaSource", sha: commitHash], - contextSource: [$class: 'ManuallyEnteredCommitContextSource', context: context], - statusBackrefSource: [$class: 'ManuallyEnteredBackrefSource', backref: backref], - statusResultSource: [$class: 'ConditionalStatusResultSource', results: [[$class: 'AnyBuildResult', state: statusResult, message: statusResultMessage]]] - ]) -} |