diff --git a/.ci/jenkins/Jenkinsfile.build-image b/.ci/jenkins/Jenkinsfile.build-image index efa450ba2..ccf13aba0 100644 --- a/.ci/jenkins/Jenkinsfile.build-image +++ b/.ci/jenkins/Jenkinsfile.build-image @@ -35,8 +35,6 @@ pipeline { sh 'printenv' - setupGithubCommitStatus() - assert getBuildImageName() : 'Please provide `BUILD_IMAGE_NAME` parameter' currentBuild.displayName = params.DISPLAY_NAME ?: currentBuild.displayName @@ -49,6 +47,8 @@ pipeline { checkout(githubscm.resolveRepository(getRepoName(), getSourceAuthor(), getSourceBranch(), false)) } + updateGithubCommitStatus() + if (isProdCI()) { // Prod fix to be able to build the image as a community one sh "echo '' > content_sets.yaml" @@ -110,8 +110,6 @@ pipeline { dir('target/image') { cloud.dockerBuildMultiPlatformImages(getBuiltImageTag(), getImageBuildPlatforms(), shouldDeployImage(), squashMessage) } - - updateGithubCommitStatus() } } } @@ -357,15 +355,16 @@ String getQuarkusPlatformURL() { // Update commit status def getRepoURL() { - String url = sh(returnStdout: true, script: 'git config --get remote.origin.url').trim() - echo "Got Repo URL -> ${url}" - return url + return "https://github.com/${getSourceAuthor()}/${getRepoName()}" } def getCommitSha() { - String sha = sh(returnStdout: true, script: "git show-ref -s ${getSourceBranch()}").trim() - echo "Got Commit SHA -> ${sha}" - return sha + dir('temp-source') { + checkout(githubscm.resolveRepository(getRepoName(), getSourceAuthor(), getSourceBranch(), false)) + String sha = sh(returnStdout: true, script: "git show-ref -s ${getSourceBranch()} | head -n 1").trim() + echo "Got Commit SHA -> ${sha}" + return sha + } } def setupGithubCommitStatus() { @@ -390,6 +389,7 @@ def updateGithubCommitStatus() { statusResultSource: [ $class: 'ConditionalStatusResultSource', results: [ + [$class: 'BetterThanOrEqualBuildResult', result: 'PENDING', state: 'PENDING', message: 'anything'], [$class: 'BetterThanOrEqualBuildResult', result: 'SUCCESS', state: 'SUCCESS', message: 'anything'], [$class: 'BetterThanOrEqualBuildResult', result: 'FAILURE', state: 'FAILURE', message: 'anything'], [$class: 'AnyBuildResult', state: 'FAILURE', message: 'Loophole']