Skip to content

Commit

Permalink
Split nightly job
Browse files Browse the repository at this point in the history
  • Loading branch information
radtriste committed Apr 29, 2022
1 parent 948e3ea commit 073721b
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 56 deletions.
56 changes: 2 additions & 54 deletions .ci/jenkins/dsl/jobs.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -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,23 +66,8 @@ 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 * * *' ]
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')
}
environmentVariables {
env('JENKINS_EMAIL_CREDS_ID', "${JENKINS_EMAIL_CREDS_ID}")
env('NOTIFICATION_JOB_NAME', "${quarkusFolder.environment.toName()} check")
}
}
}

void setupSonarCloudJob() {
def jobParams = KogitoJobUtils.getBasicJobParams(this, 'kogito-runtimes', Folder.NIGHTLY_SONARCLOUD, "${jenkins_path}/Jenkinsfile.sonarcloud", 'Kogito Runtimes Daily Sonar')
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' ]
KogitoJobTemplate.createPipelineJob(this, jobParams)?.with {
parameters {
Expand All @@ -101,38 +81,6 @@ void setupSonarCloudJob() {
}
}

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 * * *' ]
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')
}
environmentVariables {
env('JENKINS_EMAIL_CREDS_ID', "${JENKINS_EMAIL_CREDS_ID}")
env('NOTIFICATION_JOB_NAME', 'Native check')
}
}
}

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 * * *' ]
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')

stringParam('NATIVE_BUILDER_IMAGE', Utils.getMandrelEnvironmentBuilderImage(this), 'Which native builder image to use ?')
}
environmentVariables {
env('JENKINS_EMAIL_CREDS_ID', "${JENKINS_EMAIL_CREDS_ID}")
env('NOTIFICATION_JOB_NAME', 'Mandrel check')
}
}
}

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
2 changes: 1 addition & 1 deletion .ci/jenkins/dsl/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
file=$(mktemp)
# For more usage of the script, use ./test.sh -h
# TODO to update before merge
curl -o ${file} https://raw.githubusercontent.com/radtriste/kogito-pipelines/kogito-6962/dsl/seed/scripts/seed_test.sh
curl -o ${file} https://raw.githubusercontent.com/radtriste/kogito-pipelines/split_nightly_jobs/dsl/seed/scripts/seed_test.sh
chmod u+x ${file}
${file} $@
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: cd .ci/jenkins/dsl && ./test.sh -b ${{ github.head_ref }} -o ${{ github.event.pull_request.user.login }} -t ${{ github.base_ref }} -a ${{ github.event.pull_request.base.user.login }}
run: cd .ci/jenkins/dsl && ./test.sh -b ${{ github.head_ref }} -o ${{ github.event.pull_request.user.login }} -t ${{ github.base_ref }} -a ${{ github.event.pull_request.base.user.login }}

0 comments on commit 073721b

Please sign in to comment.