Merge pull request #60 from jbw976/ci-builds

build: Jenkinsfile updates for this package only crossplane-runtime repo
This commit is contained in:
Jared Watts 2019-10-26 09:53:13 -07:00 committed by GitHub
commit 6916b9475f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 54 deletions

55
Jenkinsfile vendored
View File

@ -25,7 +25,7 @@ pipeline {
steps {
script {
if (env.CHANGE_ID != null) {
def json = sh (script: "curl -s https://api.github.com/repos/crossplaneio/crossplane/pulls/${env.CHANGE_ID}", returnStdout: true).trim()
def json = sh (script: "curl -s https://api.github.com/repos/crossplaneio/crossplane-runtime/pulls/${env.CHANGE_ID}", returnStdout: true).trim()
def body = evaluateJson(json,'${json.body}')
if (body.contains("[skip ci]")) {
echo ("'[skip ci]' spotted in PR body text.")
@ -119,40 +119,6 @@ pipeline {
}
}
stage('SonarQube Analysis') {
when {
expression {
return env.shouldBuild != "false"
}
}
steps {
script {
scannerHome = tool 'SonarQubeScanner'
scannerParams = ''
if (env.CHANGE_ID == null) {
scannerParams = "-Dsonar.branch.name=${BRANCH_NAME} "
if (BRANCH_NAME != 'master') {
scannerParams = "${scannerParams} -Dsonar.branch.target=master"
}
} else {
scannerParams = "-Dsonar.pullrequest.base=master " +
"-Dsonar.pullrequest.branch=${env.BRANCH_NAME} " +
"-Dsonar.pullrequest.key=${env.CHANGE_ID} " +
"-Dsonar.pullrequest.provider=github " +
"-Dsonar.pullrequest.github.repository=crossplaneio/${env.REPOSITORY_NAME}"
}
}
withSonarQubeEnv('SonarQubeCrossplane') {
sh "${scannerHome}/bin/sonar-scanner " +
"-Dsonar.projectKey=crossplaneio_${env.REPOSITORY_NAME} " +
"-Dsonar.projectName=${env.REPOSITORY_NAME} " +
"-Dsonar.organization=crossplane " +
"-Dsonar.sources=. ${scannerParams} "
}
}
}
stage('Record Coverage') {
when {
allOf {
@ -185,25 +151,6 @@ pipeline {
step([$class: 'CompareCoverageAction', publishResultAs: 'comment', scmVars: [GIT_URL: env.GIT_URL]])
}
}
stage('Publish') {
when {
expression {
return env.shouldBuild != "false"
}
}
steps {
sh 'docker login -u="${DOCKER_USR}" -p="${DOCKER_PSW}"'
sh "./build/run make -j\$(nproc) publish BRANCH_NAME=${BRANCH_NAME} AWS_ACCESS_KEY_ID=${AWS_USR} AWS_SECRET_ACCESS_KEY=${AWS_PSW} GIT_API_TOKEN=${GITHUB_UPBOUND_BOT}"
script {
if (BRANCH_NAME == 'master') {
lock('promote-job') {
sh "./build/run make -j\$(nproc) promote BRANCH_NAME=master CHANNEL=master AWS_ACCESS_KEY_ID=${AWS_USR} AWS_SECRET_ACCESS_KEY=${AWS_PSW}"
}
}
}
}
}
}
post {

View File

@ -11,6 +11,14 @@ PLATFORMS ?= linux_amd64 linux_arm64
# to run a target until the include commands succeeded.
-include build/makelib/common.mk
# ====================================================================================
# Setup Images
# even though this repo doesn't build images (note the no-op img.build target below),
# some of the init is needed for the cross build container, e.g. setting BUILD_REGISTRY
-include build/makelib/image.mk
img.build:
# ====================================================================================
# Setup Go