Skip to content

Commit

Permalink
Merge pull request #10279 from AdamBrousseau/inclusive_terms
Browse files Browse the repository at this point in the history
Inclusive terms for infra scripts
  • Loading branch information
keithc-ca authored Jan 18, 2021
2 parents f11ee6f + 2e5c84c commit 303feab
Show file tree
Hide file tree
Showing 9 changed files with 40 additions and 38 deletions.
2 changes: 1 addition & 1 deletion .copyright_whitelist → .copyrightignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
//List of files that don't require copyrights
//One file per line, and full paths must be used
.copyright_whitelist
.copyrightignore
2 changes: 1 addition & 1 deletion buildenv/jenkins/ARTIFACTORY.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 OR GPL-2.0 WITH Classpath-excepti
-->
# About
Artifactory is a binary repository manager.
Our server is being used to store the Jenkins artifacts between builds to save space on the Jenkins master. The artifacts will be kept for a period after the job in case someone needs to debug the build.
Our server is being used to store the Jenkins artifacts between builds to save space on the Jenkins Manager node. The artifacts will be kept for a period after the job in case someone needs to debug the build.
It is being hosted on the proxy worker machine and the current address is https://140-211-168-230-openstack.osuosl.org/artifactory/webapp/

# Install Artifactory:
Expand Down
4 changes: 2 additions & 2 deletions buildenv/jenkins/common/variables-functions.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class Buildspec {

/*
* Helper function to check if a variable is a map.
* This is needed because .isMap() is not on the default jenkins whitelist
* This is needed because .isMap() is not on the default jenkins allow list
*/
private static boolean isMap(x) {
switch (x) {
Expand Down Expand Up @@ -1017,7 +1017,7 @@ def setup() {
buildFile = pipelineFunctions
SHAS = buildFile.get_shas(OPENJDK_REPO, OPENJDK_BRANCH, OPENJ9_REPO, OPENJ9_BRANCH, OMR_REPO, OMR_BRANCH, VENDOR_TEST_REPOS_MAP, VENDOR_TEST_BRANCHES_MAP, VENDOR_TEST_SHAS_MAP)
BUILD_NAME = buildFile.get_build_job_name(SPEC, SDK_VERSION, BUILD_IDENTIFIER)
// Stash DSL file so we can quickly load it on master
// Stash DSL file so we can quickly load it on the Jenkins Manager node
if (params.AUTOMATIC_GENERATION != 'false') {
stash includes: 'buildenv/jenkins/jobs/pipelines/Pipeline_Template.groovy', name: 'DSL'
}
Expand Down
19 changes: 10 additions & 9 deletions buildenv/jenkins/jobs/infrastructure/Cleanup-Nodes.groovy
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2018, 2020 IBM Corp. and others
* Copyright (c) 2018, 2021 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
Expand All @@ -19,6 +19,7 @@
*
* 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
*******************************************************************************/
// #10071 This is a Jenkins class
import hudson.slaves.OfflineCause

defaultSetupLabel = 'worker'
Expand Down Expand Up @@ -89,7 +90,7 @@ properties([buildDiscarder(logRotator(artifactDaysToKeepStr: '', artifactNumToKe
*/

jobs = [:]
offlineSlaves = [:]
offlineNodes = [:]
buildNodes = []

timeout(time: TIMEOUT_TIME.toInteger(), unit: TIMEOUT_UNITS) {
Expand Down Expand Up @@ -123,11 +124,11 @@ timeout(time: TIMEOUT_TIME.toInteger(), unit: TIMEOUT_UNITS) {
def nodeName = aNode.getDisplayName()

if (aNode.toComputer().isOffline()) {
// skip offline slave
// skip offline nodes
def offlineCause = aNode.toComputer().getOfflineCause()
if (offlineCause instanceof OfflineCause.UserCause) {
// skip offline node disconnected by users
offlineSlaves.put(nodeName, offlineCause.toString())
offlineNodes.put(nodeName, offlineCause.toString())
} else {
// cache nodes, will attempt to reconnect nodes disconnected by system later
buildNodes.add(nodeName)
Expand Down Expand Up @@ -211,16 +212,16 @@ timeout(time: TIMEOUT_TIME.toInteger(), unit: TIMEOUT_UNITS) {
}

if (MODES.contains('sanitize')) {
stage("${nodeName} - Sanitize slave") {
stage("${nodeName} - Sanitize node") {
sanitize_node(nodeName)
}
}
}
}
}

if (offlineSlaves) {
println("Offline slaves: ${offlineSlaves.toString()}")
if (offlineNodes) {
println("Offline nodes: ${offlineNodes.toString()}")
}

} catch (e) {
Expand All @@ -243,7 +244,7 @@ timeout(time: TIMEOUT_TIME.toInteger(), unit: TIMEOUT_UNITS) {
def aComputer = jenkins.model.Jenkins.instance.getNode(label).toComputer()

if (aComputer.isOffline() && !(aComputer.getOfflineCause() instanceof OfflineCause.UserCause)) {
// reconnect slave (asynchronously)
// reconnect node (asynchronously)
println("${label}: Reconnecting...")
aComputer.connect(true)

Expand Down Expand Up @@ -309,7 +310,7 @@ def sanitize_node(nodeName) {
println(e.getMessage())
}

//reconnect slave
//reconnect node
timeout(time: RECONNECT_TIMEOUT.toInteger(), unit: 'MINUTES') {
println("\t ${nodeName}: Disconnecting...")
workingComputer.disconnect(null)
Expand Down
24 changes: 12 additions & 12 deletions buildenv/jenkins/jobs/infrastructure/Update-Reference-Repos.groovy
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2019, 2020 IBM Corp. and others
* Copyright (c) 2019, 2021 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
Expand Down Expand Up @@ -65,27 +65,27 @@ timeout(time: 6, unit: 'HOURS') {
variableFile.set_user_credentials()

def buildNodes = jenkins.model.Jenkins.instance.getLabel(LABEL).getNodes()
def slaveNodes = []
def todoNodes = []
def setupNodesNames = []
def buildNodesNames = []

if (UPDATE_SETUP_NODES) {
// update openj9 repo cache on slaves that have SETUP_LABEL
// update openj9 repo cache on nodes that have SETUP_LABEL
if (UPDATE_BUILD_NODES) {
// remove build nodes from the setup nodes collection
slaveNodes.addAll(jenkins.model.Jenkins.instance.getLabel(SETUP_LABEL).getNodes().minus(buildNodes))
todoNodes.addAll(jenkins.model.Jenkins.instance.getLabel(SETUP_LABEL).getNodes().minus(buildNodes))
} else {
slaveNodes.addAll(jenkins.model.Jenkins.instance.getLabel(SETUP_LABEL).getNodes())
todoNodes.addAll(jenkins.model.Jenkins.instance.getLabel(SETUP_LABEL).getNodes())
}

//add master if slaveNodes does not contain it already
if (slaveNodes.intersect(jenkins.model.Jenkins.instance.getLabel('master').getNodes()).isEmpty()) {
slaveNodes.addAll(jenkins.model.Jenkins.instance.getLabel('master').getNodes())
//add Jenkins Manager node if todoNodes does not contain it already
if (todoNodes.intersect(jenkins.model.Jenkins.instance.getLabel('master').getNodes()).isEmpty()) {
todoNodes.addAll(jenkins.model.Jenkins.instance.getLabel('master').getNodes())
}

for (sNode in slaveNodes) {
for (sNode in todoNodes) {
if (sNode.toComputer().isOffline()) {
// skip offline slave
// skip offline node
continue
}

Expand All @@ -106,10 +106,10 @@ timeout(time: 6, unit: 'HOURS') {
}

if (UPDATE_BUILD_NODES) {
// update openjdk and openj9 repos cache on slaves
// update openjdk and openj9 repos cache on nodes
for (aNode in buildNodes) {
if (aNode.toComputer().isOffline()) {
// skip offline slave
// skip offline node
continue
}

Expand Down
12 changes: 6 additions & 6 deletions buildenv/jenkins/jobs/infrastructure/copyrightCheck.groovy
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2017, 2020 IBM Corp. and others
* Copyright (c) 2017, 2021 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
Expand Down Expand Up @@ -57,15 +57,15 @@ timeout(time: 6, unit: 'HOURS') {
// Set a different Copyright regex depending on the Repo the PR is from
REGEX = "\'Copyright \\(c\\) ([0-9]{4}), ${DATE_YEAR}\'"

WHITE_LIST = []
if (fileExists("${WORKSPACE}/.copyright_whitelist")) {
WHITE_LIST = readFile '.copyright_whitelist'
WHITE_LIST = WHITE_LIST.tokenize("\n")
IGNORE_LIST = []
if (fileExists("${WORKSPACE}/.copyrightignore")) {
IGNORE_LIST = readFile '.copyrightignore'
IGNORE_LIST = IGNORE_LIST.tokenize("\n")
}

FILES_LIST.each() {
println "Checking file: '${it}'"
if (WHITE_LIST.contains(it)) {
if (IGNORE_LIST.contains(it)) {
echo "Ignoring file"
} else {
RESULT = sh (
Expand Down
5 changes: 3 additions & 2 deletions buildenv/jenkins/jobs/infrastructure/wrapper_template.groovy
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2019, 2020 IBM Corp. and others
* Copyright (c) 2019, 2021 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
Expand Down Expand Up @@ -116,7 +116,8 @@ pipelineJob(job_name) {
if (triggers.pull_request_builder) {
githubPullRequest {
admins(triggers.pull_request_builder.admin_list)
blackListCommitAuthor(triggers.pull_request_builder.blacklist)
// #10071 This function name is defined by the plugin https://plugins.jenkins.io/ghprb/
blackListCommitAuthor(triggers.pull_request_builder.block_list)
cron(triggers.pull_request_builder.cron)
triggerPhrase(triggers.pull_request_builder.trigger_phrase)
onlyTriggerPhrase()
Expand Down
6 changes: 3 additions & 3 deletions buildenv/jenkins/jobs/infrastructure/wrapper_variables.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

###############################################################################
# Copyright (c) 2019, 2019 IBM Corp. and others
# Copyright (c) 2019, 2021 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
Expand Down Expand Up @@ -135,7 +135,7 @@ PullRequest-OpenJ9:
trigger_phrase: .*\bjenkins\s+(compile|test)\b.*
cron: "H/5 * * * *"
admin_list: "OpenJ9"
blacklist: "kenrai123"
block_list: "kenrai123"
context: "Pull Request - OpenJ9"
triggered_status: "Job Triggered"
started_status: "Jobs Running"
Expand All @@ -150,7 +150,7 @@ PullRequest-OpenJDK:
trigger_phrase: .*\bjenkins\s+(compile|test)\b.*
cron: "H/5 * * * *"
admin_list: "Extensions"
blacklist: "kenrai123"
block_list: "kenrai123"
context: "Pull Request - OpenJDK"
triggered_status: "Job Triggered"
started_status: "Jobs Running"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2018, 2020 IBM Corp. and others
* Copyright (c) 2018, 2021 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
Expand Down Expand Up @@ -379,7 +379,7 @@ try {
def BUILD_NODES = get_node_labels(BUILD_NODE_LABELS, BUILD_SPECS.keySet())
def TEST_NODES = get_node_labels(TEST_NODE_LABELS, BUILD_SPECS.keySet())

// Stash DSL file so we can quickly load it on master
// Stash DSL file so we can quickly load it on Jenkins Manager node
if (AUTOMATIC_GENERATION != 'false') {
stash includes: 'buildenv/jenkins/jobs/pipelines/Pipeline_Template.groovy', name: 'DSL'
}
Expand Down

0 comments on commit 303feab

Please sign in to comment.