diff --git a/Jenkinsfile b/Jenkinsfile index 3021fba3ffc6e..5ae8630011ccb 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -68,6 +68,10 @@ final String buildTimestamp = String.format('-%tY%&1 | tee $BUILD_LOG_FILE | grep -E '$MAVEN_GREP_FILTER' + """.stripIndent() } } post { always { + script { + jenkinsJobTools.job_description_append("You will find full build logs in artefacts as $BUILD_LOG_FILE") + archiveArtifacts artifacts: "${"**/$BUILD_LOG_FILE"}", allowEmptyArchive: false, onlyIfSuccessful: false + } recordIssues( enabledForFailure: false, tools: [ @@ -440,6 +452,7 @@ pipeline { } } } + stage('Maven deploy') { when { anyOf { @@ -457,7 +470,8 @@ pipeline { set -xe bash mvn deploy $deployOptions \ $extraBuildParams \ - --settings .jenkins/settings.xml + --settings .jenkins/settings.xml \ + 2>&1 | tee $DEPLOY_LOG_FILE | grep -E '$MAVEN_GREP_FILTER' """.stripIndent() } } @@ -467,8 +481,7 @@ pipeline { if (devBranch_mavenDeploy) { repo = ['artifacts-zl.talend.com', 'https://artifacts-zl.talend.com/nexus/content/repositories/snapshots/org/talend/sdk/component'] - } - else { + } else { repo = ['oss.sonatype.org', 'https://oss.sonatype.org/content/repositories/snapshots/org/talend/sdk/component/'] } @@ -476,7 +489,16 @@ pipeline { jenkinsJobTools.job_description_append("Maven artefact deployed as ${finalVersion} on [${repo[0]}](${repo[1]}) ") } } + post { + always { + script { + jenkinsJobTools.job_description_append("You will find full deploy logs in artefacts as $DEPLOY_LOG_FILE") + archiveArtifacts artifacts: "${"**/$DEPLOY_LOG_FILE"}", allowEmptyArchive: false, onlyIfSuccessful: false + } + } + } } + stage('Docker build/push') { when { anyOf { @@ -492,13 +514,11 @@ pipeline { if (isStdBranch) { // Build and push all images jenkinsJobTools.job_description_append("Docker images deployed: component-server, component-starter-server and remote-engine-customizer ") - } - else { + } else { String image_list if (params.DOCKER_CHOICE == 'All') { images_options = 'false' - } - else { + } else { images_options = 'false ' + params.DOCKER_CHOICE } @@ -506,25 +526,22 @@ pipeline { jenkinsJobTools.job_description_append("All docker images deployed ") jenkinsJobTools.job_description_append("As ${finalVersion}${buildTimestamp} on " + - "[artifactory.datapwn.com]" + - "($artifactoryAddr/$artifactoryPath) ") + "[artifactory.datapwn.com]" + + "($artifactoryAddr/$artifactoryPath) ") jenkinsJobTools.job_description_append("docker pull $artifactoryAddr/$artifactoryPath" + - "/component-server:${finalVersion}${buildTimestamp} ") + "/component-server:${finalVersion}${buildTimestamp} ") jenkinsJobTools.job_description_append("docker pull $artifactoryAddr/$artifactoryPath" + - "/component-starter-server:${finalVersion}${buildTimestamp} ") + "/component-starter-server:${finalVersion}${buildTimestamp} ") jenkinsJobTools.job_description_append("docker pull $artifactoryAddr/$artifactoryPath" + - "/remote-engine-customize:${finalVersion}${buildTimestamp} ") + "/remote-engine-customize:${finalVersion}${buildTimestamp} ") - } - else { + } else { jenkinsJobTools.job_description_append("Docker images deployed: $params.DOCKER_CHOICE ") jenkinsJobTools.job_description_append("As ${finalVersion}${buildTimestamp} on " + - "[artifactory.datapwn.com]($artifactoryAddr/$artifactoryPath) ") + "[artifactory.datapwn.com]($artifactoryAddr/$artifactoryPath) ") jenkinsJobTools.job_description_append("docker pull $artifactoryAddr/$artifactoryPath/$params.DOCKER_CHOICE:" + - "${finalVersion}${buildTimestamp} ") - + "${finalVersion}${buildTimestamp} ") } - } // Build and push specific image @@ -534,10 +551,10 @@ pipeline { ${images_options} """ } - } } } + stage('Documentation') { when { expression { @@ -559,6 +576,7 @@ pipeline { } } } + stage('OSS security analysis') { when { anyOf { @@ -589,6 +607,7 @@ pipeline { } } } + stage('Deps report') { when { anyOf { @@ -628,6 +647,7 @@ pipeline { } } } + stage('Sonar') { when { expression { (params.ACTION != 'RELEASE') && !params.DISABLE_SONAR } @@ -648,8 +668,7 @@ pipeline { '${pull_request_id}' \ ${extraBuildParams} """ - } - else { + } else { echo 'Run analysis for branch' sh """ bash .jenkins/scripts/mvn_sonar_branch.sh \ @@ -661,6 +680,7 @@ pipeline { } } } + stage('Release') { when { allOf { @@ -838,12 +858,10 @@ private static String add_qualifier_to_version(String version, String ticket, St if (user_qualifier.contains("DEFAULT")) { if (version.contains("-SNAPSHOT")) { new_version = version.replace("-SNAPSHOT", "-$ticket-SNAPSHOT" as String) - } - else { + } else { new_version = "$version-$ticket".toString() } - } - else { + } else { new_version = version.replace("-SNAPSHOT", "-$user_qualifier-SNAPSHOT" as String) } return new_version