Skip to content

Commit

Permalink
Initial commit for OMR-Acceptance build
Browse files Browse the repository at this point in the history
- Launch Compile & Sanity X JDK8,10 X SPEC
- Add params to workflow function
- Change build stage name to match JOB_NAME
- Add pipeline for Promote job
- Move reusable functions to common file

[ci skip]

Issue eclipse-openj9#972

Signed-off-by: Adam Brousseau <adam.brousseau88@gmail.com>
  • Loading branch information
AdamBrousseau committed Apr 27, 2018
1 parent 2316390 commit 2df1792
Show file tree
Hide file tree
Showing 20 changed files with 202 additions and 23 deletions.
7 changes: 2 additions & 5 deletions buildenv/jenkins/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -299,11 +299,8 @@ You can also request a Pull Request build from the extensions repos or openj9-om
- Description:
- Compile and Test Sanity against new OMR content
- Triggers
- `Build-linux_390-64_cmprssptrs`
- `Build-linux_ppc-64_cmprssptrs_le`
- `Test-Sanity-linux_390-64_cmprssptrs`
- `Test-Sanity-linux_ppc-64_cmprssptrs_le`
- `Promote-OpenJ9-OMR-master-to-openj9`
- Build and Sanity across all Specs and JDK versions 8,10
- `Promote-OpenJ9-OMR-master-to-openj9` once all testing is passed
- Trigger: Triggered by `Mirror-OMR-to-OpenJ9-OMR`

#### Pull Requests
Expand Down
23 changes: 20 additions & 3 deletions buildenv/jenkins/common/pipeline-functions
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,22 @@ def get_sha(REPO, BRANCH) {
).trim()
}

def git_push_auth(REPO, OPTION, CRED_ID) {
withCredentials([usernamePassword(credentialsId: "${CRED_ID}", usernameVariable: 'USERNAME', passwordVariable: 'PASSWORD')]) {
sh "git push https://${USERNAME}:${PASSWORD}@${REPO} ${OPTION}"
}
}

def get_date() {
//Returns a string for the current date YYYYMMDD_HHMMSS
return sh (
script: 'date +%Y%m%d_%H%M%S',
returnStdout: true
).trim()
}

