Merge pull request #6592 from corda/wz/merge-os-45-46-2020-08-07

NOTICK: Merging forward updates from OS 4.5 to OS 4.6
This commit is contained in:
Waldemar Żurowski 2020-08-07 13:23:49 +01:00 committed by GitHub
commit 922dbe8544
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 66 additions and 15 deletions

View File

@ -25,15 +25,28 @@ boolean isReleaseTag = (env.TAG_NAME =~ /^release.*JDK11$/)
** * stage-release: for release candidates and for health checks ** * stage-release: for release candidates and for health checks
** * operate: for final release ** * operate: for final release
*/ */
def nexusIqStage = "build" def nexusDefaultIqStage = "build"
if (isReleaseTag) { if (isReleaseTag) {
switch (env.TAG_NAME) { switch (env.TAG_NAME) {
case ~/.*-RC\d+(-.*)?/: nexusIqStage = "stage-release"; break; case ~/.*-RC\d+(-.*)?/: nexusDefaultIqStage = "stage-release"; break;
case ~/.*-HC\d+(-.*)?/: nexusIqStage = "stage-release"; break; case ~/.*-HC\d+(-.*)?/: nexusDefaultIqStage = "stage-release"; break;
default: nexusIqStage = "release" default: nexusDefaultIqStage = "release"
} }
} }
/**
* make sure calculated default value of NexusIQ stage is first in the list
* thus making it default for the `choice` parameter
*/
def nexusIqStageChoices = [nexusDefaultIqStage].plus(
[
'develop',
'build',
'stage-release',
'release',
'operate'
].minus([nexusDefaultIqStage]))
pipeline { pipeline {
agent { label 'k8s' } agent { label 'k8s' }
options { options {
@ -42,6 +55,10 @@ pipeline {
buildDiscarder(logRotator(daysToKeepStr: '14', artifactDaysToKeepStr: '14')) buildDiscarder(logRotator(daysToKeepStr: '14', artifactDaysToKeepStr: '14'))
} }
parameters {
choice choices: nexusIqStageChoices, description: 'NexusIQ stage for code evaluation', name: 'nexusIqStage'
}
environment { environment {
DOCKER_TAG_TO_USE = "${env.GIT_COMMIT.subSequence(0, 8)}JDK11" DOCKER_TAG_TO_USE = "${env.GIT_COMMIT.subSequence(0, 8)}JDK11"
EXECUTOR_NUMBER = "${env.EXECUTOR_NUMBER}" EXECUTOR_NUMBER = "${env.EXECUTOR_NUMBER}"
@ -68,13 +85,13 @@ pipeline {
def version = sh (returnStdout: true, script: "grep ^version: version-properties | sed -e 's/^version: \\([0-9]\\+\\.[0-9]\\+\\).*\$/\\1/'").trim() def version = sh (returnStdout: true, script: "grep ^version: version-properties | sed -e 's/^version: \\([0-9]\\+\\.[0-9]\\+\\).*\$/\\1/'").trim()
def groupId = sh (returnStdout: true, script: "grep ^group: version-properties | sed -e 's/^group: //'").trim() def groupId = sh (returnStdout: true, script: "grep ^group: version-properties | sed -e 's/^group: //'").trim()
def artifactId = 'corda' def artifactId = 'corda'
nexusAppId = "jenkins-${groupId}-${artifactId}-jdk11-${version}" nexusAppId = "${groupId}-${artifactId}-${version}"
} }
nexusPolicyEvaluation ( nexusPolicyEvaluation (
failBuildOnNetworkError: false, failBuildOnNetworkError: false,
iqApplication: selectedApplication(nexusAppId), // application *has* to exist before a build starts! iqApplication: selectedApplication(nexusAppId), // application *has* to exist before a build starts!
iqScanPatterns: [[scanPattern: 'node/capsule/build/libs/corda*.jar']], iqScanPatterns: [[scanPattern: 'node/capsule/build/libs/corda*.jar']],
iqStage: nexusIqStage iqStage: params.nexusIqStage
) )
} }
} }

View File

