Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[7.11.x] added new groovy script #345

Merged
merged 1 commit into from Oct 14, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
206 changes: 206 additions & 0 deletions job-dsls/jobs/compile_downstream_build.groovy
@@ -0,0 +1,206 @@
/**
* Creates downstream pullrequest (PR) jobs for kiegroup GitHub org. units.
* These jobs execute the downstream build skipping tests and skipping the gwt compilation
* for a specific PR to make sure the changes do not break the downstream repos.
*/
import org.kie.jenkins.jobdsl.Constants

def final DEFAULTS = [
ghOrgUnit : Constants.GITHUB_ORG_UNIT,
branch : Constants.BRANCH,
timeoutMins : 600,
label : "kie-rhel7 && kie-mem8g",
ghAuthTokenId : Constants.GITHUB_AUTH_TOKEN,
upstreamMvnArgs : "-B -e -T1C -DskipTests -Dgwt.compiler.skip=true -Dgwt.skipCompilation=true -Denforcer.skip=true -Dcheckstyle.skip=true -Dfindbugs.skip=true -Drevapi.skip=true clean install",
downstreamMvnGoals : "-B -e -nsu -fae clean install -Dfull=true -DskipTests -Dgwt.compiler.skip=true -Dgwt.skipCompilation=true",
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since we won't be running any tests in these "just compile" jobs, I would suggest adding -T1C into the downstreamMvnGoals - here maven parallelism shouldn't hurt, on the contrary it will make the jobs run faster.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1; adding -T1C seems to be a very good idea.

artifactsToArchive : [
"**/target/*.log",
"**/target/testStatusListener*",
"**/target/screenshots/**",
"**/target/kie-wb*wildfly*.war",
"**/target/kie-wb*eap*.war",
"**/target/kie-drools-wb*wildfly*.war",
"**/target/kie-drools-wb*eap*.war",
"**/target/kie-server-*ee6.war",
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mbiarnes you told me that kie-server ee6 is no longer being generated, so it should probably be removed from this "what to archive" section.

"**/target/kie-server-*ee7.war",
"**/target/kie-server-*webc.war",
"**/target/jbpm-server*dist*.zip"
],
excludedArtifacts : [
"**/target/checkstyle.log"
]
]
// override default config for specific repos (if needed)
def final REPO_CONFIGS = [
"lienzo-core" : [],
"lienzo-tests" : [],
"kie-soup" : [],
"appformer" : [],
"droolsjbpm-build-bootstrap": [],
"droolsjbpm-knowledge" : [],
"drlx-parser" : [],
"drools" : [],
"optaplanner" : [],
"jbpm" : [],
"droolsjbpm-integration" : [],
//"droolsjbpm-tools" : [], // no other repo depends on droolsjbpm-tools
"kie-uberfire-extensions" : [],
"kie-wb-playground" : [],
"kie-wb-common" : [],
"drools-wb" : [],
"optaplanner-wb" : [],
"jbpm-designer" : [],
"jbpm-wb" : []
//"kie-wb-distributions" : [] // kie-wb-distributions is the last repo in the chain
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just out of curiosity, why is kie-wb-distributions commented out?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@winklerm good question - this was taken 1:1 from Petr - so we did not change it. There should be no other rep dependent of kie-wb-distributions? (like droolsjbpm-tools)

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@winklerm To add my understanding: I believe it's ok to have kie-wb-distributions and droolsjbpm-tools commented out.
The purpose of this groovy script is to generate "compile downstream" jobs is to make sure that changes in repo X don't break any of the repos that depend on X. In this particualr case there are no repos that depend on kie-wb-distributions and on droolsjbpm-tools, so we don't need jobs for those.

]