def build(BUILD_JOB_NAME, OPENJDK_REPO, OPENJDK_BRANCH, OPENJDK_SHA, OPENJ9_REPO, OPENJ9_BRANCH, OPENJ9_SHA, OMR_REPO, OMR_BRANCH, OMR_SHA, VARIABLE_FILE, VENDOR_REPO, VENDOR_BRANCH, VENDOR_CREDENTIALS_ID) {
stage ('Build') {
stage ("${BUILD_JOB_NAME}") {
return build_with_slack(BUILD_JOB_NAME,
[string(name: 'OPENJDK_REPO', value: OPENJDK_REPO),
string(name: 'OPENJDK_BRANCH', value: OPENJDK_BRANCH),
Expand Down Expand Up @@ -135,14 +149,16 @@ def build_with_slack(JOB_NAME, PARAMETERS) {
return JOB
}

def workflow() {
def workflow(SDK_VERSION, SPEC, SHAS, OPENJDK_REPO, OPENJDK_BRANCH, OPENJ9_REPO, OPENJ9_BRANCH, OMR_REPO, OMR_BRANCH, TESTS_TARGETS) {
def jobs = [:]

// compile the source and build the SDK
BUILD_JOB_NAME = "Build-JDK${SDK_VERSION}-${SPEC}"
def BUILD_JOB_NAME = "Build-JDK${SDK_VERSION}-${SPEC}"
jobs["build"] = build(BUILD_JOB_NAME, OPENJDK_REPO, OPENJDK_BRANCH, SHAS['OPENJDK'], OPENJ9_REPO, OPENJ9_BRANCH, SHAS['OPENJ9'], OMR_REPO, OMR_BRANCH, SHAS['OMR'], params.VARIABLE_FILE, params.VENDOR_REPO, params.VENDOR_BRANCH, params.VENDOR_CREDENTIALS_ID)
echo "JOB: ${BUILD_JOB_NAME} PASSED in: ${jobs['build'].getDurationString()}"

if (TESTS_TARGETS.trim() != "none") {
def TEST_JOB_NAME
levels = TESTS_TARGETS.split(",")
levels.each { level ->
switch (level.trim().toLowerCase()) {
Expand All @@ -158,6 +174,7 @@ def workflow() {

// run tests against the SDK build in the upstream job: Build-JDK${SDK_VERSION}-${SPEC}
jobs["${level}"] = build_with_one_upstream(TEST_JOB_NAME, BUILD_JOB_NAME, jobs["build"].getNumber(), params.VARIABLE_FILE, params.VENDOR_REPO, params.VENDOR_BRANCH, params.VENDOR_CREDENTIALS_ID)
echo "JOB: ${TEST_JOB_NAME} PASSED in: ${jobs[level].getDurationString()}"
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
/*******************************************************************************
* Copyright (c) 2018, 2018 IBM Corp. and others
*
* This program and the accompanying materials are made available under
* the terms of the Eclipse Public License 2.0 which accompanies this
* distribution and is available at https://www.eclipse.org/legal/epl-2.0/
* or the Apache License, Version 2.0 which accompanies this distribution and
* is available at https://www.apache.org/licenses/LICENSE-2.0.
*
* This Source Code may also be made available under the following
* Secondary Licenses when the conditions for such availability set
* forth in the Eclipse Public License, v. 2.0 are satisfied: GNU
* General Public License, version 2 with the GNU Classpath
* Exception [1] and GNU General Public License, version 2 with the
* OpenJDK Assembly Exception [2].
*
* [1] https://www.gnu.org/software/classpath/license.html
* [2] http://openjdk.java.net/legal/assembly-exception.html
*
* SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 OR LicenseRef-GPL-2.0 WITH Assembly-exception
*******************************************************************************/

HTTP = "https://"
REPO = 'github.com/eclipse/openj9-omr.git'
TARGET_BRANCH = "openj9"

timeout(time: 3, unit: 'HOURS') {
node('worker') {
stage('Promote') {
timestamps {

checkout scm
buildfile = load 'buildenv/jenkins/common/pipeline-functions'
variableFile = load 'buildenv/jenkins/common/variables-functions'
variableFile.parse_variables_file()
cleanWs()

CRED_ID = variableFile.get_user_credentials_id('github')

git branch: "${TARGET_BRANCH}", url: "${HTTP}${REPO}"

OLD_SHA = buildfile.get_sha("${HTTP}${REPO}", TARGET_BRANCH)

MERGE_DATE = buildfile.get_date()

sh "git merge ${OMR_COMMIT} -m 'Merge ${OMR_COMMIT} into ${OLD_SHA}'"

sh """git tag -a 'omr_merge_${MERGE_DATE}' \
-m 'OMR: ${OMR_COMMIT}' \
-m 'OpenJ9: ${OPENJ9_COMMIT}' \
-m 'OpenJDK8: ${OPENJDK8_COMMIT}' \
-m 'OpenJDK10: ${OPENJDK10_COMMIT}'"""

buildfile.git_push_auth(REPO, TARGET_BRANCH, CRED_ID)
buildfile.git_push_auth(REPO, '--tags', CRED_ID)

currentBuild.description = sh (
script: 'git log --oneline -1',
returnStdout: true
).trim()

cleanWs()
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,4 @@ node('master') {
SHAS = buildfile.get_shas(OPENJDK_REPO, OPENJDK_BRANCH, OPENJ9_REPO, OPENJ9_BRANCH, OMR_REPO, OMR_BRANCH)
}

jobs = buildfile.workflow()
jobs = buildfile.workflow(SDK_VERSION, SPEC, SHAS, OPENJDK_REPO, OPENJDK_BRANCH, OPENJ9_REPO, OPENJ9_BRANCH, OMR_REPO, OMR_BRANCH, TESTS_TARGETS)
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,4 @@ node('master') {
SHAS = buildfile.get_shas(OPENJDK_REPO, OPENJDK_BRANCH, OPENJ9_REPO, OPENJ9_BRANCH, OMR_REPO, OMR_BRANCH)
}

jobs = buildfile.workflow()
jobs = buildfile.workflow(SDK_VERSION, SPEC, SHAS, OPENJDK_REPO, OPENJDK_BRANCH, OPENJ9_REPO, OPENJ9_BRANCH, OMR_REPO, OMR_BRANCH, TESTS_TARGETS)
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,4 @@ node('master') {
SHAS = buildfile.get_shas(OPENJDK_REPO, OPENJDK_BRANCH, OPENJ9_REPO, OPENJ9_BRANCH, OMR_REPO, OMR_BRANCH)
}

jobs = buildfile.workflow()
jobs = buildfile.workflow(SDK_VERSION, SPEC, SHAS, OPENJDK_REPO, OPENJDK_BRANCH, OPENJ9_REPO, OPENJ9_BRANCH, OMR_REPO, OMR_BRANCH, TESTS_TARGETS)
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,4 @@ node('master') {
SHAS = buildfile.get_shas(OPENJDK_REPO, OPENJDK_BRANCH, OPENJ9_REPO, OPENJ9_BRANCH, OMR_REPO, OMR_BRANCH)
}

jobs = buildfile.workflow()
jobs = buildfile.workflow(SDK_VERSION, SPEC, SHAS, OPENJDK_REPO, OPENJDK_BRANCH, OPENJ9_REPO, OPENJ9_BRANCH, OMR_REPO, OMR_BRANCH, TESTS_TARGETS)
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,4 @@ node('master') {
SHAS = buildfile.get_shas(OPENJDK_REPO, OPENJDK_BRANCH, OPENJ9_REPO, OPENJ9_BRANCH, OMR_REPO, OMR_BRANCH)
}

jobs = buildfile.workflow()
jobs = buildfile.workflow(SDK_VERSION, SPEC, SHAS, OPENJDK_REPO, OPENJDK_BRANCH, OPENJ9_REPO, OPENJ9_BRANCH, OMR_REPO, OMR_BRANCH, TESTS_TARGETS)
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,4 @@ node('master') {
SHAS = buildfile.get_shas(OPENJDK_REPO, OPENJDK_BRANCH, OPENJ9_REPO, OPENJ9_BRANCH, OMR_REPO, OMR_BRANCH)
}

jobs = buildfile.workflow()
jobs = buildfile.workflow(SDK_VERSION, SPEC, SHAS, OPENJDK_REPO, OPENJDK_BRANCH, OPENJ9_REPO, OPENJ9_BRANCH, OMR_REPO, OMR_BRANCH, TESTS_TARGETS)
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,4 @@ node('master') {
SHAS = buildfile.get_shas(OPENJDK_REPO, OPENJDK_BRANCH, OPENJ9_REPO, OPENJ9_BRANCH, OMR_REPO, OMR_BRANCH)
}

jobs = buildfile.workflow()
jobs = buildfile.workflow(SDK_VERSION, SPEC, SHAS, OPENJDK_REPO, OPENJDK_BRANCH, OPENJ9_REPO, OPENJ9_BRANCH, OMR_REPO, OMR_BRANCH, TESTS_TARGETS)
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,4 @@ node('master') {
SHAS = buildfile.get_shas(OPENJDK_REPO, OPENJDK_BRANCH, OPENJ9_REPO, OPENJ9_BRANCH, OMR_REPO, OMR_BRANCH)
}

jobs = buildfile.workflow()
jobs = buildfile.workflow(SDK_VERSION, SPEC, SHAS, OPENJDK_REPO, OPENJDK_BRANCH, OPENJ9_REPO, OPENJ9_BRANCH, OMR_REPO, OMR_BRANCH, TESTS_TARGETS)
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,4 @@ node('master') {
SHAS = buildfile.get_shas(OPENJDK_REPO, OPENJDK_BRANCH, OPENJ9_REPO, OPENJ9_BRANCH, OMR_REPO, OMR_BRANCH)
}

jobs = buildfile.workflow()
jobs = buildfile.workflow(SDK_VERSION, SPEC, SHAS, OPENJDK_REPO, OPENJDK_BRANCH, OPENJ9_REPO, OPENJ9_BRANCH, OMR_REPO, OMR_BRANCH, TESTS_TARGETS)
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,4 @@ node('master') {
SHAS = buildfile.get_shas(OPENJDK_REPO, OPENJDK_BRANCH, OPENJ9_REPO, OPENJ9_BRANCH, OMR_REPO, OMR_BRANCH)
}

jobs = buildfile.workflow()
jobs = buildfile.workflow(SDK_VERSION, SPEC, SHAS, OPENJDK_REPO, OPENJDK_BRANCH, OPENJ9_REPO, OPENJ9_BRANCH, OMR_REPO, OMR_BRANCH, TESTS_TARGETS)
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,4 @@ node('master') {
SHAS = buildfile.get_shas(OPENJDK_REPO, OPENJDK_BRANCH, OPENJ9_REPO, OPENJ9_BRANCH, OMR_REPO, OMR_BRANCH)
}

jobs = buildfile.workflow()
jobs = buildfile.workflow(SDK_VERSION, SPEC, SHAS, OPENJDK_REPO, OPENJDK_BRANCH, OPENJ9_REPO, OPENJ9_BRANCH, OMR_REPO, OMR_BRANCH, TESTS_TARGETS)
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,4 @@ node('master') {
SHAS = buildfile.get_shas(OPENJDK_REPO, OPENJDK_BRANCH, OPENJ9_REPO, OPENJ9_BRANCH, OMR_REPO, OMR_BRANCH)
}

jobs = buildfile.workflow()
jobs = buildfile.workflow(SDK_VERSION, SPEC, SHAS, OPENJDK_REPO, OPENJDK_BRANCH, OPENJ9_REPO, OPENJ9_BRANCH, OMR_REPO, OMR_BRANCH, TESTS_TARGETS)
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,4 @@ node('master') {
SHAS = buildfile.get_shas(OPENJDK_REPO, OPENJDK_BRANCH, OPENJ9_REPO, OPENJ9_BRANCH, OMR_REPO, OMR_BRANCH)
}

jobs = buildfile.workflow()
jobs = buildfile.workflow(SDK_VERSION, SPEC, SHAS, OPENJDK_REPO, OPENJDK_BRANCH, OPENJ9_REPO, OPENJ9_BRANCH, OMR_REPO, OMR_BRANCH, TESTS_TARGETS)
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,4 @@ node('master') {
SHAS = buildfile.get_shas(OPENJDK_REPO, OPENJDK_BRANCH, OPENJ9_REPO, OPENJ9_BRANCH, OMR_REPO, OMR_BRANCH)
}

jobs = buildfile.workflow()
jobs = buildfile.workflow(SDK_VERSION, SPEC, SHAS, OPENJDK_REPO, OPENJDK_BRANCH, OPENJ9_REPO, OPENJ9_BRANCH, OMR_REPO, OMR_BRANCH, TESTS_TARGETS)
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,4 @@ node('master') {
SHAS = buildfile.get_shas(OPENJDK_REPO, OPENJDK_BRANCH, OPENJ9_REPO, OPENJ9_BRANCH, OMR_REPO, OMR_BRANCH)
}

jobs = buildfile.workflow()
jobs = buildfile.workflow(SDK_VERSION, SPEC, SHAS, OPENJDK_REPO, OPENJDK_BRANCH, OPENJ9_REPO, OPENJ9_BRANCH, OMR_REPO, OMR_BRANCH, TESTS_TARGETS)
97 changes: 97 additions & 0 deletions buildenv/jenkins/jobs/pipelines/Pipeline-OMR-Acceptance
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
/*******************************************************************************
* Copyright (c) 2018, 2018 IBM Corp. and others
*
* This program and the accompanying materials are made available under
* the terms of the Eclipse Public License 2.0 which accompanies this
* distribution and is available at https://www.eclipse.org/legal/epl-2.0/
* or the Apache License, Version 2.0 which accompanies this distribution and
* is available at https://www.apache.org/licenses/LICENSE-2.0.
*
* This Source Code may also be made available under the following
* Secondary Licenses when the conditions for such availability set
* forth in the Eclipse Public License, v. 2.0 are satisfied: GNU
* General Public License, version 2 with the GNU Classpath
* Exception [1] and GNU General Public License, version 2 with the
* OpenJDK Assembly Exception [2].
*
* [1] https://www.gnu.org/software/classpath/license.html
* [2] http://openjdk.java.net/legal/assembly-exception.html
*
* SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 OR LicenseRef-GPL-2.0 WITH Assembly-exception
*******************************************************************************/

def SDK_VERSIONS = ['8', '10']
def SPECS = ['linux_ppc-64_cmprssptrs_le', 'linux_390-64_cmprssptrs', 'aix_ppc-64_cmprssptrs']

def OPENJDK_REPOS = [:]
OPENJDK_REPOS['8'] = [repo: 'https://github.com/ibmruntimes/openj9-openjdk-jdk8.git', branch: 'openj9']
OPENJDK_REPOS['10'] = [repo: 'https://github.com/ibmruntimes/openj9-openjdk-jdk10.git', branch: 'openj9']

def OPENJ9_REPO = 'https://github.com/eclipse/openj9.git'
def OPENJ9_BRANCH = 'master'

def OMR_REPO = 'https://github.com/eclipse/openj9-omr.git'
def OMR_BRANCH = 'master'

TESTS_TARGETS = '_sanity'

def JOBS = [:]
def ALL_SHAS = [:]

def SLACK_CHANNEL

timeout(time: 6, unit: 'HOURS') {
node('worker') {
timestamps {
checkout scm
buildFile = load 'buildenv/jenkins/common/pipeline-functions'
variableFile = load 'buildenv/jenkins/common/variables-functions'
variableFile.parse_variables_file()
variableFile.set_slack_channel()

// fetch SHAs
ALL_SHAS['OPENJ9'] = buildFile.get_sha(OPENJ9_REPO, OPENJ9_BRANCH)
ALL_SHAS['OMR'] = buildFile.get_sha(OMR_REPO, OMR_BRANCH)

// update build description
currentBuild.description = "OpenJ9: ${ALL_SHAS['OPENJ9']}<br/>OMR: ${ALL_SHAS['OMR']}"

SDK_VERSIONS.each { SDK_VERSION ->
def OPENJDK_REPO = OPENJDK_REPOS["${SDK_VERSION}"].repo
def OPENJDK_BRANCH = OPENJDK_REPOS["${SDK_VERSION}"].branch
def SHAS = [:]
SHAS['OPENJ9'] = ALL_SHAS['OPENJ9']
SHAS['OMR'] = ALL_SHAS['OMR']
SHAS['OPENJDK'] = buildFile.get_sha(OPENJDK_REPO, OPENJDK_BRANCH)
ALL_SHAS["OPENJDK${SDK_VERSION}"] = SHAS['OPENJDK']

// append OpenJDK SHA to the build description
currentBuild.description += "<br/>OpenJDK${SDK_VERSION}: ${SHAS['OPENJDK']}"

echo "Building OpenJ9 extensions for OpenJDK${SDK_VERSION}"
echo "OPENJDK_REPO = ${OPENJDK_REPO}"
echo "OPENJDK_BRANCH = ${OPENJDK_BRANCH}"
echo "OPENJDK_SHA:${SHAS['OPENJDK']}"
echo "OPENJ9_SHA:${SHAS['OPENJ9']}"
echo "OMR_SHA:${SHAS['OMR']}"

SPECS.each { SPEC ->
JOBS["Build-Test-JDK${SDK_VERSION}-${SPEC}"] = { buildFile.workflow(SDK_VERSION, SPEC, SHAS, OPENJDK_REPO, OPENJDK_BRANCH, OPENJ9_REPO, OPENJ9_BRANCH, OMR_REPO, OMR_BRANCH, TESTS_TARGETS) }
}
}

cleanWs()
}
}

timestamps {
parallel JOBS
stage('Promote') {
PROMOTE_JOB = buildFile.build_with_slack('Promote-OpenJ9-OMR-master-to-openj9',
[string(name: 'OMR_COMMIT', value: "${ALL_SHAS['OMR']}"),
string(name: 'OPENJ9_COMMIT', value: "${ALL_SHAS['OPENJ9']}"),
string(name: 'OPENJDK8_COMMIT', value: "${ALL_SHAS['OPENJDK8']}"),
string(name: 'OPENJDK10_COMMIT', value: "${ALL_SHAS['OPENJDK10']}")])
}
}
}
2 changes: 2 additions & 0 deletions buildenv/jenkins/variables/defaults.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ jdk_image_dir:
8: 'j2sdk-image'
9: 'jdk'
10: 'jdk'
credentials:
github: 'b6987280-6402-458f-bdd6-7affc2e360d4'
test_dependencies_job_name: 'test.getDependency'
slack_channel: '#jenkins'
build_job_prefix: 'Build-JDK-'
Expand Down

0 comments on commit 2df1792

Please sign in to comment.