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

kie-issues#574 Initial ASF Jenkins CI Setup #2985

Merged
merged 1 commit into from
Sep 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .ci/buildchain-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ default:
docker system prune -f

build:
- project: kiegroup/optaplanner
- project: apache/incubator-kie-optaplanner
build-command:
before:
upstream: |
Expand All @@ -35,7 +35,7 @@ build:
upstream: |
mvn clean install -Dquickly ${{ env.BUILD_MVN_OPTS }} ${{ env.BUILD_MVN_OPTS_UPSTREAM }} ${{ env.OPTAPLANNER_BUILD_MVN_OPTS_UPSTREAM }}

- project: kiegroup/optaplanner-quickstarts
- project: apache/incubator-kie-optaplanner-quickstarts
build-command:
current: |
mvn clean install ${{ env.BUILD_MVN_OPTS }} ${{ env.BUILD_MVN_OPTS_CURRENT }} ${{ env.OPTAPLANNER_QUICKSTARTS_BUILD_MVN_OPTS }}
Expand Down
6 changes: 3 additions & 3 deletions .ci/buildchain-project-dependencies.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
version: "2.1"
dependencies:
- project: kiegroup/optaplanner
- project: kiegroup/optaplanner-quickstarts
- project: apache/incubator-kie-optaplanner
- project: apache/incubator-kie-optaplanner-quickstarts
dependencies:
- project: kiegroup/optaplanner
- project: apache/incubator-kie-optaplanner
mapping:
dependencies:
default:
Expand Down
2 changes: 1 addition & 1 deletion .ci/environments/common/update_quarkus.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,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: 360, unit: 'MINUTES')
}
environment {
BUILDCHAIN_PROJECT = 'apache/incubator-kie-optaplanner'
BUILDCHAIN_CONFIG_REPO = 'incubator-kie-optaplanner'
BUILDCHAIN_CONFIG_FILE_PATH = '.ci/buildchain-config.yaml'

ENABLE_SONARCLOUD = 'true'
SONARCLOUD_ANALYSIS_MVN_OPTS = '-Dsonar.projectKey=org.optaplanner:optaplanner'
OPTAPLANNER_BUILD_MVN_OPTS = '-Prun-code-coverage'
}
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, 'ASF_Cloudbees_Jenkins_ci-builds'))
pr_check_script = load 'dsl/scripts/pr_check.groovy'
}
}
}
}
stage('PR check') {
steps {
script {
dir('kogito-pipelines') {
pr_check_script.launch()
}
}
}
}
}
}
35 changes: 11 additions & 24 deletions .ci/jenkins/Jenkinsfile.deploy
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,17 @@ import org.kie.jenkins.MavenStagingHelper

deployProperties = [:]

optaplannerRepository = 'optaplanner'
quickstartsRepository = 'optaplanner-quickstarts'
optaplannerRepository = 'incubator-kie-optaplanner'
quickstartsRepository = 'incubator-kie-optaplanner-quickstarts'

imageUtils = null

pipeline {
agent {
label 'kie-rhel8 && docker && kie-mem16g && !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
}
}

options {
Expand All @@ -28,21 +26,13 @@ pipeline {
disableConcurrentBuilds(abortPrevious: true)
}

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

environment {
// Some generated env is also defined into .jenkins/dsl/jobs.groovy file

OPTAPLANNER_CI_EMAIL_TO = credentials("${JENKINS_EMAIL_CREDS_ID}")

MAVEN_OPTS = '-Xms1024m -Xmx4g'

PR_BRANCH_HASH = "${util.generateHash(10)}"

// Maven configuration
MAVEN_DEPLOY_LOCAL_DIR = "${WORKSPACE}/maven_deploy_dir"
MAVEN_DEPLOY_LOCAL_DIR = "/tmp/maven_deploy_dir"
}

stages {
Expand Down Expand Up @@ -197,9 +187,6 @@ pipeline {
when {
expression { return shouldStageArtifacts() }
}
tools {
jdk 'kie-jdk11'
}
steps {
script {
// Stage release artifacts
Expand Down Expand Up @@ -320,7 +307,7 @@ void checkoutRepo(String repo, String dirName = repo) {
dir(dirName) {
deleteDir()
if (params.PR_TARGET_BRANCH) {
githubscm.checkoutIfExists(repo, getGitAuthor(), getBuildBranch(), 'kiegroup', getFallbackBranch(repo), true)
githubscm.checkoutIfExists(repo, getGitAuthor(), getBuildBranch(), 'apache', getFallbackBranch(repo), true)
} else {
checkout(githubscm.resolveRepository(repo, getGitAuthor(), getBuildBranch(), false))
}
Expand All @@ -331,15 +318,15 @@ void checkoutQuickstarts(String dirName = quickstartsRepository) {
dir(dirName) {
deleteDir()
if (params.PR_TARGET_BRANCH) {
githubscm.checkoutIfExists(quickstartsRepository, getGitAuthor(), getBuildBranch(), 'kiegroup', getQuickStartsBranch(), true)
githubscm.checkoutIfExists(quickstartsRepository, getGitAuthor(), getBuildBranch(), 'apache', getQuickStartsBranch(), true)
} else {
checkout(githubscm.resolveRepository(quickstartsRepository, getGitAuthor(), getQuickStartsBranch(), false))
}
}
}

String getFallbackBranch(String repo) {
def repositoryScm = githubscm.getRepositoryScm(repo, 'kiegroup', params.PR_TARGET_BRANCH)
def repositoryScm = githubscm.getRepositoryScm(repo, 'apache', params.PR_TARGET_BRANCH)
return repositoryScm ? params.PR_TARGET_BRANCH : 'main'
}

Expand Down Expand Up @@ -452,7 +439,7 @@ boolean shouldDeployToRepository() {
}

boolean isNotTestingBuild() {
return getGitAuthor() == 'kiegroup'
return getGitAuthor() == 'apache'
}

boolean isRelease() {
Expand Down
Loading