@Library('corda-shared-build-pipeline-steps') import static com.r3.build.BuildControl.killAllExistingBuildsForJob killAllExistingBuildsForJob(env.JOB_NAME, env.BUILD_NUMBER.toInteger()) pipeline { agent { label 'standard' } options { timestamps() timeout(time: 3, unit: 'HOURS') buildDiscarder(logRotator(daysToKeepStr: '14', artifactDaysToKeepStr: '14')) } /* * List environment variables in alphabetical order */ environment { ARTIFACTORY_CREDENTIALS = credentials('artifactory-credentials') BUILD_CACHE_CREDENTIALS = credentials('gradle-ent-cache-credentials') BUILD_CACHE_PASSWORD = "${env.BUILD_CACHE_CREDENTIALS_PSW}" BUILD_CACHE_USERNAME = "${env.BUILD_CACHE_CREDENTIALS_USR}" CORDA_ARTIFACTORY_PASSWORD = "${env.ARTIFACTORY_CREDENTIALS_PSW}" CORDA_ARTIFACTORY_USERNAME = "${env.ARTIFACTORY_CREDENTIALS_USR}" CORDA_GRADLE_SCAN_KEY = credentials('gradle-build-scans-key') CORDA_USE_CACHE = "corda-remotes" C4_OS_SNYK_ORG_ID = credentials('c4-os-snyk-org-id') SNYK_API_TOKEN = credentials('c4-os-snyk-api-token-secret') } stages { stage('Detekt check') { steps { authenticateGradleWrapper() sh "./gradlew --no-daemon --parallel --build-cache clean detekt" } } stage('Compilation warnings check') { steps { sh "./gradlew --no-daemon --parallel --build-cache -Pcompilation.warningsAsErrors=true compileAll" } } stage('Snyk Delta') { agent { docker { image 'build-zulu-openjdk:8' reuseNode true registryUrl 'https://engineering-docker.software.r3.com/' registryCredentialsId 'artifactory-credentials' args '-v /tmp:/host_tmp' } } environment { GRADLE_USER_HOME = "/host_tmp/gradle" } steps { authenticateGradleWrapper() sh 'mkdir -p ${GRADLE_USER_HOME}' authenticateGradleWrapper() snykDeltaScan(env.SNYK_API_TOKEN, env.C4_OS_SNYK_ORG_ID) } } stage('No API change check') { steps { sh "./gradlew --no-daemon --parallel --build-cache generateApi" sh ".ci/check-api-changes.sh" } } stage('Deploy Nodes') { steps { sh "./gradlew --no-daemon --build-cache jar deployNodes" } } } post { always { findBuildScans() } cleanup { deleteDir() /* clean up our workspace */ } } }