Skip to content

Commit

Permalink
Merge pull request #60 from jbw976/ci-builds
Browse files Browse the repository at this point in the history
build: Jenkinsfile updates for this package only crossplane-runtime repo
  • Loading branch information
jbw976 authored Oct 26, 2019
2 parents 78072ef + 2d30755 commit 6916b94
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 54 deletions.
55 changes: 1 addition & 54 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -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.")
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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 {
Expand Down
8 changes: 8 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 6916b94

Please sign in to comment.