Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge pull request #9173 from AdamBrousseau/internal_prs
Support PR builds from non-default repos
  • Loading branch information
pshipton committed Apr 8, 2020
2 parents 0109183 + 460de2c commit 23b61bc
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 8 deletions.
10 changes: 6 additions & 4 deletions buildenv/jenkins/common/build.groovy
Expand Up @@ -113,17 +113,17 @@ def checkout_pullrequest() {
// Cannot depend on a change from the same repo as the source repo
def SOURCE_REPO_MESSAGE
switch (params.ghprbGhRepository) {
case "eclipse/openj9-omr":
case ~/.*\/openj9-omr/:
omr_bool = true
OMR_PR = params.ghprbPullId
SOURCE_REPO_MESSAGE = "PullRequest source repo appears to be OpenJ9-OMR"
break
case "eclipse/openj9":
case ~/.*\/openj9/:
openj9_bool = true
OPENJ9_PR = params.ghprbPullId
SOURCE_REPO_MESSAGE = "PullRequest source repo appears to be OpenJ9"
break
case ~/ibmruntimes(.*)/:
case ~/.*openj9-openjdk-jdk.*/:
openjdk_bool = true
OPENJDK_PR = params.ghprbPullId
SOURCE_REPO_MESSAGE = "PullRequest source repo appears to be OpenJDK"
Expand Down Expand Up @@ -198,7 +198,7 @@ def checkout_pullrequest() {
checkout_pullrequest(OPENJDK_PR, "ibmruntimes/openj9-openjdk-jdk${JDK_REPO_SUFFIX}")
}

sh "bash ./get_source.sh ${EXTRA_GETSOURCE_OPTIONS}"
sh "bash ./get_source.sh ${EXTRA_GETSOURCE_OPTIONS} ${OPENJ9_REPO_OPTION} ${OPENJ9_BRANCH_OPTION} ${OPENJ9_SHA_OPTION} ${OMR_REPO_OPTION} ${OMR_BRANCH_OPTION} ${OMR_SHA_OPTION}"

// Checkout dependent PRs, if any were specified
if (openj9_bool) {
Expand All @@ -225,6 +225,8 @@ def checkout_pullrequest(ID, REPO) {
fetchRef("pull/${ID}/merge", "pr/${ID}/merge" )
checkoutRef ("pr/${ID}/merge")
} catch (e) {
// If merge ref doesn't exist, checkout PR base branch.
// Not going to fix this to work for internal PRs.
def JSONFILE = ""
def BASEREF = ""
def URL = "https://api.github.com/repos/${REPO}/pulls/${ID}"
Expand Down
7 changes: 6 additions & 1 deletion buildenv/jenkins/common/pipeline-functions.groovy
Expand Up @@ -714,14 +714,19 @@ def setup_pull_request_single_comment(parsedComment) {
// Setup JDK VERSIONS
switch (ghprbGhRepository) {
case ~/.*openj9-openjdk-jdk.*/:
// <org>/openj9-openjdk-jdk<version>(-zos)?
def tmp_version = ghprbGhRepository.substring(ghprbGhRepository.indexOf('-jdk')+4)
if ("${tmp_version}" == "") {
tmp_version = 'next'
}
if (tmp_version.contains('-')) {
// Strip off '-zos'
tmp_version = tmp_version.substring(0, tmp_version.indexOf('-'))
}
RELEASES.add(tmp_version)
minCommentSize = 3
break
case "eclipse/openj9":
case ~/.*\/openj9(-omr)?/:
def tmpVersions = parsedComment[3+offset].tokenize(',')
tmpVersions.each { version ->
echo "VERSION:'${version}'"
Expand Down
Expand Up @@ -135,7 +135,8 @@ SHORT_NAMES = ['all' : ['ppc64le_linux','ppc64le_linux_xl','s390x_linux','s390x_
'osxxl' : ['x86-64_mac_xl'],
'alinux64' : ['aarch64_linux'],
'alinux64xl' : ['aarch64_linux_xl'],
'alinux64largeheap' : ['aarch64_linux_xl']]
'alinux64largeheap' : ['aarch64_linux_xl'],
'zos' : ['s390x_zos']]

// Initialize all PARAMETERS (params) to Groovy Variables even if they are not passed
echo "Initialize all PARAMETERS..."
Expand Down Expand Up @@ -191,14 +192,14 @@ echo "SCM_REPO:'${SCM_REPO}'"
SCM_BRANCH = 'refs/heads/master'
if (params.SCM_BRANCH) {
SCM_BRANCH = params.SCM_BRANCH
} else if (ghprbPullId && ghprbGhRepository == 'eclipse/openj9') {
} else if (ghprbPullId && ghprbGhRepository ==~ /.*\/openj9/) {
SCM_BRANCH = sha1
}
echo "SCM_BRANCH:'${SCM_BRANCH}'"
SCM_REFSPEC = ''
if (params.SCM_REFSPEC) {
SCM_REFSPEC = params.SCM_REFSPEC
} else if (ghprbPullId && ghprbGhRepository == 'eclipse/openj9') {
} else if (ghprbPullId && ghprbGhRepository ==~ /.*\/openj9/) {
SCM_REFSPEC = "+refs/pull/${ghprbPullId}/merge:refs/remotes/origin/pr/${ghprbPullId}/merge"
}
echo "SCM_REFSPEC:'${SCM_REFSPEC}'"
Expand Down

0 comments on commit 23b61bc

Please sign in to comment.