for (repoConfig in REPO_CONFIGS) {
Closure<Object> get = { String key -> repoConfig.value[key] ?: DEFAULTS[key] }

String repo = repoConfig.key
String repoBranch = get("branch")
String ghOrgUnit = get("ghOrgUnit")
String ghAuthTokenId = get("ghAuthTokenId")

// Creation of folders where jobs are stored
folder(Constants.PULL_REQUEST_FOLDER)

// jobs for master branch don't use the branch in the name
String jobName = (repoBranch == "master") ? Constants.PULL_REQUEST_FOLDER + "/$repo-compile-downstream-build" : Constants.PULL_REQUEST_FOLDER + "/$repo-compile-downstream-build-$repoBranch"
job(jobName) {

description("""Created automatically by Jenkins job DSL plugin. Do not edit manually! The changes will be lost next time the job is generated.
|
|Every configuration change needs to be done directly in the DSL files. See the below listed 'Seed job' for more info.
|""".stripMargin())

logRotator {
daysToKeep(7)
}

parameters {
stringParam("sha1")
}

scm {
git {
remote {
github("${ghOrgUnit}/${repo}")
branch("\${sha1}")
name("origin")
refspec("+refs/pull/*:refs/remotes/origin/pr/*")
}
extensions {
cloneOptions {
reference("/home/jenkins/git-repos/${repo}.git")
}
}
}
}
concurrentBuild()

properties {
ownership {
primaryOwnerId("mbiarnes")
coOwnerIds("pszubiak", "anstephe")
}
}

jdk("kie-jdk1.8")

label(get("label"))

triggers {
githubPullRequest {
orgWhitelist(["appformer", "kiegroup"])
allowMembersOfWhitelistedOrgsAsAdmin()
cron("H/10 * * * *")
triggerPhrase(".*[j|J]enkins,?.*execute compile downstream build.*")
onlyTriggerPhrase()
whiteListTargetBranches([repoBranch])
extensions {
commitStatus {
context('Linux - full downstream')
addTestResults(true)
}

}
}
}

wrappers {
xvnc {
useXauthority(false)
}

timeout {
elastic(180, 3, get("timeoutMins"))
}

timestamps()
colorizeOutput()
}

steps {
configure { project ->
project / 'builders' << 'org.kie.jenkinsci.plugins.kieprbuildshelper.UpstreamReposBuilder' {
mavenBuildConfig {
mavenHome("/opt/tools/apache-maven-${Constants.UPSTREAM_BUILD_MAVEN_VERSION}")
delegate.mavenOpts("-Xmx3g")
mavenArgs(get("upstreamMvnArgs"))
}
}
project / 'builders' << 'hudson.tasks.Maven' {
mavenName("kie-maven-${Constants.MAVEN_VERSION}")
jvmOptions("-Xms1g -Xmx3g -XX:+CMSClassUnloadingEnabled")
targets("-e -fae -nsu -B -T1C clean install -Dfull -DskipTests")
}
project / 'builders' << 'org.kie.jenkinsci.plugins.kieprbuildshelper.DownstreamReposBuilder' {
mavenBuildConfig {
mavenHome("/opt/tools/apache-maven-${Constants.MAVEN_VERSION}")
delegate.mavenOpts("-Xmx3g")
mavenArgs(get("downstreamMvnGoals"))
}
}
}
}

publishers {
wsCleanup()
checkstyle("**/checkstyle-result.xml")
def artifactsToArchive = get("artifactsToArchive")
def excludedArtifacts = get("excludedArtifacts")
if (artifactsToArchive) {
archiveArtifacts {
allowEmpty(true)
for (artifactPattern in artifactsToArchive) {
pattern(artifactPattern)
}
onlyIfSuccessful(false)
if (excludedArtifacts) {
for (excludePattern in excludedArtifacts) {
exclude(excludePattern)
}
}
}
}
configure { project ->
project / 'publishers' << 'org.jenkinsci.plugins.emailext__template.ExtendedEmailTemplatePublisher' {
'templateIds' {
'org.jenkinsci.plugins.emailext__template.TemplateId' {
'templateId'('emailext-template-1441717935622')
}
}
}
}
}

// Adds authentication token id for github.
configure { node ->
node / 'triggers' / 'org.jenkinsci.plugins.ghprb.GhprbTrigger' <<
'gitHubAuthId'(ghAuthTokenId)

}
}
}