Skip to content

Commit

Permalink
Split nightly job
Browse files Browse the repository at this point in the history
  • Loading branch information
radtriste committed May 12, 2022
1 parent 1b961f4 commit 868afd6
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 68 deletions.
69 changes: 2 additions & 67 deletions .ci/jenkins/dsl/jobs.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ Map getMultijobPRConfig(Folder jobFolder) {
env : [
// Sonarcloud analysis only on main branch
// As we have only Community edition
DISABLE_SONARCLOUD: !Utils.isMainBranch(this),
ENABLE_SONARCLOUD: Utils.isMainBranch(this),
]
], [
id: 'kogito-apps',
Expand All @@ -49,12 +49,7 @@ KogitoJobUtils.createAllEnvsPerRepoPRJobs(this) { jobFolder -> getMultijobPRConf
setupDeployJob(Folder.PULLREQUEST_RUNTIMES_BDD)

// Nightly jobs
setupSonarCloudJob()
setupDeployJob(Folder.NIGHTLY)
setupNativeJob()
setupQuarkusJob(Folder.NIGHTLY_QUARKUS_MAIN)
setupQuarkusJob(Folder.NIGHTLY_QUARKUS_BRANCH)
setupMandrelJob()
KogitoJobUtils.createAllJobsForArtifactsRepository(this, ['drools', 'kogito'])

// Release jobs
setupDeployJob(Folder.RELEASE)
Expand All @@ -71,66 +66,6 @@ KogitoJobUtils.createQuarkusUpdateToolsJob(this, 'kogito-runtimes', [
// Methods
/////////////////////////////////////////////////////////////////

void setupQuarkusJob(Folder quarkusFolder) {
def jobParams = KogitoJobUtils.getBasicJobParams(this, 'kogito-ecosystem', quarkusFolder, "${jenkins_path}/Jenkinsfile.quarkus", 'Kogito Runtimes Quarkus Snapshot')
jobParams.triggers = [ cron : 'H 4 * * *' ]
jobParams.env.putAll([
JENKINS_EMAIL_CREDS_ID: "${JENKINS_EMAIL_CREDS_ID}",
NOTIFICATION_JOB_NAME: "${quarkusFolder.environment.toName()} check"
])
KogitoJobTemplate.createPipelineJob(this, jobParams)?.with {
parameters {
stringParam('BUILD_BRANCH_NAME', "${GIT_BRANCH}", 'Set the Git branch to checkout')
stringParam('GIT_AUTHOR', "${GIT_AUTHOR_NAME}", 'Set the Git author to checkout')
}
}
}

void setupSonarCloudJob() {
def jobParams = KogitoJobUtils.getBasicJobParams(this, 'kogito-runtimes', Folder.NIGHTLY_SONARCLOUD, "${jenkins_path}/Jenkinsfile.sonarcloud", 'Kogito Runtimes Daily Sonar')
jobParams.triggers = [ cron : 'H 20 * * 1-5' ]
jobParams.env.putAll([
JENKINS_EMAIL_CREDS_ID: "${JENKINS_EMAIL_CREDS_ID}",
NOTIFICATION_JOB_NAME: 'Sonarcloud check'
])
KogitoJobTemplate.createPipelineJob(this, jobParams)?.with {
parameters {
stringParam('BUILD_BRANCH_NAME', "${GIT_BRANCH}", 'Set the Git branch to checkout')
stringParam('GIT_AUTHOR', "${GIT_AUTHOR_NAME}", 'Set the Git author to checkout')
}
}
}

void setupNativeJob() {
def jobParams = KogitoJobUtils.getBasicJobParams(this, 'kogito-runtimes', Folder.NIGHTLY_NATIVE, "${jenkins_path}/Jenkinsfile.native", 'Kogito Runtimes Native Testing')
jobParams.triggers = [ cron : 'H 6 * * *' ]
jobParams.env.putAll([
JENKINS_EMAIL_CREDS_ID: "${JENKINS_EMAIL_CREDS_ID}",
NOTIFICATION_JOB_NAME: 'Native check'
])
KogitoJobTemplate.createPipelineJob(this, jobParams)?.with {
parameters {
stringParam('BUILD_BRANCH_NAME', "${GIT_BRANCH}", 'Set the Git branch to checkout')
stringParam('GIT_AUTHOR', "${GIT_AUTHOR_NAME}", 'Set the Git author to checkout')
}
}
}

void setupMandrelJob() {
def jobParams = KogitoJobUtils.getBasicJobParams(this, 'kogito-runtimes', Folder.NIGHTLY_MANDREL, "${jenkins_path}/Jenkinsfile.native", 'Kogito Runtimes Mandrel Testing')
jobParams.triggers = [ cron : 'H 8 * * *' ]
jobParams.env.putAll([
JENKINS_EMAIL_CREDS_ID: "${JENKINS_EMAIL_CREDS_ID}",
NOTIFICATION_JOB_NAME: 'Mandrel check'
])
KogitoJobTemplate.createPipelineJob(this, jobParams)?.with {
parameters {
stringParam('BUILD_BRANCH_NAME', "${GIT_BRANCH}", 'Set the Git branch to checkout')
stringParam('GIT_AUTHOR', "${GIT_AUTHOR_NAME}", 'Set the Git author to checkout')
}
}
}

void setupDeployJob(Folder jobFolder) {
def jobParams = KogitoJobUtils.getBasicJobParams(this, 'kogito-runtimes-deploy', jobFolder, "${jenkins_path}/Jenkinsfile.deploy", 'Kogito Runtimes Deploy')
if (jobFolder.isPullRequest()) {
Expand Down
6 changes: 6 additions & 0 deletions .ci/jenkins/scripts/update-version/git_stage_files.groovy
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
void execute(def pipelinesCommon) {
echo 'Hello from Git Stage Files script'
githubscm.findAndStageNotIgnoredFiles('pom.xml')
}

return this
14 changes: 14 additions & 0 deletions .ci/jenkins/scripts/update-version/init.groovy
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
void execute(def pipelinesCommon) {
echo 'Hello from init script'
if (pipelinesCommon.isRelease() || pipelinesCommon.isCreatePR()) {
// Verify version is set
assert pipelinesCommon.getKogitoVersion()

if (pipelinesCommon.isRelease()) {
// Verify if on right release branch
assert pipelinesCommon.getGitBranch() == util.getReleaseBranchFromVersion(pipelinesCommon.getKogitoVersion())
}
}
}

return this
6 changes: 6 additions & 0 deletions .ci/jenkins/scripts/update-version/main.groovy
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
void execute(def pipelinesCommon) {
maven.mvnVersionsSet(pipelinesCommon.getDefaultMavenCommand(), pipelinesCommon.getKogitoVersion(), !pipelinesCommon.isRelease())
maven.mvnSetVersionProperty(pipelinesCommon.getDefaultMavenCommand(), 'version.org.kie', pipelinesCommon.getDroolsVersion())
}

return this
2 changes: 1 addition & 1 deletion .github/workflows/jenkins-tests-PR.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,4 @@ jobs:
java-version: 11

- name: Test DSL
run: .ci/jenkins/dsl/test.sh -h ${{ github.head_ref }} -r ${{ github.event.pull_request.head.repo.full_name }} -b ${{ github.base_ref }} -t ${{ github.event.pull_request.base.repo.full_name }} .ci/jenkins/dsl
run: .ci/jenkins/dsl/test.sh -h ${{ github.head_ref }} -r ${{ github.event.pull_request.head.repo.full_name }} -b ${{ github.base_ref }} -t ${{ github.event.pull_request.base.repo.full_name }} .ci/jenkins/dsl

0 comments on commit 868afd6

Please sign in to comment.