@ -18,7 +18,20 @@ killAllExistingBuildsForJob(env.JOB_NAME, env.BUILD_NUMBER.toInteger())
** calculate the stage for NexusIQ evaluation ** calculate the stage for NexusIQ evaluation
** * build for snapshots ** * build for snapshots
*/ */
def nexusIqStage = "build" def nexusDefaultIqStage = "build"
/**
* make sure calculated default value of NexusIQ stage is first in the list
* thus making it default for the `choice` parameter
*/
def nexusIqStageChoices = [nexusDefaultIqStage].plus(
[
'develop',
'build',
'stage-release',
'release',
'operate'
].minus([nexusDefaultIqStage]))
pipeline { pipeline {
agent { label 'standard' } agent { label 'standard' }
@ -31,6 +44,10 @@ pipeline {
buildDiscarder(logRotator(daysToKeepStr: '14', artifactDaysToKeepStr: '14')) buildDiscarder(logRotator(daysToKeepStr: '14', artifactDaysToKeepStr: '14'))
} }
parameters {
choice choices: nexusIqStageChoices, description: 'NexusIQ stage for code evaluation', name: 'nexusIqStage'
}
triggers { triggers {
cron '@midnight' cron '@midnight'
} }
@ -53,13 +70,13 @@ pipeline {
def version = sh (returnStdout: true, script: "grep ^version: version-properties | sed -e 's/^version: \\([0-9]\\+\\.[0-9]\\+\\).*\$/\\1/'").trim() def version = sh (returnStdout: true, script: "grep ^version: version-properties | sed -e 's/^version: \\([0-9]\\+\\.[0-9]\\+\\).*\$/\\1/'").trim()
def groupId = sh (returnStdout: true, script: "grep ^group: version-properties | sed -e 's/^group: //'").trim() def groupId = sh (returnStdout: true, script: "grep ^group: version-properties | sed -e 's/^group: //'").trim()
def artifactId = 'corda' def artifactId = 'corda'
nexusAppId = "jenkins-${groupId}-${artifactId}-${version}" nexusAppId = "${groupId}-${artifactId}-${version}"
} }
nexusPolicyEvaluation ( nexusPolicyEvaluation (
failBuildOnNetworkError: false, failBuildOnNetworkError: false,
iqApplication: selectedApplication(nexusAppId), // application *has* to exist before a build starts! iqApplication: selectedApplication(nexusAppId), // application *has* to exist before a build starts!
iqScanPatterns: [[scanPattern: 'node/capsule/build/libs/corda*.jar']], iqScanPatterns: [[scanPattern: 'node/capsule/build/libs/corda*.jar']],
iqStage: nexusIqStage iqStage: params.nexusIqStage
) )
} }
} }

View File

@ -25,15 +25,28 @@ boolean isInternalRelease = (env.TAG_NAME =~ /^internal-release-.*$/)
** * stage-release: for release candidates and for health checks ** * stage-release: for release candidates and for health checks
** * operate: for final release ** * operate: for final release
*/ */
def nexusIqStage = "build" def nexusDefaultIqStage = "build"
if (isReleaseTag) { if (isReleaseTag) {
switch (env.TAG_NAME) { switch (env.TAG_NAME) {
case ~/.*-RC\d+(-.*)?/: nexusIqStage = "stage-release"; break; case ~/.*-RC\d+(-.*)?/: nexusDefaultIqStage = "stage-release"; break;
case ~/.*-HC\d+(-.*)?/: nexusIqStage = "stage-release"; break; case ~/.*-HC\d+(-.*)?/: nexusDefaultIqStage = "stage-release"; break;
default: nexusIqStage = "release" default: nexusDefaultIqStage = "release"
} }
} }
/**
* make sure calculated default value of NexusIQ stage is first in the list
* thus making it default for the `choice` parameter
*/
def nexusIqStageChoices = [nexusDefaultIqStage].plus(
[
'develop',
'build',
'stage-release',
'release',
'operate'
].minus([nexusDefaultIqStage]))
pipeline { pipeline {
agent { label 'k8s' } agent { label 'k8s' }
options { options {
@ -43,6 +56,10 @@ pipeline {
buildDiscarder(logRotator(daysToKeepStr: '14', artifactDaysToKeepStr: '14')) buildDiscarder(logRotator(daysToKeepStr: '14', artifactDaysToKeepStr: '14'))
} }
parameters {
choice choices: nexusIqStageChoices, description: 'NexusIQ stage for code evaluation', name: 'nexusIqStage'
}
environment { environment {
DOCKER_TAG_TO_USE = "${env.GIT_COMMIT.subSequence(0, 8)}" DOCKER_TAG_TO_USE = "${env.GIT_COMMIT.subSequence(0, 8)}"
DOCKER_URL = "https://index.docker.io/v1/" DOCKER_URL = "https://index.docker.io/v1/"
@ -70,13 +87,13 @@ pipeline {
def version = sh (returnStdout: true, script: "grep ^version: version-properties | sed -e 's/^version: \\([0-9]\\+\\.[0-9]\\+\\).*\$/\\1/'").trim() def version = sh (returnStdout: true, script: "grep ^version: version-properties | sed -e 's/^version: \\([0-9]\\+\\.[0-9]\\+\\).*\$/\\1/'").trim()
def groupId = sh (returnStdout: true, script: "grep ^group: version-properties | sed -e 's/^group: //'").trim() def groupId = sh (returnStdout: true, script: "grep ^group: version-properties | sed -e 's/^group: //'").trim()
def artifactId = 'corda' def artifactId = 'corda'
nexusAppId = "jenkins-${groupId}-${artifactId}-${version}" nexusAppId = "${groupId}-${artifactId}-${version}"
} }
nexusPolicyEvaluation ( nexusPolicyEvaluation (
failBuildOnNetworkError: false, failBuildOnNetworkError: false,
iqApplication: selectedApplication(nexusAppId), // application *has* to exist before a build starts! iqApplication: selectedApplication(nexusAppId), // application *has* to exist before a build starts!
iqScanPatterns: [[scanPattern: 'node/capsule/build/libs/corda*.jar']], iqScanPatterns: [[scanPattern: 'node/capsule/build/libs/corda*.jar']],
iqStage: nexusIqStage iqStage: params.nexusIqStage
) )
} }
} }