Skip to content

Commit

Permalink
Adjust development branch (#632)
Browse files Browse the repository at this point in the history
* kie-issues#574 Initial ASF Jenkins CI Setup (#607)

Co-authored-by: jstastny-cz <jan.stastny@ibm.com>

* kie-issues#587 abort stale builds (#608)

Co-authored-by: jstastny-cz <jan.stastny@ibm.com>

* kie-issues#643: fix PR check buildchain configuration

* kie-issues#667: fix cleanup and settingsXml handling (#613)

* kie-issues#667: fix cleanup and settingsXml handling

* adjust also MavenCommands passed to maven library methods

---------

Co-authored-by: jstastny-cz <jan.stastny@ibm.com>

* 8.x kie-issues#674: update GHA references (#614)

* kie-issues#674: update GHA references

* change surefire action

---------

Co-authored-by: jstastny-cz <jan.stastny@ibm.com>

* kie-issues#727: define push GH tokens for jenkins

* 8.x kie-issues#767: set user config for git

* NO-ISSUE: fix docker agent config

* NO-ISSUE: adjust branch mapping

* NO-ISSUE: apache transfer leftovers

* parameterize buildchain file url

---------

Co-authored-by: jstastny-cz <jan.stastny@ibm.com>
  • Loading branch information
jstastny-cz and jstastny-cz committed Jul 26, 2024
1 parent ffc95fb commit 7ccd9ef
Show file tree
Hide file tree
Showing 23 changed files with 127 additions and 83 deletions.
2 changes: 1 addition & 1 deletion .ci/environments/common/update_quarkus.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ set -euo pipefail

mvn_cmd="mvn ${BUILD_MVN_OPTS:-} ${BUILD_MVN_OPTS_QUARKUS_UPDATE:-}"

source <(curl -s https://raw.githubusercontent.com/kiegroup/kogito-pipelines/main/dsl/seed/scripts/install_quarkus.sh)
source <(curl -s https://raw.githubusercontent.com/apache/incubator-kie-kogito-pipelines/main/dsl/seed/scripts/install_quarkus.sh)

echo "Update project with Quarkus version ${QUARKUS_VERSION}"

Expand Down
44 changes: 44 additions & 0 deletions .ci/jenkins/Jenkinsfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
@Library('jenkins-pipeline-shared-libraries')_

pr_check_script = null

pipeline {
agent {
label 'ubuntu'
}
options {
timestamps()
timeout(time: 720, unit: 'MINUTES')
disableConcurrentBuilds(abortPrevious: true)
}
environment {
BUILDCHAIN_PROJECT = 'apache/incubator-kie-optaplanner-quickstarts'
BUILDCHAIN_CONFIG_REPO = 'incubator-kie-optaplanner'
BUILDCHAIN_CONFIG_FILE_PATH = '.ci/buildchain-config-pr-cdb.yaml'

OPTAPLANNER_BUILD_MVN_OPTS_UPSTREAM = '-Dfull'
BUILD_MVN_OPTS_CURRENT = '-Dfull'
}
stages {
stage('Initialize') {
steps {
script {
// load `pr_check.groovy` file from kogito-pipelines:main
dir('kogito-pipelines') {
checkout(githubscm.resolveRepository('incubator-kie-kogito-pipelines', 'apache', 'main', false, 'kie-ci'))
pr_check_script = load 'dsl/scripts/pr_check.groovy'
}
}
}
}
stage('PR check') {
steps {
script {
dir('kogito-pipelines') {
pr_check_script.launch()
}
}
}
}
}
}
57 changes: 32 additions & 25 deletions .ci/jenkins/Jenkinsfile.setup-branch
Original file line number Diff line number Diff line change
Expand Up @@ -3,65 +3,73 @@ import org.jenkinsci.plugins.workflow.libs.Library

import org.kie.jenkins.MavenCommand

optaplannerRepo = 'optaplanner'
optaplannerRepo = 'incubator-kie-optaplanner'

pipeline {
agent {
label util.avoidFaultyNodes('kie-rhel8 && !built-in')
}

tools {
maven env.BUILD_MAVEN_TOOL
jdk env.BUILD_JDK_TOOL
docker {
image env.AGENT_DOCKER_BUILDER_IMAGE
args env.AGENT_DOCKER_BUILDER_ARGS
label util.avoidFaultyNodes('ubuntu')
}
}

options {
timestamps()
timeout(time: 60, unit: 'MINUTES')
}

// parameters {
// For parameters, check into ./dsl/jobs.groovy file
// }

environment {
// Static env is defined into ./dsl/jobs.groovy file

OPTAPLANNER_CI_EMAIL_TO = credentials("${JENKINS_EMAIL_CREDS_ID}")

// Keep here for visitibility
MAVEN_OPTS = '-Xms1024m -Xmx4g'
}

stages {
stage('Initialize') {
steps {
script {
cleanWs()
cleanWs(disableDeferredWipeout: true)

if (params.DISPLAY_NAME) {
currentBuild.displayName = params.DISPLAY_NAME
}

checkoutRepo(optaplannerRepo, getBuildBranch())
optaplannerBranch = getBuildBranch() == 'development' ? 'main' : getBuildBranch()
checkoutRepo(optaplannerRepo, optaplannerBranch)
checkoutRepo(getRepoName(), getBuildBranch())
}
}
}
stage('Build OptaPlanner parents') {
steps {
script {
getMavenCommand(optaplannerRepo)
.withOptions(['-U', '-pl org.optaplanner:optaplanner-build-parent,org.optaplanner:optaplanner-bom,org.optaplanner:optaplanner-operator', '-am'])
.run('clean install')
configFileProvider([configFile(fileId: env.MAVEN_SETTINGS_CONFIG_FILE_ID, variable: 'MAVEN_SETTINGS_FILE')]){
getMavenCommand(optaplannerRepo)
.withOptions([
'-U',
'-pl org.optaplanner:optaplanner-build-parent,org.optaplanner:optaplanner-bom,org.optaplanner:optaplanner-operator',
'-am'
])
.withSettingsXmlFile(MAVEN_SETTINGS_FILE)
.run('clean install')
}
}
}
}
stage('Update project version') {
steps {
script {
maven.mvnSetVersionProperty(getMavenCommand(getRepoName()), 'version.org.optaplanner', getOptaPlannerVersion())
maven.mvnVersionsUpdateParentAndChildModules(getMavenCommand(getRepoName()), getOptaPlannerVersion(), true)
configFileProvider([configFile(fileId: env.MAVEN_SETTINGS_CONFIG_FILE_ID, variable: 'MAVEN_SETTINGS_FILE')]){
maven.mvnSetVersionProperty(
getMavenCommand(getRepoName()).withSettingsXmlFile(MAVEN_SETTINGS_FILE),
'version.org.optaplanner',
getOptaPlannerVersion()
)
maven.mvnVersionsUpdateParentAndChildModules(
getMavenCommand(getRepoName()).withSettingsXmlFile(MAVEN_SETTINGS_FILE),
getOptaPlannerVersion(),
true
)
}

dir(getRepoName()) {
sh "find . -name build.gradle -exec sed -i -E 's/def optaplannerVersion = \"[^\"\\s]+\"/def optaplannerVersion = \"${getOptaPlannerVersion()}\"/' {} \\;"
Expand Down Expand Up @@ -95,7 +103,7 @@ pipeline {
}
cleanup {
script {
util.cleanNode('docker')
util.cleanNode()
}
}
}
Expand Down Expand Up @@ -146,6 +154,5 @@ String getGitAuthorPushCredsId() {

MavenCommand getMavenCommand(String directory) {
return new MavenCommand(this, ['-fae', '-ntp'])
.withSettingsXmlId(env.MAVEN_SETTINGS_CONFIG_FILE_ID)
.inDirectory(directory)
}
9 changes: 4 additions & 5 deletions .ci/jenkins/dsl/jobs.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
* This file is describing all the Jenkins jobs in the DSL format (see https://plugins.jenkins.io/job-dsl/)
* needed by the Kogito pipelines.
*
* The main part of Jenkins job generation is defined into the https://github.com/kiegroup/kogito-pipelines repository.
* The main part of Jenkins job generation is defined into the https://github.com/apache/incubator-kie-kogito-pipelines repository.
*
* This file is making use of shared libraries defined in
* https://github.com/kiegroup/kogito-pipelines/tree/main/dsl/seed/src/main/groovy/org/kie/jenkins/jobdsl.
* https://github.com/apache/incubator-kie-kogito-pipelines/tree/main/dsl/seed/src/main/groovy/org/kie/jenkins/jobdsl.
*/

import org.kie.jenkins.jobdsl.model.JobType
Expand Down Expand Up @@ -35,7 +35,7 @@ Map getMultijobPRConfig() {
}

// Optaplanner PR checks
KogitoJobUtils.createAllEnvironmentsPerRepoPRJobs(this) { jobFolder -> getMultijobPRConfig() }
Utils.isMainBranch(this) && KogitoJobTemplate.createPullRequestMultibranchPipelineJob(this, "${jenkins_path}/Jenkinsfile")

// Init branch
createSetupBranchJob()
Expand All @@ -62,9 +62,8 @@ void setupSpecificBuildChainNightlyJob(String envName) {

void createSetupBranchJob() {
def jobParams = JobParamsUtils.getBasicJobParams(this, 'optaplanner-quickstarts', JobType.SETUP_BRANCH, "${jenkins_path}/Jenkinsfile.setup-branch", 'OptaPlanner Quickstarts Setup Branch')
JobParamsUtils.setupJobParamsDefaultMavenConfiguration(this, jobParams)
JobParamsUtils.setupJobParamsAgentDockerBuilderImageConfiguration(this, jobParams)
jobParams.env.putAll([
REPO_NAME: 'optaplanner-quickstarts',
JENKINS_EMAIL_CREDS_ID: "${JENKINS_EMAIL_CREDS_ID}",

GIT_AUTHOR: "${GIT_AUTHOR_NAME}",
Expand Down
8 changes: 4 additions & 4 deletions .ci/jenkins/dsl/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@ fi

git_author="$(echo ${git_url} | awk -F"${git_server_url}" '{print $2}' | awk -F. '{print $1}' | awk -F/ '{print $1}')"

export DSL_DEFAULT_MAIN_CONFIG_FILE_REPO="${git_author}"/optaplanner
export DSL_DEFAULT_FALLBACK_MAIN_CONFIG_FILE_REPO=kiegroup/optaplanner
export DSL_DEFAULT_MAIN_CONFIG_FILE_REPO="${git_author}"/incubator-kie-optaplanner
export DSL_DEFAULT_FALLBACK_MAIN_CONFIG_FILE_REPO=apache/incubator-kie-optaplanner
export DSL_DEFAULT_MAIN_CONFIG_FILE_PATH=.ci/jenkins/config/main.yaml
export DSL_DEFAULT_BRANCH_CONFIG_FILE_REPO="${git_author}"/optaplanner
export DSL_DEFAULT_BRANCH_CONFIG_FILE_REPO="${git_author}"/incubator-kie-optaplanner

file=$(mktemp)
# For more usage of the script, use ./test.sh -h
curl -o ${file} https://raw.githubusercontent.com/kiegroup/kogito-pipelines/main/dsl/seed/scripts/seed_test.sh
curl -o ${file} https://raw.githubusercontent.com/apache/incubator-kie-kogito-pipelines/main/dsl/seed/scripts/seed_test.sh
chmod u+x ${file}
${file} $@
6 changes: 3 additions & 3 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ and also the external https://github.com/quarkusio/quarkus-quickstarts/tree/main
### Referenced pull requests

<!-- Add URLs of all referenced pull requests if they exist. This is only required when making
changes that span multiple kiegroup repositories and depend on each other. -->
changes that span multiple KIE repositories and depend on each other. -->
<!-- Example:
- https://github.com/kiegroup/droolsjbpm-build-bootstrap/pull/1234
- https://github.com/kiegroup/drools/pull/3000
- https://github.com/kiegroup/optaplanner/pull/899
- https://github.com/apache/incubator-kie-drools/pull/3000
- https://github.com/apache/incubator-kie-optaplanner/pull/899
- etc.
-->

Expand Down
6 changes: 0 additions & 6 deletions .github/workflows/pull_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,6 @@ jobs:
- name: Support long paths
if: ${{ matrix.os == 'windows-latest' }}
uses: apache/incubator-kie-kogito-pipelines/.ci/actions/long-paths@main
- name: Sets the migration env variable on Windows
if: runner.os == 'Windows'
run: echo "MIGRATE_TO_9=${{ github.base_ref == 'development' }}" >> $env:GITHUB_ENV
- name: Sets the migration env variable on Linux
if: runner.os != 'Windows'
run: echo "MIGRATE_TO_9=${{ github.base_ref == 'development' }}" >> $GITHUB_ENV
- name: Java and Maven Setup
uses: apache/incubator-kie-kogito-pipelines/.ci/actions/maven@main
with:
Expand Down
4 changes: 2 additions & 2 deletions README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ Run the https://www.optaplanner.org/[OptaPlanner] quickstarts now:
+
[source, shell]
----
$ git clone https://github.com/kiegroup/optaplanner-quickstarts.git
$ cd optaplanner-quickstarts
$ git clone https://github.com/apache/incubator-kie-optaplanner-quickstarts.git
$ cd incubator-kie-optaplanner-quickstarts
$ ./runQuickstartsFromSource.sh
----

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ On Windows:
Run the quickstarts in IDE
----------------------------

Please refer to https://github.com/kiegroup/optaplanner-quickstarts/blob/stable/README.adoc.
Please refer to https://github.com/apache/incubator-kie-optaplanner-quickstarts/blob/stable/README.adoc.

Run the examples
----------------
Expand Down Expand Up @@ -56,7 +56,7 @@ Sources
-------

But to build from sources, pull the sources with git:
https://github.com/kiegroup/optaplanner
https://github.com/apache/incubator-kie-optaplanner

Backwards compatibility
-----------------------
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
</a>
<ul class="navbar-nav mr-auto">
<li class="nav-item">
<a class="nav-link" href="https://github.com/kiegroup/optaplanner-quickstarts" target="_blank">Source code</a>
<a class="nav-link" href="https://github.com/apache/incubator-kie-optaplanner-quickstarts" target="_blank">Source code</a>
</li>
<li class="nav-item">
<a class="nav-link" href="https://www.optaplanner.org/learn/documentation.html" target="_blank">Documentation</a>
Expand Down
4 changes: 2 additions & 2 deletions hello-world/README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ Assign lessons to timeslots and rooms to produce a better schedule for teachers
+
[source, shell]
----
$ git clone https://github.com/kiegroup/optaplanner-quickstarts.git
$ git clone https://github.com/apache/incubator-kie-optaplanner-quickstarts.git
...
$ cd optaplanner-quickstarts/hello-world
$ cd incubator-kie-optaplanner-quickstarts/hello-world
----

. Start the application with Maven:
Expand Down
4 changes: 2 additions & 2 deletions technology/java-activemq-quarkus/README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ The quickstart consists of two modules:
+
[source, shell]
----
$ git clone https://github.com/kiegroup/optaplanner-quickstarts.git
$ git clone https://github.com/apache/incubator-kie-optaplanner-quickstarts.git
...
$ cd optaplanner-quickstarts/technology/java-activemq-quarkus
$ cd incubator-kie-optaplanner-quickstarts/technology/java-activemq-quarkus
----

. Build the project:
Expand Down
4 changes: 2 additions & 2 deletions technology/java-spring-boot/README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ image::../../build/quickstarts-showcase/src/main/resources/META-INF/resources/sc
+
[source, shell]
----
$ git clone https://github.com/kiegroup/optaplanner-quickstarts.git
$ git clone https://github.com/apache/incubator-kie-optaplanner-quickstarts.git
...
$ cd optaplanner-quickstarts/technology/java-spring-boot
$ cd incubator-kie-optaplanner-quickstarts/technology/java-spring-boot
----

. Start the application with Maven:
Expand Down
6 changes: 3 additions & 3 deletions technology/kotlin-quarkus/README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ image::../../build/quickstarts-showcase/src/main/resources/META-INF/resources/sc
+
[source, shell]
----
$ git clone https://github.com/kiegroup/optaplanner-quickstarts.git
$ git clone https://github.com/apache/incubator-kie-optaplanner-quickstarts.git
...
$ cd optaplanner-quickstarts/technology/kotlin-quarkus
$ cd incubator-kie-optaplanner-quickstarts/technology/kotlin-quarkus
----

. Start the application with Maven:
Expand Down Expand Up @@ -92,7 +92,7 @@ To deploy the application on OpenShift:
. In the OpenShift web console, verify that the top left combobox is set to _Developer_ (not _Administrator_).
. In the menu, select *Add* to create an application.
. Under *Git Repository*, click *Import from Git* and fill in these parameters:
.. Set *Git Repo URL* to `https://github.com/kiegroup/optaplanner-quickstarts`
.. Set *Git Repo URL* to `https://github.com/apache/incubator-kie-optaplanner-quickstarts`
.. Under _Show advanced Git options_, set *Context dir* to `/technology/kotlin-quarkus`
.. Press the *Create* button.
. In the _Topology_ view, there is a new deployment:
Expand Down
2 changes: 1 addition & 1 deletion technology/kubernetes/README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ Follow the https://keda.sh/docs/deploy/[documentation] to install the KEDA opera

==== Deploy the OptaPlanner Operator

Follow the https://github.com/kiegroup/optaplanner/tree/main/optaplanner-operator#deploy-the-optaplanner-operator[README] to install the OptaPlanner operator.
Follow the https://github.com/apache/incubator-kie-optaplanner/tree/main/optaplanner-operator#deploy-the-optaplanner-operator[README] to install the OptaPlanner operator.

==== Deploy the Demo App

Expand Down
6 changes: 3 additions & 3 deletions use-cases/call-center/README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ image::../../build/quickstarts-showcase/src/main/resources/META-INF/resources/sc
+
[source, shell]
----
$ git clone https://github.com/kiegroup/optaplanner-quickstarts.git
$ git clone https://github.com/apache/incubator-kie-optaplanner-quickstarts.git
...
$ cd optaplanner-quickstarts/use-cases/call-center
$ cd incubator-kie-optaplanner-quickstarts/use-cases/call-center
----

. Start the application with Maven:
Expand Down Expand Up @@ -87,7 +87,7 @@ To deploy the application on OpenShift:
. In the OpenShift web console, verify that the top left combobox is set to _Developer_ (not _Administrator_).
. In the menu, select *Add* to create an application.
. Under *Git Repository*, click *Import from Git* and fill in these parameters:
.. Set *Git Repo URL* to `https://github.com/kiegroup/optaplanner-quickstarts`
.. Set *Git Repo URL* to `https://github.com/apache/incubator-kie-optaplanner-quickstarts`
.. Under _Show advanced Git options_, set *Context dir* to `/use-cases/call-center`
.. Press the *Create* button.
. In the _Topology_ view, there is a new deployment:
Expand Down
6 changes: 3 additions & 3 deletions use-cases/employee-scheduling/README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ image::../../build/quickstarts-showcase/src/main/resources/META-INF/resources/sc
+
[source, shell]
----
$ git clone https://github.com/kiegroup/optaplanner-quickstarts.git
$ git clone https://github.com/apache/incubator-kie-optaplanner-quickstarts.git
...
$ cd optaplanner-quickstarts/use-cases/employee-scheduling
$ cd incubator-kie-optaplanner-quickstarts/use-cases/employee-scheduling
----

. Start the application with Maven:
Expand Down Expand Up @@ -87,7 +87,7 @@ To deploy the application on OpenShift:
. In the OpenShift web console, verify that the top left combobox is set to _Developer_ (not _Administrator_).
. In the menu, select *Add* to create an application.
. Under *Git Repository*, click *Import from Git* and fill in these parameters:
.. Set *Git Repo URL* to `https://github.com/kiegroup/optaplanner-quickstarts`
.. Set *Git Repo URL* to `https://github.com/apache/incubator-kie-optaplanner-quickstarts`
.. Under _Show advanced Git options_, set *Context dir* to `/use-cases/employee-scheduling`
.. Press the *Create* button.
. In the _Topology_ view, there is a new deployment:
Expand Down
Loading

0 comments on commit 7ccd9ef

Please sign in to comment.