From e85b805ed73703ce6637501048a1ff005b7e77b6 Mon Sep 17 00:00:00 2001 From: Jan Stastny Date: Tue, 19 Sep 2023 20:22:36 +0200 Subject: [PATCH 1/9] kie-issues#574 Initial ASF Jenkins CI Setup (#1703) Prepare for Apache migration Fix Cloud credentials reference Remove prod jobs Remove PR job update pipelines (#1697) PR multibranchPipelineJob (#1700) Update `kiegroup` repository references to `apache` (#1698) Co-authored-by: radtriste Co-authored-by: jstastny-cz --- .ci/jenkins/Jenkinsfile | 22 +---- .ci/jenkins/Jenkinsfile.build-image | 22 +---- .ci/jenkins/Jenkinsfile.deploy | 13 +-- .ci/jenkins/Jenkinsfile.promote | 17 ++-- .ci/jenkins/Jenkinsfile.setup-branch | 21 +--- .ci/jenkins/Jenkinsfile.update-prod-version | 103 -------------------- .ci/jenkins/dsl/jobs.groovy | 71 ++++---------- .ci/jenkins/dsl/test.sh | 2 +- .github/workflows/jenkins-tests-PR.yml | 4 +- 9 files changed, 49 insertions(+), 226 deletions(-) delete mode 100644 .ci/jenkins/Jenkinsfile.update-prod-version diff --git a/.ci/jenkins/Jenkinsfile b/.ci/jenkins/Jenkinsfile index 9111c2a74..693fa00c2 100644 --- a/.ci/jenkins/Jenkinsfile +++ b/.ci/jenkins/Jenkinsfile @@ -2,11 +2,7 @@ pipeline { agent { - label 'rhel8 && !built-in' - } - tools { - maven env.BUILD_MAVEN_TOOL - jdk env.BUILD_JDK_TOOL + label 'ubuntu' } options { timeout(time: 120, unit: 'MINUTES') @@ -19,7 +15,7 @@ pipeline { sh 'printenv' - githubscm.checkoutIfExists(getRepoName(), getChangeAuthor(), getChangeBranch(), 'kiegroup', getChangeTarget(), true) + githubscm.checkoutIfExists(getRepoName(), getChangeAuthor(), getChangeBranch(), 'apache', getChangeTarget(), true) } } } @@ -56,7 +52,7 @@ pipeline { } unsuccessful { script { - pullrequest.postComment(util.getMarkdownTestSummary(isProdCI() ? 'Prod' : 'PR', '', "${BUILD_URL}", 'GITHUB')) + pullrequest.postComment(util.getMarkdownTestSummary('PR', "${BUILD_URL}", 'GITHUB')) } } } @@ -77,7 +73,7 @@ Closure createBuildAndTestStageClosure(String image) { buildParams.add(string(name: 'TARGET_BRANCH', value: getChangeTarget())) buildParams.add(string(name: 'BUILD_KOGITO_APPS_REF', value: getChangeTarget())) - githubscm.prepareCommitStatusInformationForPullRequest(getRepoName(), getChangeAuthor(), getChangeBranch(), 'kiegroup', getGitAuthorCredentialsId()) + githubscm.prepareCommitStatusInformationForPullRequest(getRepoName(), getChangeAuthor(), getChangeBranch(), 'apache', getGitAuthorCredentialsId()) githubscm.updateGithubCommitStatus(image, 'PENDING', 'Queued', getRepoName()) // Keep executing so we can cancel all if needed @@ -97,15 +93,7 @@ String[] getImages() { if (env.IMAGES_LIST) { return env.IMAGES_LIST.split(',') } - String listCmd = 'make list' - if (isProdCI()) { - listCmd += ' arg=--prod' - } - return util.runWithPythonVirtualEnv("${listCmd} | tr '\\n' ','", 'cekit', true).trim().split(',') -} - -boolean isProdCI() { - return env.PROD_CI ? env.PROD_CI.toBoolean() : false + return sh(returnStdout: true, script: "make list | tr '\\n' ','").trim().split(',') } String getChangeAuthor() { diff --git a/.ci/jenkins/Jenkinsfile.build-image b/.ci/jenkins/Jenkinsfile.build-image index 2d5d323fc..f13a64043 100644 --- a/.ci/jenkins/Jenkinsfile.build-image +++ b/.ci/jenkins/Jenkinsfile.build-image @@ -4,18 +4,15 @@ QUAY_REGISTRY = 'quay.io' pipeline { agent { - label 'kie-rhel8 && docker && !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 { timeout(time: 120, unit: 'MINUTES') } environment { - CI = true - // Linked to node label // Use docker due to multiplatform build CONTAINER_ENGINE = 'docker' @@ -49,11 +46,6 @@ pipeline { } updateGithubCommitStatus('PENDING', 'Started') - if (isProdCI()) { - // Prod fix to be able to build the image as a community one - sh "echo '' > content_sets.yaml" - } - // Login to final registry if deploy is needed if (shouldDeployImage()) { if (isDeployImageInOpenshiftRegistry()) { @@ -253,7 +245,7 @@ String getBuiltImageTag(String imageTag = '') { } void runPythonCommand(String cmd, boolean stdout = false) { - return util.runWithPythonVirtualEnv(cmd, 'cekit', stdout) + return sh(returnStdout: stdout, script: cmd) } //////////////////////////////////////////////////////////////////////// @@ -364,10 +356,6 @@ String getMavenArtifactRepository() { return params.MAVEN_ARTIFACTS_REPOSITORY } -boolean isProdCI() { - return env.PROD_CI ? Boolean.parseBoolean(env.PROD_CI) : false -} - String getQuarkusPlatformURL() { return params.QUARKUS_PLATFORM_URL } diff --git a/.ci/jenkins/Jenkinsfile.deploy b/.ci/jenkins/Jenkinsfile.deploy index 99a9d88eb..3faa0948b 100644 --- a/.ci/jenkins/Jenkinsfile.deploy +++ b/.ci/jenkins/Jenkinsfile.deploy @@ -10,13 +10,10 @@ TEST_FAILED_IMAGES = [] pipeline { agent { - label 'rhel8 && !built-in' - } - - // Needed for local build - 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 { @@ -425,7 +422,7 @@ String[] getImages() { } void runPythonCommand(String cmd, boolean stdout = false) { - return util.runWithPythonVirtualEnv(cmd, 'cekit', stdout) + return sh(returnStdout: stdout, script: cmd) } String getQuarkusPlatformVersion() { diff --git a/.ci/jenkins/Jenkinsfile.promote b/.ci/jenkins/Jenkinsfile.promote index 5604453da..9bf8b4994 100644 --- a/.ci/jenkins/Jenkinsfile.promote +++ b/.ci/jenkins/Jenkinsfile.promote @@ -5,24 +5,21 @@ deployProperties = [:] pipeline { agent { - label 'rhel8 && podman && !built-in' + docker { + image env.AGENT_DOCKER_BUILDER_IMAGE + args env.AGENT_DOCKER_BUILDER_ARGS + } } options { timeout(time: 120, unit: 'MINUTES') } - // parameters { - // For parameters, check into ./dsl/jobs.groovy file - // } environment { - // Static env is defined into ./dsl/jobs.groovy file - KOGITO_CI_EMAIL_TO = credentials("${JENKINS_EMAIL_CREDS_ID}") - // Linked to node label - CONTAINER_ENGINE = 'podman' - CONTAINER_ENGINE_TLS_OPTIONS = '--tls-verify=false' + CONTAINER_ENGINE = 'docker' + CONTAINER_ENGINE_TLS_OPTIONS = '' OPENSHIFT_API = credentials('OPENSHIFT_API') OPENSHIFT_REGISTRY = credentials('OPENSHIFT_REGISTRY') @@ -359,5 +356,5 @@ String[] getImages() { } void runPythonCommand(String cmd, boolean stdout = false) { - return util.runWithPythonVirtualEnv(cmd, 'cekit', stdout) + return sh(returnStdout: stdout, script: cmd) } diff --git a/.ci/jenkins/Jenkinsfile.setup-branch b/.ci/jenkins/Jenkinsfile.setup-branch index 9e0e4459c..182689cb0 100644 --- a/.ci/jenkins/Jenkinsfile.setup-branch +++ b/.ci/jenkins/Jenkinsfile.setup-branch @@ -3,29 +3,18 @@ import org.jenkinsci.plugins.workflow.libs.Library pipeline { agent { - label 'rhel8 && podman && !built-in' - } - - // Needed for local build - 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 { timeout(time: 120, unit: 'MINUTES') } - // parameters { - // For parameters, check into ./dsl/jobs.groovy file - // } - environment { - // Static env is defined into ./dsl/jobs.groovy file - KOGITO_CI_EMAIL_TO = credentials("${JENKINS_EMAIL_CREDS_ID}") - - JAVA_HOME = "${GRAALVM_HOME}" } stages { @@ -182,5 +171,5 @@ String getCleanedReleaseNotes() { } void runPythonCommand(String cmd, boolean stdout = false) { - return util.runWithPythonVirtualEnv(cmd, 'cekit', stdout) + return sh(returnStdout: stdout, script: cmd) } \ No newline at end of file diff --git a/.ci/jenkins/Jenkinsfile.update-prod-version b/.ci/jenkins/Jenkinsfile.update-prod-version deleted file mode 100644 index 3d4bb28a0..000000000 --- a/.ci/jenkins/Jenkinsfile.update-prod-version +++ /dev/null @@ -1,103 +0,0 @@ -@Library('jenkins-pipeline-shared-libraries')_ - -pipeline { - agent { - label 'rhel8 && podman && !built-in' - } - - options { - timeout(time: 30, unit: 'MINUTES') - } - - // parameters { - // For parameters, check into ./dsl/jobs.groovy file - // } - - environment { - // Static env is defined into ./dsl/jobs.groovy file - - PR_BRANCH_HASH = "${util.generateHash(10)}" - } - - stages { - stage('Initialization') { - steps { - script { - assert getProdProjectVersion() - assert getJiraNumber() - - currentBuild.displayName = getProdProjectVersion() - - deleteDir() - checkout(githubscm.resolveRepository(getRepoName(), getGitAuthor(), getBuildBranch(), false)) - } - } - } - stage('Prepare for PR') { - steps { - script { - githubscm.createBranch(getPRBranch()) - } - } - } - stage('Update prod version') { - when { - expression { return getProdProjectVersion() != '' } - } - steps { - script { - sh "python3 scripts/manage-kogito-version.py --bump-to ${getProdProjectVersion()} --confirm --prod" - } - } - } - stage('Create PR') { - steps { - script { - String commitMsg = "[${getJiraNumber()}] Update product version to ${getProdProjectVersion()}" - if (githubscm.isThereAnyChanges()) { - githubscm.commitChanges(commitMsg) - } else { - error 'No update version can be done' - } - githubscm.pushObject('origin', getPRBranch(), getGitAuthorCredsID()) - String prLink = githubscm.createPR(commitMsg, 'Please review and merge', getBuildBranch(), getGitAuthorCredsID()) - - echo "Created PR ${prLink}" - } - } - } - } - post { - cleanup { - cleanWs() - } - } -} - -String getRepoName() { - return "${REPO_NAME}" -} - -String getBuildBranch() { - return "${BUILD_BRANCH_NAME}" -} - -String getGitAuthor() { - return "${GIT_AUTHOR}" -} - -String getGitAuthorCredsID() { - return env.AUTHOR_CREDS_ID -} - -String getPRBranch() { - return "${getProdProjectVersion() ?: getBuildBranch()}-${env.PR_BRANCH_HASH}" -} - -String getProdProjectVersion() { - return "${PROD_PROJECT_VERSION}" -} - -String getJiraNumber() { - return "${JIRA_NUMBER}" -} \ No newline at end of file diff --git a/.ci/jenkins/dsl/jobs.groovy b/.ci/jenkins/dsl/jobs.groovy index 7ffb080f9..d04664573 100644 --- a/.ci/jenkins/dsl/jobs.groovy +++ b/.ci/jenkins/dsl/jobs.groovy @@ -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 @@ -17,7 +17,7 @@ import org.kie.jenkins.jobdsl.Utils jenkins_path = '.ci/jenkins' // PR checks -setupPrJob() +Utils.isMainBranch(this) && KogitoJobTemplate.createPullRequestMultibranchPipelineJob(this, "${jenkins_path}/Jenkinsfile") // Init branch createSetupBranchJob() @@ -30,12 +30,6 @@ KogitoJobUtils.createEnvironmentIntegrationBranchNightlyJob(this, 'quarkus-lts') setupDeployJob(JobType.RELEASE) setupPromoteJob(JobType.RELEASE) -if (Utils.isProductizedBranch(this)) { - setupPrJob(true) // Prod CI job - setupProdUpdateVersionJob() - setupQuarkusUpdateJob(true) // Prod CI job -} - // Update quarkus on community setupQuarkusUpdateJob() @@ -43,11 +37,11 @@ setupQuarkusUpdateJob() // Methods ///////////////////////////////////////////////////////////////// -void setupPrJob(boolean isProdCI = false) { - setupBuildImageJob(JobType.PULL_REQUEST, isProdCI) +void setupPrJob() { + setupBuildImageJob(JobType.PULL_REQUEST) - def jobParams = JobParamsUtils.getBasicJobParams(this, 'kogito-images', JobType.PULL_REQUEST, "${jenkins_path}/Jenkinsfile", "Kogito Images${isProdCI ? ' Prod' : ''} PR check") - JobParamsUtils.setupJobParamsDefaultMavenConfiguration(this, jobParams) + def jobParams = JobParamsUtils.getBasicJobParams(this, 'kogito-images', JobType.PULL_REQUEST, "${jenkins_path}/Jenkinsfile", "Kogito Images PR check") + JobParamsUtils.setupJobParamsAgentDockerBuilderImageConfiguration(this, jobParams) jobParams.pr.putAll([ run_only_for_branches: [ "${GIT_BRANCH}" ], disable_status_message_error: true, @@ -55,13 +49,7 @@ void setupPrJob(boolean isProdCI = false) { commitContext: 'Retrieve and Launch Image Checks', contextShowtestResults: false, ]) - if (isProdCI) { - jobParams.job.name += '.prod' - jobParams.pr.trigger_phrase = '.*[j|J]enkins,?.*(rerun|run) [prod|Prod|PROD].*' - jobParams.pr.trigger_phrase_only = true - jobParams.pr.commitContext = '(Prod) Retrieve and Launch Image Checks' - jobParams.env.put('PROD_CI', true) - } else if (Utils.hasBindingValue(this, 'CLOUD_IMAGES')) { + if (Utils.hasBindingValue(this, 'CLOUD_IMAGES')) { jobParams.env.put('IMAGES_LIST', Utils.getBindingValue(this, 'CLOUD_IMAGES')) } jobParams.env.putAll([ @@ -72,9 +60,8 @@ void setupPrJob(boolean isProdCI = false) { void createSetupBranchJob() { def jobParams = JobParamsUtils.getBasicJobParams(this, 'kogito-images', JobType.SETUP_BRANCH, "${jenkins_path}/Jenkinsfile.setup-branch", 'Kogito Images Init Branch') - JobParamsUtils.setupJobParamsDefaultMavenConfiguration(this, jobParams) + JobParamsUtils.setupJobParamsAgentDockerBuilderImageConfiguration(this, jobParams) jobParams.env.putAll([ - REPO_NAME: 'kogito-images', GIT_AUTHOR: "${GIT_AUTHOR_NAME}", JENKINS_EMAIL_CREDS_ID: "${JENKINS_EMAIL_CREDS_ID}", @@ -102,7 +89,7 @@ void setupDeployJob(JobType jobType) { setupBuildImageJob(jobType) def jobParams = JobParamsUtils.getBasicJobParams(this, 'kogito-images-deploy', jobType, "${jenkins_path}/Jenkinsfile.deploy", 'Kogito Images Deploy') - JobParamsUtils.setupJobParamsDefaultMavenConfiguration(this, jobParams) + JobParamsUtils.setupJobParamsAgentDockerBuilderImageConfiguration(this, jobParams) jobParams.env.putAll([ PROPERTIES_FILE_NAME: 'deployment.properties', @@ -139,7 +126,7 @@ void setupDeployJob(JobType jobType) { // Deploy information booleanParam('DEPLOY_IMAGE', !Utils.getBindingValue(this, 'DISABLE_DEPLOY').toBoolean(), 'Should we deploy image to given deploy registry ?') booleanParam('IMAGE_USE_OPENSHIFT_REGISTRY', false, 'Set to true if image should be deployed in Openshift registry.In this case, IMAGE_REGISTRY_CREDENTIALS, IMAGE_REGISTRY and IMAGE_NAMESPACE parameters will be ignored') - stringParam('IMAGE_REGISTRY_CREDENTIALS', "${CLOUD_IMAGE_REGISTRY_CREDENTIALS_NIGHTLY}", 'Image registry credentials to use to deploy images. Will be ignored if no IMAGE_REGISTRY is given') + stringParam('IMAGE_REGISTRY_CREDENTIALS', "${CLOUD_IMAGE_REGISTRY_CREDENTIALS}", 'Image registry credentials to use to deploy images. Will be ignored if no IMAGE_REGISTRY is given') stringParam('IMAGE_REGISTRY', "${CLOUD_IMAGE_REGISTRY}", 'Image registry to use to deploy images') stringParam('IMAGE_NAMESPACE', "${CLOUD_IMAGE_NAMESPACE}", 'Image namespace to use to deploy images') stringParam('IMAGE_NAME_SUFFIX', '', 'Image name suffix to use to deploy images. In case you need to change the final image name, you can add a suffix to it.') @@ -159,16 +146,15 @@ void setupDeployJob(JobType jobType) { } } -void setupBuildImageJob(JobType jobType, boolean prodCI = false) { +void setupBuildImageJob(JobType jobType) { def jobParams = JobParamsUtils.getBasicJobParams(this, 'kogito-images.build-image', jobType, "${jenkins_path}/Jenkinsfile.build-image", 'Kogito Images Build single image') // Use jenkinsfile from the build branch jobParams.git.author = '${SOURCE_AUTHOR}' jobParams.git.branch = '${SOURCE_BRANCH}' - JobParamsUtils.setupJobParamsDefaultMavenConfiguration(this, jobParams) + JobParamsUtils.setupJobParamsAgentDockerBuilderImageConfiguration(this, jobParams) jobParams.env.putAll([ MAX_REGISTRY_RETRIES: 3, TARGET_AUTHOR: Utils.getGitAuthor(this), // In case of a PR to merge with target branch - PROD_CI: prodCI, AUTHOR_CREDS_ID: "${GIT_AUTHOR_CREDENTIALS_ID}", AUTHOR_TOKEN_CREDS_ID: "${GIT_AUTHOR_TOKEN_CREDENTIALS_ID}", @@ -200,7 +186,7 @@ void setupBuildImageJob(JobType jobType, boolean prodCI = false) { // Deploy information booleanParam('DEPLOY_IMAGE', !Utils.getBindingValue(this, 'DISABLE_DEPLOY').toBoolean(), 'Should we deploy image to given deploy registry ?') booleanParam('DEPLOY_IMAGE_USE_OPENSHIFT_REGISTRY', false, 'Set to true if image should be deployed in Openshift registry.In this case, IMAGE_REGISTRY_CREDENTIALS, IMAGE_REGISTRY and IMAGE_NAMESPACE parameters will be ignored') - stringParam('DEPLOY_IMAGE_REGISTRY_CREDENTIALS', "${CLOUD_IMAGE_REGISTRY_CREDENTIALS_NIGHTLY}", 'Image registry credentials to use to deploy images. Will be ignored if no IMAGE_REGISTRY is given') + stringParam('DEPLOY_IMAGE_REGISTRY_CREDENTIALS', "${CLOUD_IMAGE_REGISTRY_CREDENTIALS}", 'Image registry credentials to use to deploy images. Will be ignored if no IMAGE_REGISTRY is given') stringParam('DEPLOY_IMAGE_REGISTRY', "${CLOUD_IMAGE_REGISTRY}", 'Image registry to use to deploy images') stringParam('DEPLOY_IMAGE_NAMESPACE', "${CLOUD_IMAGE_NAMESPACE}", 'Image namespace to use to deploy images') stringParam('DEPLOY_IMAGE_NAME_SUFFIX', '', 'Image name suffix to use to deploy images. In case you need to change the final image name, you can add a suffix to it.') @@ -212,8 +198,8 @@ void setupBuildImageJob(JobType jobType, boolean prodCI = false) { void setupPromoteJob(JobType jobType) { def jobParams = JobParamsUtils.getBasicJobParams(this, 'kogito-images-promote', jobType, "${jenkins_path}/Jenkinsfile.promote", 'Kogito Images Promote') + JobParamsUtils.setupJobParamsAgentDockerBuilderImageConfiguration(this, jobParams) jobParams.env.putAll([ - REPO_NAME: 'kogito-images', PROPERTIES_FILE_NAME: 'deployment.properties', MAX_REGISTRY_RETRIES: 3, @@ -242,7 +228,7 @@ void setupPromoteJob(JobType jobType) { // Base images information which can override `deployment.properties` booleanParam('BASE_IMAGE_USE_OPENSHIFT_REGISTRY', false, 'Override `deployment.properties`. Set to true if base image should be retrieved from Openshift registry.In this case, BASE_IMAGE_REGISTRY_CREDENTIALS, BASE_IMAGE_REGISTRY and BASE_IMAGE_NAMESPACE parameters will be ignored') - stringParam('BASE_IMAGE_REGISTRY_CREDENTIALS', "${CLOUD_IMAGE_REGISTRY_CREDENTIALS_NIGHTLY}", 'Override `deployment.properties`. Base Image registry credentials to use to deploy images. Will be ignored if no BASE_IMAGE_REGISTRY is given') + stringParam('BASE_IMAGE_REGISTRY_CREDENTIALS', "${CLOUD_IMAGE_REGISTRY_CREDENTIALS}", 'Override `deployment.properties`. Base Image registry credentials to use to deploy images. Will be ignored if no BASE_IMAGE_REGISTRY is given') stringParam('BASE_IMAGE_REGISTRY', "${CLOUD_IMAGE_REGISTRY}", 'Override `deployment.properties`. Base image registry') stringParam('BASE_IMAGE_NAMESPACE', "${CLOUD_IMAGE_NAMESPACE}", 'Override `deployment.properties`. Base image namespace') stringParam('BASE_IMAGE_NAMES', '', 'Override `deployment.properties`. Comma separated list of images') @@ -251,7 +237,7 @@ void setupPromoteJob(JobType jobType) { // Promote images information booleanParam('PROMOTE_IMAGE_USE_OPENSHIFT_REGISTRY', false, 'Set to true if base image should be deployed in Openshift registry.In this case, PROMOTE_IMAGE_REGISTRY_CREDENTIALS, PROMOTE_IMAGE_REGISTRY and PROMOTE_IMAGE_NAMESPACE parameters will be ignored') - stringParam('PROMOTE_IMAGE_REGISTRY_CREDENTIALS', "${CLOUD_IMAGE_REGISTRY_CREDENTIALS_NIGHTLY}", 'Promote Image registry credentials to use to deploy images. Will be ignored if no PROMOTE_IMAGE_REGISTRY is given') + stringParam('PROMOTE_IMAGE_REGISTRY_CREDENTIALS', "${CLOUD_IMAGE_REGISTRY_CREDENTIALS}", 'Promote Image registry credentials to use to deploy images. Will be ignored if no PROMOTE_IMAGE_REGISTRY is given') stringParam('PROMOTE_IMAGE_REGISTRY', "${CLOUD_IMAGE_REGISTRY}", 'Promote image registry') stringParam('PROMOTE_IMAGE_NAMESPACE', "${CLOUD_IMAGE_NAMESPACE}", 'Promote image namespace') stringParam('PROMOTE_IMAGE_NAME_SUFFIX', '', 'Promote image name suffix') @@ -269,27 +255,8 @@ void setupPromoteJob(JobType jobType) { } } -void setupProdUpdateVersionJob() { - def jobParams = JobParamsUtils.getBasicJobParams(this, 'kogito-images-update-prod-version', JobType.TOOLS, "${jenkins_path}/Jenkinsfile.update-prod-version", 'Update prod version for Kogito Images') - jobParams.env.putAll([ - REPO_NAME: 'kogito-images', - - BUILD_BRANCH_NAME: "${GIT_BRANCH}", - GIT_AUTHOR: "${GIT_AUTHOR_NAME}", - AUTHOR_CREDS_ID: "${GIT_AUTHOR_CREDENTIALS_ID}", - GITHUB_TOKEN_CREDS_ID: "${GIT_AUTHOR_TOKEN_CREDENTIALS_ID}", - ]) - KogitoJobTemplate.createPipelineJob(this, jobParams)?.with { - parameters { - stringParam('JIRA_NUMBER', '', 'KIECLOUD-XXX or RHPAM-YYYY or else. This will be added to the commit and PR.') - stringParam('PROD_PROJECT_VERSION', '', 'Which version to set ?') - } - } -} - -void setupQuarkusUpdateJob(boolean isProdCI = false) { - def prodFlag = isProdCI ? '--prod' : '' +void setupQuarkusUpdateJob() { KogitoJobUtils.createQuarkusUpdateToolsJob(this, 'kogito-images', [:], [:], [], [ - "source ~/virtenvs/cekit/bin/activate && python3 scripts/update-repository.py --quarkus-platform-version %new_version% ${prodFlag}" + "source ~/virtenvs/cekit/bin/activate && python3 scripts/update-repository.py --quarkus-platform-version %new_version%" ]) } diff --git a/.ci/jenkins/dsl/test.sh b/.ci/jenkins/dsl/test.sh index ad8af34ac..2d518eb9f 100755 --- a/.ci/jenkins/dsl/test.sh +++ b/.ci/jenkins/dsl/test.sh @@ -1,6 +1,6 @@ #!/bin/bash -e 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} $@ \ No newline at end of file diff --git a/.github/workflows/jenkins-tests-PR.yml b/.github/workflows/jenkins-tests-PR.yml index bf3815cbc..324a2deb1 100644 --- a/.github/workflows/jenkins-tests-PR.yml +++ b/.github/workflows/jenkins-tests-PR.yml @@ -17,6 +17,6 @@ jobs: - name: DSL tests uses: kiegroup/kie-ci/.ci/actions/dsl-tests@main with: - main-config-file-repo: kiegroup/kogito-pipelines + main-config-file-repo: apache/incubator-kie-kogito-pipelines main-config-file-path: .ci/jenkins/config/main.yaml - branch-config-file-repo: kiegroup/kogito-pipelines + branch-config-file-repo: apache/incubator-kie-kogito-pipelines From 6b591073f96d65587660a20c598b470ae374ba4c Mon Sep 17 00:00:00 2001 From: Davide Salerno Date: Wed, 27 Sep 2023 19:57:44 +0200 Subject: [PATCH 2/9] [KOGITO-9729] SonataFlow builder image is not preserving resources path (#1677) * [KOGITO-9729] SonataFlow builder image is not preserving resources path Signed-off-by: Davide Salerno * [KOGITO-9729] Added shell test Signed-off-by: Davide Salerno * Update modules/kogito-swf/common/scripts/added/build-app.sh Co-authored-by: Tristan Radisson * [KOGITO-9729] Stopping containers into the same shell test Signed-off-by: Davide Salerno --------- Signed-off-by: Davide Salerno Co-authored-by: Tristan Radisson --- .../common/scripts/added/build-app.sh | 2 +- tests/shell/kogito-swf-builder/RunTests.java | 34 ++++++- .../.mvn/jvm.config | 0 .../greet-with-inputschema/Dockerfile | 40 +++++++++ .../greet-with-inputschema/greet.sw.json | 89 +++++++++++++++++++ .../greet-with-inputschema/schemas/input.json | 16 ++++ .../resources/greet/.mvn/jvm.config | 1 + .../resources/{ => greet}/Dockerfile | 0 .../resources/{ => greet}/greet.sw.json | 0 9 files changed, 177 insertions(+), 5 deletions(-) rename tests/shell/kogito-swf-builder/resources/{ => greet-with-inputschema}/.mvn/jvm.config (100%) create mode 100644 tests/shell/kogito-swf-builder/resources/greet-with-inputschema/Dockerfile create mode 100644 tests/shell/kogito-swf-builder/resources/greet-with-inputschema/greet.sw.json create mode 100644 tests/shell/kogito-swf-builder/resources/greet-with-inputschema/schemas/input.json create mode 100644 tests/shell/kogito-swf-builder/resources/greet/.mvn/jvm.config rename tests/shell/kogito-swf-builder/resources/{ => greet}/Dockerfile (100%) rename tests/shell/kogito-swf-builder/resources/{ => greet}/greet.sw.json (100%) diff --git a/modules/kogito-swf/common/scripts/added/build-app.sh b/modules/kogito-swf/common/scripts/added/build-app.sh index fdc5fc24c..762c791e6 100755 --- a/modules/kogito-swf/common/scripts/added/build-app.sh +++ b/modules/kogito-swf/common/scripts/added/build-app.sh @@ -20,7 +20,7 @@ fi SUPPORTED_FILES=(".yaml" ".yml" ".json" ".properties" ".mvn/jvm.config") log_info "-> Copying files from ${resources_path}, if any..." if [ ! -z "${resources_path}" ]; then - find "${resources_path}" -regex '.*\.\(yaml\|yml\|json\|properties\)$' -exec cp -v {} src/main/resources/ \; + cd "${resources_path}" && find . -regex '.*\.\(yaml\|yml\|json\|properties\)$' | sed 's|^./||' | xargs cp -v --parents -t "${swf_home_dir}"/src/main/resources/ && cd - find "${resources_path}" -name 'jvm.config' -exec echo "--> found {}" \; -exec mkdir -p .mvn \; -exec cp -v {} .mvn/ \; else log_warning "-> Nothing to copy from ${resources_path}" diff --git a/tests/shell/kogito-swf-builder/RunTests.java b/tests/shell/kogito-swf-builder/RunTests.java index f2dee5a80..8c5705028 100644 --- a/tests/shell/kogito-swf-builder/RunTests.java +++ b/tests/shell/kogito-swf-builder/RunTests.java @@ -46,9 +46,9 @@ public class RunTests { private Slf4jLogConsumer logConsumer = new Slf4jLogConsumer(LOGGER); @Container - private GenericContainer builtImage = new GenericContainer( + private GenericContainer greetBuiltImage = new GenericContainer( new ImageFromDockerfile("dev.local/jbang-test/swf-test:" + Math.round(Math.random() * 1000000.00)) - .withDockerfile(Paths.get(getScriptDirPath(), "resources", "Dockerfile")) + .withDockerfile(Paths.get(getScriptDirPath(), "resources/greet", "Dockerfile")) .withBuildArg("BUILDER_IMAGE_TAG", getTestImage())) .withExposedPorts(8080) .waitingFor(Wait.forHttp("/jsongreet")) @@ -56,9 +56,9 @@ public class RunTests { @Test public void testBuiltContainerAnswerCorrectly() throws URISyntaxException, IOException, InterruptedException { - builtImage.start(); + greetBuiltImage.start(); HttpRequest request = HttpRequest.newBuilder() - .uri(new URI("http://" + builtImage.getHost() + ":" + builtImage.getFirstMappedPort() + "/jsongreet")) + .uri(new URI("http://" + greetBuiltImage.getHost() + ":" + greetBuiltImage.getFirstMappedPort() + "/jsongreet")) .header("Content-Type", "application/json") .header("Accept", "application/json") .timeout(Duration.ofSeconds(10)) @@ -67,6 +67,32 @@ public void testBuiltContainerAnswerCorrectly() throws URISyntaxException, IOExc .build(); HttpResponse response = HttpClient.newHttpClient().send(request, BodyHandlers.ofString()); assertEquals(201, response.statusCode()); + greetBuiltImage.stop(); + } + + @Container + private GenericContainer greetWithInputSchemaBuiltImage = new GenericContainer( + new ImageFromDockerfile("dev.local/jbang-test/swf-test:" + Math.round(Math.random() * 1000000.00)) + .withDockerfile(Paths.get(getScriptDirPath(), "resources/greet-with-inputschema", "Dockerfile")) + .withBuildArg("BUILDER_IMAGE_TAG", getTestImage())) + .withExposedPorts(8080) + .waitingFor(Wait.forHttp("/greeting")) + .withLogConsumer(logConsumer); + + @Test + public void testBuiltContainerWithInputSchemaAnswerCorrectly() throws URISyntaxException, IOException, InterruptedException { + greetWithInputSchemaBuiltImage.start(); + HttpRequest request = HttpRequest.newBuilder() + .uri(new URI("http://" + greetWithInputSchemaBuiltImage.getHost() + ":" + greetWithInputSchemaBuiltImage.getFirstMappedPort() + "/greeting")) + .header("Content-Type", "application/json") + .header("Accept", "application/json") + .timeout(Duration.ofSeconds(10)) + .POST(HttpRequest.BodyPublishers + .ofString("{\"name\": \"John\", \"language\": \"English\"}")) + .build(); + HttpResponse response = HttpClient.newHttpClient().send(request, BodyHandlers.ofString()); + assertEquals(201, response.statusCode()); + greetWithInputSchemaBuiltImage.stop(); } public static void main(String... args) throws Exception { diff --git a/tests/shell/kogito-swf-builder/resources/.mvn/jvm.config b/tests/shell/kogito-swf-builder/resources/greet-with-inputschema/.mvn/jvm.config similarity index 100% rename from tests/shell/kogito-swf-builder/resources/.mvn/jvm.config rename to tests/shell/kogito-swf-builder/resources/greet-with-inputschema/.mvn/jvm.config diff --git a/tests/shell/kogito-swf-builder/resources/greet-with-inputschema/Dockerfile b/tests/shell/kogito-swf-builder/resources/greet-with-inputschema/Dockerfile new file mode 100644 index 000000000..88e1fc8a7 --- /dev/null +++ b/tests/shell/kogito-swf-builder/resources/greet-with-inputschema/Dockerfile @@ -0,0 +1,40 @@ +ARG BUILDER_IMAGE_TAG="quay.io/kiegroup/kogito-swf-builder:2.0" + +FROM ${BUILDER_IMAGE_TAG} AS builder + +# Kogito user +USER 1001 + +ARG QUARKUS_PACKAGE_TYPE="jar" +ARG SCRIPT_DEBUG="true" +ARG MAVEN_DOWNLOAD_OUTPUT="true" +ARG MAVEN_OFFLINE_MODE="true" + +# Copy from build context to resources directory +COPY ./ ./resources/ + +# Build app with given resources +RUN "${KOGITO_HOME}"/launch/build-app.sh './resources' + +#============================= +# Runtime Run +#============================= +FROM registry.access.redhat.com/ubi8/openjdk-11-runtime:latest + +ARG QUARKUS_LAUNCH_DEVMODE=false + +ENV LANG='en_US.UTF-8' LANGUAGE='en_US:en' +# Default name is 'serverless-workflow-project' +ARG PROJECT_ARTIFACT_ID='serverless-workflow-project' + +# We make four distinct layers so if there are application changes the library layers can be re-used +COPY --from=builder --chown=185 /home/kogito/${PROJECT_ARTIFACT_ID}/target/quarkus-app/lib/ /deployments/lib/ +COPY --from=builder --chown=185 /home/kogito/${PROJECT_ARTIFACT_ID}/target/quarkus-app/*.jar /deployments/ +COPY --from=builder --chown=185 /home/kogito/${PROJECT_ARTIFACT_ID}/target/quarkus-app/app/ /deployments/app/ +COPY --from=builder --chown=185 /home/kogito/${PROJECT_ARTIFACT_ID}/target/quarkus-app/quarkus/ /deployments/quarkus/ + +EXPOSE 8080 +USER 185 +ENV AB_JOLOKIA_OFF="" +ENV JAVA_OPTS="-Dquarkus.http.host=0.0.0.0 -Dquarkus.http.port=8080 -Djava.util.logging.manager=org.jboss.logmanager.LogManager" +ENV JAVA_APP_JAR="/deployments/quarkus-run.jar" diff --git a/tests/shell/kogito-swf-builder/resources/greet-with-inputschema/greet.sw.json b/tests/shell/kogito-swf-builder/resources/greet-with-inputschema/greet.sw.json new file mode 100644 index 000000000..183e2101f --- /dev/null +++ b/tests/shell/kogito-swf-builder/resources/greet-with-inputschema/greet.sw.json @@ -0,0 +1,89 @@ +{ + "id": "greeting", + "description": "Greeting example on k8s!", + "version": "0.0.1", + "start": { + "stateName": "ChooseOnLanguage" + }, + "dataInputSchema": { + "schema": "schemas/input.json", + "failOnValidationErrors": true + }, + "specVersion": "0.8", + "expressionLang": "jq", + "states": [ + { + "name": "ChooseOnLanguage", + "type": "switch", + "defaultCondition": { + "transition": { + "nextState": "GreetInEnglish" + } + }, + "dataConditions": [ + { + "condition": "${ .language == \"English\" }", + "transition": { + "nextState": "GreetInEnglish" + } + }, + { + "condition": "${ .language == \"Spanish\" }", + "transition": { + "nextState": "GreetInSpanish" + } + } + ] + }, + { + "name": "GreetInEnglish", + "type": "inject", + "transition": { + "nextState": "GreetPerson" + }, + "data": { + "greeting": "Hello from JSON Workflow, " + } + }, + { + "name": "GreetInSpanish", + "type": "inject", + "transition": { + "nextState": "GreetPerson" + }, + "data": { + "greeting": "Saludos desde JSON Workflow, " + } + }, + { + "name": "GreetPerson", + "type": "operation", + "end": { + "terminate": true + }, + "actionMode": "sequential", + "actions": [ + { + "name": "greetAction", + "functionRef": { + "refName": "greetFunction", + "arguments": { + "message": ".greeting+.name" + }, + "invoke": "sync" + }, + "actionDataFilter": { + "useResults": true + } + } + ] + } + ], + "functions": [ + { + "name": "greetFunction", + "operation": "sysout", + "type": "custom" + } + ] +} \ No newline at end of file diff --git a/tests/shell/kogito-swf-builder/resources/greet-with-inputschema/schemas/input.json b/tests/shell/kogito-swf-builder/resources/greet-with-inputschema/schemas/input.json new file mode 100644 index 000000000..1874fd25b --- /dev/null +++ b/tests/shell/kogito-swf-builder/resources/greet-with-inputschema/schemas/input.json @@ -0,0 +1,16 @@ +{ + "$schema": "http://json-schema.org/draft-04/schema#", + "type": "object", + "properties": { + "language": { + "type": "string" + }, + "name": { + "type": "string" + } + }, + "required": [ + "language", + "name" + ] +} \ No newline at end of file diff --git a/tests/shell/kogito-swf-builder/resources/greet/.mvn/jvm.config b/tests/shell/kogito-swf-builder/resources/greet/.mvn/jvm.config new file mode 100644 index 000000000..df7809fac --- /dev/null +++ b/tests/shell/kogito-swf-builder/resources/greet/.mvn/jvm.config @@ -0,0 +1 @@ +-Xms1024m \ No newline at end of file diff --git a/tests/shell/kogito-swf-builder/resources/Dockerfile b/tests/shell/kogito-swf-builder/resources/greet/Dockerfile similarity index 100% rename from tests/shell/kogito-swf-builder/resources/Dockerfile rename to tests/shell/kogito-swf-builder/resources/greet/Dockerfile diff --git a/tests/shell/kogito-swf-builder/resources/greet.sw.json b/tests/shell/kogito-swf-builder/resources/greet/greet.sw.json similarity index 100% rename from tests/shell/kogito-swf-builder/resources/greet.sw.json rename to tests/shell/kogito-swf-builder/resources/greet/greet.sw.json From 5584f11e28ace9ba6e9e0169347b3184766e6fb8 Mon Sep 17 00:00:00 2001 From: Ricardo Zanini <1538000+ricardozanini@users.noreply.github.com> Date: Fri, 1 Dec 2023 11:54:09 -0300 Subject: [PATCH 3/9] [KOGITO-9729] - (fix) Preserve directory structure while copying files in builder image (#1711) Signed-off-by: Ricardo Zanini --- .../common/scripts/added/build-app.sh | 14 ++++++---- .../bats/kogito-swf-builder-build-app.bats | 27 +++++++++++++++++++ .../greet-with-inputschema/Dockerfile | 2 +- .../resources/greet/Dockerfile | 2 +- 4 files changed, 38 insertions(+), 7 deletions(-) create mode 100644 modules/kogito-swf/common/scripts/tests/bats/kogito-swf-builder-build-app.bats diff --git a/modules/kogito-swf/common/scripts/added/build-app.sh b/modules/kogito-swf/common/scripts/added/build-app.sh index 762c791e6..2f661aed4 100755 --- a/modules/kogito-swf/common/scripts/added/build-app.sh +++ b/modules/kogito-swf/common/scripts/added/build-app.sh @@ -3,7 +3,7 @@ set -e script_dir_path="$(cd $(dirname "${BASH_SOURCE[0]}") && pwd)" resources_path="$1" -if [ ! -z "${resources_path}" ]; then +if [ -n "${resources_path}" ]; then resources_path="$(realpath "${resources_path}")" fi @@ -13,15 +13,17 @@ if [ "${SCRIPT_DEBUG}" = "true" ] ; then set -x export MAVEN_ARGS_APPEND="${MAVEN_ARGS_APPEND} -X --batch-mode" log_info "Script debugging is enabled, allowing bash commands and their arguments to be printed as they are executed" + log_info "Resources path is ${resources_path}" printenv fi # Copy resources if exists -SUPPORTED_FILES=(".yaml" ".yml" ".json" ".properties" ".mvn/jvm.config") log_info "-> Copying files from ${resources_path}, if any..." -if [ ! -z "${resources_path}" ]; then - cd "${resources_path}" && find . -regex '.*\.\(yaml\|yml\|json\|properties\)$' | sed 's|^./||' | xargs cp -v --parents -t "${swf_home_dir}"/src/main/resources/ && cd - - find "${resources_path}" -name 'jvm.config' -exec echo "--> found {}" \; -exec mkdir -p .mvn \; -exec cp -v {} .mvn/ \; +if [ -n "${resources_path}" ]; then + destination="${KOGITO_HOME}/serverless-workflow-project/src/main/resources/" + log_info "-> Destination folder is ${destination}" + cp -vR ${resources_path}/* ${destination} + find "${resources_path}" -name 'jvm.config' -exec echo "--> found {}" \; -exec mkdir -p ${destination}/.mvn \; -exec cp -v {} ${destination}/.mvn/ \; else log_warning "-> Nothing to copy from ${resources_path}" fi @@ -33,6 +35,8 @@ if [ ! -z "${QUARKUS_EXTENSIONS}" ]; then ${script_dir_path}/add-extension.sh "${QUARKUS_EXTENSIONS}" "true" fi +cd ${KOGITO_HOME}/serverless-workflow-project + "${MAVEN_HOME}"/bin/mvn -B ${MAVEN_ARGS_APPEND} \ -nsu \ -s "${MAVEN_SETTINGS_PATH}" \ diff --git a/modules/kogito-swf/common/scripts/tests/bats/kogito-swf-builder-build-app.bats b/modules/kogito-swf/common/scripts/tests/bats/kogito-swf-builder-build-app.bats new file mode 100644 index 000000000..d0993822d --- /dev/null +++ b/modules/kogito-swf/common/scripts/tests/bats/kogito-swf-builder-build-app.bats @@ -0,0 +1,27 @@ +#!/usr/bin/env bats + +setup() { + export KOGITO_HOME=/tmp/kogito + export HOME="${KOGITO_HOME}" + mkdir -p "${KOGITO_HOME}"/launch + mkdir -p "${KOGITO_HOME}"/serverless-workflow-project/src/main/resources/ + cp $BATS_TEST_DIRNAME/../../../../../kogito-logging/added/logging.sh "${KOGITO_HOME}"/launch/ + cp $BATS_TEST_DIRNAME/../../added/jvm-settings.sh "${KOGITO_HOME}"/launch/ + cp $BATS_TEST_DIRNAME/../../added/build-app.sh "${KOGITO_HOME}"/launch/ +} + +teardown() { + rm -rf "${KOGITO_HOME}" + rm -rf /tmp/resources +} + +@test "verify copy resources is working" { + TEMPD=$(mktemp -d) + cp -r $BATS_TEST_DIRNAME/../../../../../../tests/shell/kogito-swf-builder/resources/greet-with-inputschema/* ${TEMPD} + + # We don't care about the errors to try to execute and build the program, just the copy matters + source ${KOGITO_HOME}/launch/build-app.sh ${TEMPD} || true + + [[ -f "${KOGITO_HOME}"/serverless-workflow-project/src/main/resources/greet.sw.json ]] + [[ -f "${KOGITO_HOME}"/serverless-workflow-project/src/main/resources/schemas/input.json ]] +} diff --git a/tests/shell/kogito-swf-builder/resources/greet-with-inputschema/Dockerfile b/tests/shell/kogito-swf-builder/resources/greet-with-inputschema/Dockerfile index 88e1fc8a7..3581d31c5 100644 --- a/tests/shell/kogito-swf-builder/resources/greet-with-inputschema/Dockerfile +++ b/tests/shell/kogito-swf-builder/resources/greet-with-inputschema/Dockerfile @@ -11,7 +11,7 @@ ARG MAVEN_DOWNLOAD_OUTPUT="true" ARG MAVEN_OFFLINE_MODE="true" # Copy from build context to resources directory -COPY ./ ./resources/ +COPY --chown=1001 . ./resources # Build app with given resources RUN "${KOGITO_HOME}"/launch/build-app.sh './resources' diff --git a/tests/shell/kogito-swf-builder/resources/greet/Dockerfile b/tests/shell/kogito-swf-builder/resources/greet/Dockerfile index a8e4bdd1f..3581d31c5 100644 --- a/tests/shell/kogito-swf-builder/resources/greet/Dockerfile +++ b/tests/shell/kogito-swf-builder/resources/greet/Dockerfile @@ -11,7 +11,7 @@ ARG MAVEN_DOWNLOAD_OUTPUT="true" ARG MAVEN_OFFLINE_MODE="true" # Copy from build context to resources directory -COPY * ./resources/ +COPY --chown=1001 . ./resources # Build app with given resources RUN "${KOGITO_HOME}"/launch/build-app.sh './resources' From 38037be7a76275a1dab2d3b6a8abc626464dbf1c Mon Sep 17 00:00:00 2001 From: Ricardo Zanini <1538000+ricardozanini@users.noreply.github.com> Date: Fri, 8 Dec 2023 10:21:52 -0300 Subject: [PATCH 4/9] kie-issues#632: Fix pipelines for Apache Incubator migration (#1709) * Update kogito-images job to follow apache config Signed-off-by: Ricardo Zanini * generate also build-image job * use plain ubuntu in Jenkinsfile * refactor Jenkinsfile to a dummy trigger * pass PR source repository name * use open ports * hold localRegistryUrl after startup * adjust repository URLs after transfer * adjust KOGITO_APPS_REPO_NAME * prevent repeated checkout * remove jboss repository references * fix settings.xml * invoke bash explicitly to process bash directives * set git config * set global config * replace mailing lists * collect logs from all containers * try log everything * add initial sleep into startup command in feature files * use skopeo installed in image * Tidying the PR up #1 * Fix problem with builder script copying files for swf-builder-image Signed-off-by: Ricardo Zanini * fix cleanup in build-image * increase pipeline timeouts * solve deferred wipeout issues * increase timeout * skip docker cleanup * [KOGITO-9729] - (fix) Preserve directory structure while copying files in builder image Signed-off-by: Ricardo Zanini * handle GitHub push credentials --------- Signed-off-by: Ricardo Zanini Co-authored-by: radtriste Co-authored-by: jstastny-cz --- .ci/jenkins/Jenkinsfile | 112 +++------- .ci/jenkins/Jenkinsfile.build-and-test | 130 ++++++++++++ .ci/jenkins/Jenkinsfile.build-image | 76 ++++--- .ci/jenkins/Jenkinsfile.deploy | 192 +++++++++--------- .ci/jenkins/Jenkinsfile.promote | 23 ++- .ci/jenkins/Jenkinsfile.setup-branch | 14 +- .ci/jenkins/dsl/jobs.groovy | 93 ++++++--- .github/workflows/jenkins-tests-PR.yml | 2 +- .github/workflows/pr-backporting.yml | 4 +- Makefile | 10 +- README.md | 60 +++--- kogito-base-builder-image.yaml | 2 +- kogito-data-index-ephemeral-image.yaml | 2 +- kogito-data-index-infinispan-image.yaml | 2 +- kogito-data-index-mongodb-image.yaml | 2 +- kogito-data-index-oracle-image.yaml | 2 +- kogito-data-index-postgresql-image.yaml | 2 +- kogito-explainability-image.yaml | 2 +- kogito-jit-runner-image.yaml | 2 +- kogito-jobs-service-allinone-image.yaml | 2 +- kogito-jobs-service-ephemeral-image.yaml | 2 +- kogito-jobs-service-infinispan-image.yaml | 2 +- kogito-jobs-service-mongodb-image.yaml | 2 +- kogito-jobs-service-postgresql-image.yaml | 2 +- kogito-management-console-image.yaml | 2 +- kogito-runtime-jvm-image.yaml | 2 +- kogito-runtime-native-image.yaml | 2 +- kogito-s2i-builder-image.yaml | 2 +- kogito-swf-builder-image.yaml | 2 +- kogito-swf-devmode-image.yaml | 2 +- kogito-task-console-image.yaml | 2 +- kogito-trusty-infinispan-image.yaml | 2 +- kogito-trusty-postgresql-image.yaml | 2 +- kogito-trusty-redis-image.yaml | 2 +- kogito-trusty-ui-image.yaml | 2 +- logic-data-index-ephemeral-rhel8-image.yaml | 2 +- logic-swf-builder-rhel8-image.yaml | 2 +- logic-swf-devmode-rhel8-image.yaml | 2 +- .../3.8.x-rpm/added/configure-maven.sh | 4 +- .../kogito-maven/3.8.x-rpm/maven/settings.xml | 12 +- modules/kogito-maven/3.8.x-rpm/module.yaml | 6 +- .../3.8.x/added/configure-maven.sh | 4 +- modules/kogito-maven/3.8.x/maven/settings.xml | 12 +- modules/kogito-maven/3.8.x/module.yaml | 6 +- .../common/scripts/added/build-app.sh | 0 scripts/README.md | 4 +- scripts/build-kogito-apps-components.sh | 16 +- scripts/common.py | 38 ++-- scripts/list-images.py | 2 +- scripts/manage-kogito-version.py | 2 +- scripts/push-local-registry.sh | 2 +- scripts/push-staging.py | 2 +- scripts/retrieve_version.py | 4 +- scripts/setup-maven.sh | 2 +- scripts/update-repository.py | 16 +- tests/features/common-build-runtime.feature | 2 +- .../features/common-custom-truststore.feature | 2 +- .../features/common-dynamic-resources.feature | 19 +- .../kogito-data-index-ephemeral.feature | 2 +- .../kogito-data-index-infinispan.feature | 2 +- .../kogito-data-index-mongodb.feature | 2 +- .../kogito-data-index-oracle.feature | 2 +- .../kogito-data-index-postgresql.feature | 2 +- .../kogito-jobs-service-all-in-one.feature | 2 +- .../kogito-jobs-service-ephemeral.feature | 2 +- .../kogito-jobs-service-infinispan.feature | 2 +- .../kogito-jobs-service-mongodb.feature | 2 +- .../kogito-jobs-service-postgresql.feature | 2 +- .../kogito-common-builder-jvm.feature | 24 +-- tests/features/kogito-explainability.feature | 2 +- tests/features/kogito-jit-runner.feature | 2 +- .../kogito-management-console.feature | 2 +- tests/features/kogito-runtime-jvm.feature | 2 +- tests/features/kogito-runtime-native.feature | 2 +- .../kogito-s2i-builder-native.feature | 10 +- tests/features/kogito-s2i-builder.feature | 6 +- tests/features/kogito-task-console.feature | 2 +- .../logic-data-index-ephemeral.feature | 2 +- .../logic-swf-builder.feature | 2 +- .../logic-swf-devmode.feature | 2 +- .../trusty/kogito-trusty-common.feature | 7 +- .../trusty/kogito-trusty-infinispan.feature | 2 +- .../trusty/kogito-trusty-postgresql.feature | 2 +- .../trusty/kogito-trusty-redis.feature | 2 +- .../features/trusty/kogito-trusty-ui.feature | 2 +- tests/test-apps/clone-repo.sh | 25 ++- 86 files changed, 597 insertions(+), 446 deletions(-) create mode 100644 .ci/jenkins/Jenkinsfile.build-and-test mode change 100755 => 100644 modules/kogito-swf/common/scripts/added/build-app.sh diff --git a/.ci/jenkins/Jenkinsfile b/.ci/jenkins/Jenkinsfile index 693fa00c2..3454a8403 100644 --- a/.ci/jenkins/Jenkinsfile +++ b/.ci/jenkins/Jenkinsfile @@ -5,111 +5,53 @@ pipeline { label 'ubuntu' } options { - timeout(time: 120, unit: 'MINUTES') + timeout(time: 240, unit: 'MINUTES') + disableConcurrentBuilds(abortPrevious: true) + skipDefaultCheckout() } stages { - stage('Initialization') { + stage("Invoke build-and-test") { steps { script { - clean() - sh 'printenv' - - githubscm.checkoutIfExists(getRepoName(), getChangeAuthor(), getChangeBranch(), 'apache', getChangeTarget(), true) - } - } - } - stage('Validate CeKit Image and Modules descriptors') { - steps { - script { - sh ''' - curl -Ls https://github.com/kiegroup/kie-cloud-tools/releases/download/v1.3.6/cekit-image-validator-runner.tgz --output cekit-image-validator-runner.tgz - tar -xzvf cekit-image-validator-runner.tgz - chmod +x cekit-image-validator-runner - ''' - sh './cekit-image-validator-runner modules/' - getImages().each { image -> sh "./cekit-image-validator-runner ${image}-image.yaml" } - } - } - } - stage('Build & Test Images') { - steps { - script { - parallelStages = [:] - for(String image : getImages()){ - parallelStages[image] = createBuildAndTestStageClosure(image) + List buildParams = [] + buildParams.add(string(name: 'DISPLAY_NAME', value: "PR #${CHANGE_ID}: ${CHANGE_URL}")) + buildParams.add(string(name: 'CHANGE_ID', value: CHANGE_ID)) + buildParams.add(string(name: 'CHANGE_URL', value: CHANGE_URL)) + buildParams.add(string(name: 'SOURCE_REPOSITORY', value: getChangeRepository())) + buildParams.add(string(name: 'SOURCE_AUTHOR', value: getChangeAuthor())) + buildParams.add(string(name: 'SOURCE_BRANCH', value: getChangeBranch())) + buildParams.add(string(name: 'TARGET_BRANCH', value: getChangeTarget())) + buildParams.add(string(name: 'BUILD_KOGITO_APPS_REF', value: getChangeTarget())) + // Keep executing so we can cancel all if needed + def job = build(job: "../kogito-images.build-and-test", wait: true, parameters: buildParams, propagate: false) + if (job.result != 'SUCCESS') { + if (job.result == 'UNSTABLE') { + unstable("Tests on images seems to have failed: ${job.absoluteUrl}") + } else { + error("Error building images. Please check the logs of the job: ${job.absoluteUrl}") + } } - parallel parallelStages - } - } - } - } - post { - always { - script { - clean() - } - } - unsuccessful { - script { - pullrequest.postComment(util.getMarkdownTestSummary('PR', "${BUILD_URL}", 'GITHUB')) - } - } - } -} - -void clean() { - util.cleanNode() -} - -Closure createBuildAndTestStageClosure(String image) { - return { - stage("Build&Test ${image}") { - List buildParams = [] - buildParams.add(string(name: "DISPLAY_NAME", value: "PR #${ghprbPullId} - ${image}: ${ghprbPullLink}")) - buildParams.add(string(name: 'BUILD_IMAGE_NAME', value: image)) - buildParams.add(string(name: 'SOURCE_AUTHOR', value: getChangeAuthor())) - buildParams.add(string(name: 'SOURCE_BRANCH', value: getChangeBranch())) - buildParams.add(string(name: 'TARGET_BRANCH', value: getChangeTarget())) - buildParams.add(string(name: 'BUILD_KOGITO_APPS_REF', value: getChangeTarget())) - - githubscm.prepareCommitStatusInformationForPullRequest(getRepoName(), getChangeAuthor(), getChangeBranch(), 'apache', getGitAuthorCredentialsId()) - githubscm.updateGithubCommitStatus(image, 'PENDING', 'Queued', getRepoName()) - - // Keep executing so we can cancel all if needed - def job = build(job: "${getRepoName()}.build-image", wait: true, parameters: buildParams, propagate: false) - if (job.result != 'SUCCESS') { - if (job.result == 'UNSTABLE') { - unstable("Tests on ${image} seems to have failed") - } else { - error("Error building ${image}. Please check the logs of the job: ${job.absoluteUrl}") } } } } } -String[] getImages() { - if (env.IMAGES_LIST) { - return env.IMAGES_LIST.split(',') - } - return sh(returnStdout: true, script: "make list | tr '\\n' ','").trim().split(',') +String getChangeAuthor() { + return pullrequest.getAuthorAndRepoForPr().split('/')[0] } -String getChangeAuthor() { - return env.ghprbAuthorRepoGitUrl ? util.getGroup(env.ghprbAuthorRepoGitUrl) : (env.ghprbPullAuthorLogin ?: CHANGE_AUTHOR) +String getChangeRepository() { + return pullrequest.getAuthorAndRepoForPr().split('/')[1] } String getChangeBranch() { - return env.ghprbSourceBranch ?: CHANGE_BRANCH + return CHANGE_BRANCH } String getChangeTarget() { - return env.ghprbTargetBranch ?: CHANGE_TARGET -} - -String getRepoName() { - return env.REPO_NAME + return CHANGE_TARGET } String getGitAuthorCredentialsId() { diff --git a/.ci/jenkins/Jenkinsfile.build-and-test b/.ci/jenkins/Jenkinsfile.build-and-test new file mode 100644 index 000000000..4e99f9e14 --- /dev/null +++ b/.ci/jenkins/Jenkinsfile.build-and-test @@ -0,0 +1,130 @@ +@Library('jenkins-pipeline-shared-libraries')_ + +pipeline { + agent { + docker { + image env.AGENT_DOCKER_BUILDER_IMAGE + args env.AGENT_DOCKER_BUILDER_ARGS + } + } + options { + timeout(time: 240, unit: 'MINUTES') + skipDefaultCheckout() + } + stages { + stage('Initialization') { + steps { + script { + sh 'printenv' + + dir(getRepoName()) { + // TODO Test pupose + deleteDir() + githubscm.checkoutIfExists(getRepoName(), getChangeAuthor(), getChangeBranch(), 'apache', getChangeTarget(), true, credentials = [token: getGitAuthorTokenCredentialsId(), usernamePassword: getGitAuthorCredentialsId()]) + } + } + } + } + stage('Validate CeKit Image and Modules descriptors') { + steps { + script { + dir(getRepoName()) { + sh ''' + curl -Ls https://github.com/kiegroup/kie-cloud-tools/releases/download/v1.3.6/cekit-image-validator-runner.tgz --output cekit-image-validator-runner.tgz + tar -xzvf cekit-image-validator-runner.tgz + chmod +x cekit-image-validator-runner + ''' + sh './cekit-image-validator-runner modules/' + getImages().each { image -> sh "./cekit-image-validator-runner ${image}-image.yaml" } + } + } + } + } + stage('Build & Test Images') { + steps { + script { + dir(getRepoName()) { + githubscm.prepareCommitStatusInformationForPullRequest(getRepoName(), getChangeAuthor(), getChangeBranch(), 'apache', getGitAuthorCredentialsId()) + parallelStages = [:] + for(String image : getImages()){ + parallelStages[image] = createBuildAndTestStageClosure(image) + } + parallel parallelStages + } + } + } + } + } + post { + unsuccessful { + script { + pullrequest.postComment(util.getMarkdownTestSummary('PR', '', "${BUILD_URL}", 'GITHUB')) + } + } + } +} + +Closure createBuildAndTestStageClosure(String image) { + return { + stage("Build&Test ${image}") { + List buildParams = [] + buildParams.add(string(name: "DISPLAY_NAME", value: "PR #${getChangeId()} - ${image}: ${getChangeUrl()}")) + buildParams.add(string(name: 'BUILD_IMAGE_NAME', value: image)) + buildParams.add(string(name: 'SOURCE_AUTHOR', value: getChangeAuthor())) + buildParams.add(string(name: 'SOURCE_BRANCH', value: getChangeBranch())) + buildParams.add(string(name: 'TARGET_BRANCH', value: getChangeTarget())) + buildParams.add(string(name: 'BUILD_KOGITO_APPS_REF', value: getChangeTarget())) + + githubscm.updateGithubCommitStatus(image, 'PENDING', 'Queued', getRepoName()) + + // Keep executing so we can cancel all if needed + def job = build(job: 'kogito-images.build-image', wait: true, parameters: buildParams, propagate: false) + if (job.result != 'SUCCESS') { + if (job.result == 'UNSTABLE') { + unstable("Tests on ${image} seems to have failed") + } else { + error("Error building ${image}. Please check the logs of the job: ${job.absoluteUrl}") + } + } + } + } +} + +String[] getImages() { + if (env.IMAGES_LIST) { + return env.IMAGES_LIST.split(',') + } + return sh(returnStdout: true, script: "make list | tr '\\n' ','").trim().split(',') +} + +String getChangeAuthor() { + return SOURCE_AUTHOR +} + +String getChangeBranch() { + return SOURCE_BRANCH +} + +String getChangeTarget() { + return TARGET_BRANCH +} + +String getChangeId() { + return CHANGE_ID +} + +String getChangeUrl() { + return CHANGE_URL +} + +String getRepoName() { + return env.REPO_NAME +} + +String getGitAuthorCredentialsId() { + return env.GIT_AUTHOR_CREDS_ID +} + +String getGitAuthorTokenCredentialsId() { + return env.GIT_AUTHOR_TOKEN_CREDS_ID +} diff --git a/.ci/jenkins/Jenkinsfile.build-image b/.ci/jenkins/Jenkinsfile.build-image index f13a64043..5436d77d0 100644 --- a/.ci/jenkins/Jenkinsfile.build-image +++ b/.ci/jenkins/Jenkinsfile.build-image @@ -7,10 +7,12 @@ pipeline { docker { image env.AGENT_DOCKER_BUILDER_IMAGE args env.AGENT_DOCKER_BUILDER_ARGS + alwaysPull true } } options { - timeout(time: 120, unit: 'MINUTES') + timeout(time: 150, unit: 'MINUTES') + skipDefaultCheckout() } environment { // Linked to node label @@ -18,8 +20,6 @@ pipeline { CONTAINER_ENGINE = 'docker' CONTAINER_ENGINE_TLS_OPTIONS = '' - OPENSHIFT_API = credentials('OPENSHIFT_API') - OPENSHIFT_REGISTRY = credentials('OPENSHIFT_REGISTRY') OPENSHIFT_CREDS_KEY = 'OPENSHIFT_CREDS' IMAGE_BUILD_PLATFORMS = 'linux/amd64,linux/arm64' @@ -28,8 +28,6 @@ pipeline { stage('Initialization') { steps { script { - clean() - sh 'printenv' assert getBuildImageName() : 'Please provide `BUILD_IMAGE_NAME` parameter' @@ -44,12 +42,13 @@ pipeline { checkout(githubscm.resolveRepository(getRepoName(), getSourceAuthor(), getSourceBranch(), false, getGitAuthorCredentialsId())) githubscm.prepareCommitStatusInformation(getRepoName(), getSourceAuthor(), getSourceBranch(), getGitAuthorCredentialsId()) } + githubscm.setUserConfig('robot', 'kie.apache.org', true) updateGithubCommitStatus('PENDING', 'Started') // Login to final registry if deploy is needed if (shouldDeployImage()) { if (isDeployImageInOpenshiftRegistry()) { - cloud.loginOpenShift(env.OPENSHIFT_API, env.OPENSHIFT_CREDS_KEY) + cloud.loginOpenShift(getOpenShiftAPI(), env.OPENSHIFT_CREDS_KEY) cloud.loginOpenshiftRegistry(env.CONTAINER_ENGINE, env.CONTAINER_ENGINE_TLS_OPTIONS ?: '') } else if (getDeployImageRegistryCredentials()) { cloud.loginContainerRegistry(getDeployImageRegistry(), getDeployImageRegistryCredentials(), env.CONTAINER_ENGINE, env.CONTAINER_ENGINE_TLS_OPTIONS ?: '') @@ -67,12 +66,12 @@ pipeline { env.MAVEN_MIRROR_URL = env.MAVEN_MIRROR_REPOSITORY // Ignore self-signed certificates if MAVEN_MIRROR_URL is defined - runPythonCommand("python3 scripts/update-repository.py --build-maven-mirror-url ${MAVEN_MIRROR_URL} --ignore-self-signed-cert") + runPythonCommand("python scripts/update-repository.py --build-maven-mirror-url ${MAVEN_MIRROR_URL} --ignore-self-signed-cert") } if (getMavenArtifactRepository()) { echo "Setup Repository url to '${getMavenArtifactRepository()}'" - runPythonCommand("python3 scripts/update-repository.py --repo-url ${getMavenArtifactRepository()}") + runPythonCommand("python scripts/update-repository.py --repo-url ${getMavenArtifactRepository()}") } } } @@ -89,7 +88,7 @@ pipeline { // echo "[WARN] Artifacts repository defined in env will override the quarkus platform URL in tests. Make sure the platform artifacts are available on that artifacts repository (you can use a maven group)" // } // // Setup quarkus platform repo configuration - // runPythonCommand("python3 scripts/update-repository.py --repo-url ${getQuarkusPlatformURL()} --ignore-self-signed-cert --quarkus-platform-version ${quarkusPlatformVersion}") + // runPythonCommand("python scripts/update-repository.py --repo-url ${getQuarkusPlatformURL()} --ignore-self-signed-cert --quarkus-platform-version ${quarkusPlatformVersion}") // } // } // } @@ -99,8 +98,9 @@ pipeline { script { updateGithubCommitStatus('PENDING', 'Build in progress') - String localRegistry = cloud.startLocalRegistry() - cloud.prepareForDockerMultiplatformBuild([localRegistry],[cloud.getDockerIOMirrorRegistryConfig()], false) + int freePort = cloud.findFreePort() + env.localRegistryUrl = cloud.startLocalRegistry(freePort) + cloud.prepareForDockerMultiplatformBuild([env.localRegistryUrl],[cloud.getDockerIOMirrorRegistryConfig()], false) // Generate the Dockerfile runPythonCommand("make build-image ${getMakeBuildImageArgs()} image_name=${getBuildImageName()} ignore_test=true ignore_tag=true build_options='--dry-run'") @@ -108,7 +108,7 @@ pipeline { // Build multiplatform from generated Dockerfile String squashMessage = "${getBuildImageName()}:${getImageVersion()} squashed" dir('target/image') { - cloud.dockerBuildMultiPlatformImages(getBuiltImageTag(), getImageBuildPlatforms(), shouldDeployImage(), squashMessage) + cloud.dockerBuildMultiPlatformImages(getBuiltImageTag(), getImageBuildPlatforms(), shouldDeployImage(), squashMessage, false, true) } } } @@ -119,8 +119,6 @@ pipeline { } steps { script { - cloud.installSkopeo() - // Make public if quay registry if (getDeployImageRegistry() == QUAY_REGISTRY) { String namespace = getDeployImageNamespace() @@ -153,7 +151,7 @@ pipeline { } steps { script { - updateTestsCommand = 'python3 scripts/update-repository.py --tests-only' + updateTestsCommand = 'python scripts/update-repository.py --tests-only' updateTestsCommand += getMavenArtifactRepository() ? " --repo-url ${getMavenArtifactRepository()}" : '' updateTestsCommand += getTestsKogitoExamplesRef() ? " --examples-ref ${getTestsKogitoExamplesRef()}" : '' updateTestsCommand += getTestsKogitoExamplesURI() ? " --examples-uri ${getTestsKogitoExamplesURI()}" : '' @@ -189,7 +187,7 @@ pipeline { unstable "Testing error(s) for image ${getBuildImageName()}" } finally { junit testResults: 'target/**/*.xml', allowEmptyResults: true - archiveArtifacts artifacts: 'target/**/*.xml', allowEmptyArchive: true + archiveArtifacts artifacts: 'target/**/*.xml, **/*.txt, **/*.log', allowEmptyArchive: true } } } @@ -199,22 +197,22 @@ pipeline { always { script { updateGithubCommitStatusFromBuildResult() - - clean() + collectContainerLogs() + archiveArtifacts artifacts: '**/*-build.log, **/*.log', allowEmptyArchive: true + } + } + cleanup { + script { + cleanWs() } } } } -void clean() { - util.cleanNode(env.CONTAINER_ENGINE) - - cloud.cleanDockerMultiplatformBuild() - cloud.cleanLocalRegistry() - cloud.cleanSkopeo() - - // Clean Cekit cache, in case we reuse an old node - sh "rm -rf \$HOME/.cekit/cache" +void collectContainerLogs() { + sh '''#!/bin/bash + for container in $(docker container ls --format "{{.Names}}"); do echo "[$container:START]"; docker logs $container; echo "[$container:END]"; done &> containers.log + ''' } String getMakeBuildImageArgs() { @@ -240,7 +238,7 @@ String getBuiltImageTag(String imageTag = '') { if (shouldDeployImage()) { return "${getDeployImageRegistry()}/${getDeployImageNamespace()}/${getFinalImageName()}:${imageTag ?: getDeployImageTag()}" } else { - return "localhost:5000/${getBuildImageName()}:${githubscm.getCommitHash()}" + return "${env.localRegistryUrl}/${getBuildImageName()}:${githubscm.getCommitHash()}" } } @@ -261,7 +259,7 @@ String getDeployImageRegistryCredentials() { } String getDeployImageRegistry() { - return isDeployImageInOpenshiftRegistry() ? env.OPENSHIFT_REGISTRY : params.DEPLOY_IMAGE_REGISTRY + return isDeployImageInOpenshiftRegistry() ? getOpenShiftRegistry() : params.DEPLOY_IMAGE_REGISTRY } String getDeployImageNamespace() { @@ -292,6 +290,22 @@ boolean isDeployLatestTag() { // utils //////////////////////////////////////////////////////////////////////// +String getOpenShiftRegistry() { + String registry = '' + withCredentials([string(credentialsId: 'OPENSHIFT_REGISTRY', variable: 'OPENSHIFT_REGISTRY')]) { + registry = env.OPENSHIFT_REGISTRY + } + return registry +} + +String getOpenShiftAPI() { + String openShiftAPI = '' + withCredentials([string(credentialsId: 'OPENSHIFT_API', variable: 'OPENSHIFT_API')]) { + openShiftAPI = env.OPENSHIFT_API + } + return openShiftAPI +} + String getRepoName() { return env.REPO_NAME } @@ -317,11 +331,11 @@ String getTargetBranch() { } String getGitAuthorCredentialsId() { - return env.AUTHOR_CREDS_ID + return env.GIT_AUTHOR_CREDS_ID } String getGitAuthorTokenCredentialsId() { - return env.AUTHOR_TOKEN_CREDS_ID + return env.GIT_AUTHOR_TOKEN_CREDS_ID } boolean shouldDeployImage() { diff --git a/.ci/jenkins/Jenkinsfile.deploy b/.ci/jenkins/Jenkinsfile.deploy index 3faa0948b..a07f52047 100644 --- a/.ci/jenkins/Jenkinsfile.deploy +++ b/.ci/jenkins/Jenkinsfile.deploy @@ -4,9 +4,9 @@ deployProperties = [:] changesDone = false -BUILT_IMAGES = [] -BUILD_FAILED_IMAGES = [] -TEST_FAILED_IMAGES = [] +BUILT_IMAGES = Collections.synchronizedList([]) +BUILD_FAILED_IMAGES = Collections.synchronizedList([]) +TEST_FAILED_IMAGES = Collections.synchronizedList([]) pipeline { agent { @@ -17,24 +17,23 @@ pipeline { } options { - timeout(time: 120, unit: 'MINUTES') + timeout(time: 240, unit: 'MINUTES') + skipDefaultCheckout() } environment { KOGITO_CI_EMAIL_TO = credentials("${JENKINS_EMAIL_CREDS_ID}") - - OPENSHIFT_REGISTRY = credentials('OPENSHIFT_REGISTRY') } stages { stage('Initialization') { steps { script { - clean() - currentBuild.displayName = params.DISPLAY_NAME ?: currentBuild.displayName - checkoutRepo() + dir(getRepoName()) { + checkoutRepo() + } if (isRelease()) { // Verify version is set and if on right release branch @@ -62,10 +61,12 @@ pipeline { } steps { script { - if (githubscm.isBranchExist('origin',getPRBranch())) { - githubscm.removeRemoteBranch('origin', getPRBranch()) + dir(getRepoName()) { + if (githubscm.isBranchExist('origin', getPRBranch())) { + githubscm.removeRemoteBranch('origin', getPRBranch(), getGitAuthorPushCredsId()) + } + githubscm.createBranch(getPRBranch()) } - githubscm.createBranch(getPRBranch()) } } } @@ -76,12 +77,14 @@ pipeline { } steps { script { - if (getQuarkusPlatformVersion()) { - runPythonCommand("python3 scripts/update-repository.py --quarkus-platform-version ${getQuarkusPlatformVersion()}") + dir(getRepoName()) { + if (getQuarkusPlatformVersion()) { + sh "python scripts/update-repository.py --quarkus-platform-version ${getQuarkusPlatformVersion()}" - commitAndPushChanges("Update Quarkus Platform version to ${getQuarkusPlatformVersion()}") - } else { - echo 'No new quarkus version given for the release. Statu quo ...' + commitAndPushChanges("Update Quarkus Platform version to ${getQuarkusPlatformVersion()}") + } else { + echo 'No new quarkus version given for the release. Statu quo ...' + } } } } @@ -93,16 +96,18 @@ pipeline { } steps { script { - versionCmd = "python3 scripts/manage-kogito-version.py --bump-to ${getProjectVersion()} --confirm" - if (getBuildBranch() != 'main') { - versionCmd += " --examples-ref ${!isRelease() ? 'nightly-' : ''}${getBuildBranch()}" - } - if (getKogitoArtifactsVersion()) { - versionCmd += " --artifacts-version ${getKogitoArtifactsVersion()}" - } - runPythonCommand(versionCmd) + dir(getRepoName()) { + versionCmd = "python scripts/manage-kogito-version.py --bump-to ${getProjectVersion()} --confirm" + if (getBuildBranch() != 'main') { + versionCmd += " --examples-ref ${!isRelease() ? 'nightly-' : ''}${getBuildBranch()}" + } + if (getKogitoArtifactsVersion()) { + versionCmd += " --artifacts-version ${getKogitoArtifactsVersion()}" + } + sh versionCmd - commitAndPushChanges("Update project version to ${getProjectVersion()}") + commitAndPushChanges("Update project version to ${getProjectVersion()}") + } } } } @@ -110,18 +115,15 @@ pipeline { stage('Validate CeKit Image and Modules descriptors') { steps { script { - sh ''' - curl -Ls https://github.com/kiegroup/kie-cloud-tools/releases/download/v1.3.6/cekit-image-validator-runner.tgz --output cekit-image-validator-runner.tgz - tar -xzvf cekit-image-validator-runner.tgz - chmod +x cekit-image-validator-runner - ''' - sh './cekit-image-validator-runner modules/' - getImages().each { image -> sh "./cekit-image-validator-runner ${image}-image.yaml" } - } - } - post { - always { - sh 'rm -rf cekit-image-validator-runner*' + dir(getRepoName()) { + sh ''' + curl -Ls https://github.com/kiegroup/kie-cloud-tools/releases/download/v1.3.6/cekit-image-validator-runner.tgz --output cekit-image-validator-runner.tgz + tar -xzvf cekit-image-validator-runner.tgz + chmod +x cekit-image-validator-runner + ''' + sh './cekit-image-validator-runner modules/' + getImages().each { image -> sh "./cekit-image-validator-runner ${image}-image.yaml" } + } } } } @@ -129,11 +131,13 @@ pipeline { stage('Build, Push & Test Images') { steps { script { - parallelStages = [:] - getImages().each { image -> - parallelStages["Build&Test ${image}"] = createBuildAndTestStageClosure(image) + dir(getRepoName()) { + parallelStages = [:] + getImages().each { image -> + parallelStages["Build&Test ${image}"] = createBuildAndTestStageClosure(image) + } + parallel parallelStages } - parallel parallelStages } } post { @@ -159,37 +163,39 @@ pipeline { } steps { script { - def commitMsg = "[${getBuildBranch()}] Update Maven artifacts" - def prBody = "Generated by build ${BUILD_TAG}: ${BUILD_URL}." - if (isRelease()) { - commitMsg = "[${getBuildBranch()}] Update project version to ${getProjectVersion()}" - prBody += '\nPlease do not merge, it should be merged automatically.' - } else if (currentBuild.currentResult != 'SUCCESS') { - commitMsg += " (${currentBuild.currentResult})" - prBody += '\n\nSuccessful images:\n' - getBuiltImages().each { - prBody += "- ${it}\n" - } - if (getBuildFailedImages()) { - prBody += '\nBuild failures on those images:\n' - getBuildFailedImages().each { + dir(getRepoName()) { + def commitMsg = "[${getBuildBranch()}] Update Maven artifacts" + def prBody = "Generated by build ${BUILD_TAG}: ${BUILD_URL}." + if (isRelease()) { + commitMsg = "[${getBuildBranch()}] Update project version to ${getProjectVersion()}" + prBody += '\nPlease do not merge, it should be merged automatically.' + } else if (currentBuild.currentResult != 'SUCCESS') { + commitMsg += " (${currentBuild.currentResult})" + prBody += '\n\nSuccessful images:\n' + getBuiltImages().each { prBody += "- ${it}\n" } - } else { - prBody += '\nImages were all successfully built but some other problem occured in the pipeline execution...\n' - } - if (getTestFailedImages()) { - prBody += '\nTest failures on those images:\n' - getTestFailedImages().each { - prBody += "- ${it}\n" + if (getBuildFailedImages()) { + prBody += '\nBuild failures on those images:\n' + getBuildFailedImages().each { + prBody += "- ${it}\n" + } + } else { + prBody += '\nImages were all successfully built but some other problem occured in the pipeline execution...\n' } - } else { - prBody += '\nImages were all successfully built but some other problem occured in the pipeline execution...\n' + if (getTestFailedImages()) { + prBody += '\nTest failures on those images:\n' + getTestFailedImages().each { + prBody += "- ${it}\n" + } + } else { + prBody += '\nImages were all successfully built but some other problem occured in the pipeline execution...\n' + } + prBody += '\nSee build url above for more information' } - prBody += '\nSee build url above for more information' + String prLink = githubscm.createPR(commitMsg, prBody, getBuildBranch(), getGitAuthorPushCredsId()) + deployProperties["${getRepoName()}.pr.link"] = prLink } - String prLink = githubscm.createPR(commitMsg, prBody, getBuildBranch(), getGitAuthorCredsID()) - deployProperties["${getRepoName()}.pr.link"] = prLink } } post { @@ -221,12 +227,12 @@ pipeline { archiveArtifacts artifacts: env.PROPERTIES_FILE_NAME, allowEmptyArchive:true } } + cleanup { + cleanWs() + } unsuccessful { sendUnsuccessfulNotification() } - cleanup { - clean() - } } } @@ -250,19 +256,15 @@ String getNotificationSubject() { void checkoutRepo() { deleteDir() - checkout(githubscm.resolveRepository(getRepoName(), getGitAuthor(), getBuildBranch(), false)) + checkout(githubscm.resolveRepository(getRepoName(), getGitAuthor(), getBuildBranch(), false, getGitAuthorCredsId())) } void commitAndPushChanges(String commitMsg) { githubscm.commitChanges(commitMsg) - githubscm.pushObject('origin', getPRBranch(), getGitAuthorCredsID()) + githubscm.pushObject('origin', getPRBranch(), getGitAuthorPushCredsId()) changesDone = true } -void clean() { - util.cleanNode() -} - void createBuildAndTestStageClosure(String image) { return { stage("Build&Test ${image}") { @@ -306,21 +308,15 @@ void createBuildAndTestStageClosure(String image) { } void registerBuiltImage(String imageName) { - lock("${BUILD_URL} build success") { - BUILT_IMAGES.add(imageName) - } + BUILT_IMAGES.add(imageName) } void registerBuildFailedImage(String imageName) { - lock("${BUILD_URL} build failed") { - BUILD_FAILED_IMAGES.add(imageName) - } + BUILD_FAILED_IMAGES.add(imageName) } void registerTestFailedImage(String imageName) { - lock("${BUILD_URL} test failed") { - TEST_FAILED_IMAGES.add(imageName) - } + TEST_FAILED_IMAGES.add(imageName) } List getBuiltImages() { @@ -348,7 +344,7 @@ String getDeployImageRegistryCredentials() { } String getDeployImageRegistry() { - return isDeployImageInOpenshiftRegistry() ? env.OPENSHIFT_REGISTRY : params.IMAGE_REGISTRY + return isDeployImageInOpenshiftRegistry() ? getOpenShiftRegistry() : params.IMAGE_REGISTRY } String getDeployImageNamespace() { return isDeployImageInOpenshiftRegistry() ? 'openshift' : params.IMAGE_NAMESPACE @@ -392,8 +388,12 @@ String getGitAuthor() { return "${GIT_AUTHOR}" } -String getGitAuthorCredsID() { - return env.AUTHOR_CREDS_ID +String getGitAuthorCredsId() { + return env.GIT_AUTHOR_CREDS_ID +} + +String getGitAuthorPushCredsId() { + return env.GIT_AUTHOR_PUSH_CREDS_ID } String getPRBranch() { @@ -408,6 +408,14 @@ String getKogitoArtifactsVersion() { return params.KOGITO_ARTIFACTS_VERSION } +String getOpenShiftRegistry() { + String registry = '' + withCredentials([string(credentialsId: 'OPENSHIFT_REGISTRY', variable: 'OPENSHIFT_REGISTRY')]) { + registry = env.OPENSHIFT_REGISTRY + } + return registry +} + void setDeployPropertyIfNeeded(String key, def value) { if (value) { deployProperties[key] = value @@ -418,11 +426,7 @@ String[] getImages() { if (env.IMAGES_LIST) { return env.IMAGES_LIST.split(',') } - return runPythonCommand("make list | tr '\\n' ','", true).trim().split(',') -} - -void runPythonCommand(String cmd, boolean stdout = false) { - return sh(returnStdout: stdout, script: cmd) + return sh(returnStdout: true, script: "make list | tr '\\n' ','").trim().split(',') } String getQuarkusPlatformVersion() { diff --git a/.ci/jenkins/Jenkinsfile.promote b/.ci/jenkins/Jenkinsfile.promote index 9bf8b4994..41c877c7c 100644 --- a/.ci/jenkins/Jenkinsfile.promote +++ b/.ci/jenkins/Jenkinsfile.promote @@ -13,6 +13,7 @@ pipeline { options { timeout(time: 120, unit: 'MINUTES') + skipDefaultCheckout() } environment { @@ -83,8 +84,8 @@ pipeline { // Merge PR String prLink = getDeployProperty("${getRepoName()}.pr.link") if (prLink) { - githubscm.mergePR(prLink, getGitAuthorCredsID()) - githubscm.pushObject('origin', getBuildBranch(), getGitAuthorCredsID()) + githubscm.mergePR(prLink, getGitAuthorPushCredsId()) + githubscm.pushObject('origin', getBuildBranch(), getGitAuthorPushCredsId()) } } } @@ -95,11 +96,11 @@ pipeline { steps { script { dir(getRepoName()) { - if (githubscm.isReleaseExist(getGitTag(), getGitAuthorCredsID())) { - githubscm.deleteReleaseAndTag(getGitTag(), getGitAuthorCredsID()) + if (githubscm.isReleaseExist(getGitTag(), getGitAuthorCredsId())) { + githubscm.deleteReleaseAndTag(getGitTag(), getGitAuthorPushCredsId()) } - githubscm.createReleaseWithGeneratedReleaseNotes(getGitTag(), getBuildBranch(), githubscm.getPreviousTagFromVersion(getGitTag()), getGitAuthorCredsID()) - githubscm.updateReleaseBody(getGitTag(), getGitAuthorCredsID()) + githubscm.createReleaseWithGeneratedReleaseNotes(getGitTag(), getBuildBranch(), githubscm.getPreviousTagFromVersion(getGitTag()), getGitAuthorPushCredsId()) + githubscm.updateReleaseBody(getGitTag(), getGitAuthorPushCredsId()) } } } @@ -135,7 +136,7 @@ String getNotificationSubject() { void checkoutRepo() { deleteDir() - checkout(githubscm.resolveRepository(getRepoName(), getGitAuthor(), getBuildBranch(), false)) + checkout(githubscm.resolveRepository(getRepoName(), getGitAuthor(), getBuildBranch(), false, getGitAuthorCredsId())) // need to manually checkout branch since on a detached branch after checkout command sh "git checkout ${getBuildBranch()}" } @@ -278,8 +279,12 @@ String getGitAuthor() { return env.GIT_AUTHOR } -String getGitAuthorCredsID() { - return env.AUTHOR_CREDS_ID +String getGitAuthorCredsId() { + return env.GIT_AUTHOR_CREDS_ID +} + +String getGitAuthorPushCredsId() { + return env.GIT_AUTHOR_PUSH_CREDS_ID } boolean isQuayRegistry(String registry) { diff --git a/.ci/jenkins/Jenkinsfile.setup-branch b/.ci/jenkins/Jenkinsfile.setup-branch index 182689cb0..ea5a9cce4 100644 --- a/.ci/jenkins/Jenkinsfile.setup-branch +++ b/.ci/jenkins/Jenkinsfile.setup-branch @@ -35,7 +35,7 @@ pipeline { steps { script { dir(getRepoName()) { - versionCmd = "python3 scripts/manage-kogito-version.py --bump-to ${getKogitoVersion()} --confirm" + versionCmd = "python scripts/manage-kogito-version.py --bump-to ${getKogitoVersion()} --confirm" versionCmd += " --examples-ref nightly-${getBuildBranch()}" if (getKogitoArtifactsVersion()) { versionCmd += " --artifacts-version ${getKogitoArtifactsVersion()}" @@ -87,7 +87,7 @@ pipeline { dir(getRepoName()) { if (githubscm.isThereAnyChanges()) { githubscm.commitChanges("[${getBuildBranch()}] Update version to ${getKogitoVersion()}") - githubscm.pushObject('origin', getBuildBranch(), getGitAuthorCredsID()) + githubscm.pushObject('origin', getBuildBranch(), getGitAuthorPushCredsId()) } else { println '[WARN] no changes to commit' } @@ -117,7 +117,7 @@ void sendUnsuccessfulNotification() { void checkoutRepo(String repository, String branch) { dir(repository) { deleteDir() - checkout(githubscm.resolveRepository(repository, getGitAuthor(), branch, false)) + checkout(githubscm.resolveRepository(repository, getGitAuthor(), branch, false, getGitAuthorCredsId())) sh "git checkout ${branch}" } } @@ -138,8 +138,12 @@ String getGitAuthor() { return "${GIT_AUTHOR}" } -String getGitAuthorCredsID() { - return "${AUTHOR_CREDS_ID}" +String getGitAuthorCredsId() { + return "${GIT_AUTHOR_CREDS_ID}" +} + +String getGitAuthorPushCredsId() { + return "${GIT_AUTHOR_PUSH_CREDS_ID}" } String getKogitoVersion() { diff --git a/.ci/jenkins/dsl/jobs.groovy b/.ci/jenkins/dsl/jobs.groovy index d04664573..656d44ec8 100644 --- a/.ci/jenkins/dsl/jobs.groovy +++ b/.ci/jenkins/dsl/jobs.groovy @@ -17,7 +17,7 @@ import org.kie.jenkins.jobdsl.Utils jenkins_path = '.ci/jenkins' // PR checks -Utils.isMainBranch(this) && KogitoJobTemplate.createPullRequestMultibranchPipelineJob(this, "${jenkins_path}/Jenkinsfile") +setupPrJob() // Init branch createSetupBranchJob() @@ -39,23 +39,10 @@ setupQuarkusUpdateJob() void setupPrJob() { setupBuildImageJob(JobType.PULL_REQUEST) + setupBuildAndTestJob(JobType.PULL_REQUEST) - def jobParams = JobParamsUtils.getBasicJobParams(this, 'kogito-images', JobType.PULL_REQUEST, "${jenkins_path}/Jenkinsfile", "Kogito Images PR check") - JobParamsUtils.setupJobParamsAgentDockerBuilderImageConfiguration(this, jobParams) - jobParams.pr.putAll([ - run_only_for_branches: [ "${GIT_BRANCH}" ], - disable_status_message_error: true, - disable_status_message_failure: true, - commitContext: 'Retrieve and Launch Image Checks', - contextShowtestResults: false, - ]) - if (Utils.hasBindingValue(this, 'CLOUD_IMAGES')) { - jobParams.env.put('IMAGES_LIST', Utils.getBindingValue(this, 'CLOUD_IMAGES')) - } - jobParams.env.putAll([ - AUTHOR_CREDS_ID: "${GIT_AUTHOR_CREDENTIALS_ID}", - ]) - KogitoJobTemplate.createPRJob(this, jobParams) + // Branch Source Plugin multibranchPipelineJob + Utils.isMainBranch(this) && KogitoJobTemplate.createPullRequestMultibranchPipelineJob(this, "${jenkins_path}/Jenkinsfile", JobType.PULL_REQUEST.getName()) } void createSetupBranchJob() { @@ -66,7 +53,8 @@ void createSetupBranchJob() { JENKINS_EMAIL_CREDS_ID: "${JENKINS_EMAIL_CREDS_ID}", - AUTHOR_CREDS_ID: "${GIT_AUTHOR_CREDENTIALS_ID}", + GIT_AUTHOR_CREDS_ID: "${GIT_AUTHOR_CREDENTIALS_ID}", + GIT_AUTHOR_PUSH_CREDS_ID: "${GIT_AUTHOR_PUSH_CREDENTIALS_ID}", IS_MAIN_BRANCH: "${Utils.isMainBranch(this)}" ]) @@ -98,8 +86,8 @@ void setupDeployJob(JobType jobType) { JENKINS_EMAIL_CREDS_ID: "${JENKINS_EMAIL_CREDS_ID}", GIT_AUTHOR: "${GIT_AUTHOR_NAME}", - AUTHOR_CREDS_ID: "${GIT_AUTHOR_CREDENTIALS_ID}", - GITHUB_TOKEN_CREDS_ID: "${GIT_AUTHOR_TOKEN_CREDENTIALS_ID}", + GIT_AUTHOR_CREDS_ID: "${GIT_AUTHOR_CREDENTIALS_ID}", + GIT_AUTHOR_PUSH_CREDS_ID: "${GIT_AUTHOR_PUSH_CREDENTIALS_ID}", MAVEN_ARTIFACT_REPOSITORY: "${MAVEN_ARTIFACTS_REPOSITORY}", DEFAULT_STAGING_REPOSITORY: "${MAVEN_NEXUS_STAGING_PROFILE_URL}", @@ -156,8 +144,8 @@ void setupBuildImageJob(JobType jobType) { MAX_REGISTRY_RETRIES: 3, TARGET_AUTHOR: Utils.getGitAuthor(this), // In case of a PR to merge with target branch - AUTHOR_CREDS_ID: "${GIT_AUTHOR_CREDENTIALS_ID}", - AUTHOR_TOKEN_CREDS_ID: "${GIT_AUTHOR_TOKEN_CREDENTIALS_ID}", + GIT_AUTHOR_CREDS_ID: "${GIT_AUTHOR_CREDENTIALS_ID}", + GIT_AUTHOR_TOKEN_CREDS_ID: "${GIT_AUTHOR_TOKEN_CREDENTIALS_ID}", ]) KogitoJobTemplate.createPipelineJob(this, jobParams)?.with { logRotator { @@ -196,6 +184,61 @@ void setupBuildImageJob(JobType jobType) { } } +void setupBuildAndTestJob(JobType jobType) { + def jobParams = JobParamsUtils.getBasicJobParams(this, 'kogito-images.build-and-test', jobType, "${jenkins_path}/Jenkinsfile.build-and-test", 'Kogito Images Build And test images') + // Use jenkinsfile from the build branch + jobParams.git.author = '${SOURCE_AUTHOR}' + jobParams.git.repository = '${SOURCE_REPOSITORY}' + jobParams.git.branch = '${SOURCE_BRANCH}' + JobParamsUtils.setupJobParamsAgentDockerBuilderImageConfiguration(this, jobParams) + jobParams.env.putAll([ + MAX_REGISTRY_RETRIES: 3, + TARGET_AUTHOR: Utils.getGitAuthor(this), // In case of a PR to merge with target branch + + GIT_AUTHOR_CREDS_ID: "${GIT_AUTHOR_CREDENTIALS_ID}", + GIT_AUTHOR_TOKEN_CREDS_ID: "${GIT_AUTHOR_TOKEN_CREDENTIALS_ID}", + ]) + if (Utils.hasBindingValue(this, 'CLOUD_IMAGES')) { + jobParams.env.put('IMAGES_LIST', Utils.getBindingValue(this, 'CLOUD_IMAGES')) + } + KogitoJobTemplate.createPipelineJob(this, jobParams)?.with { + logRotator { + daysToKeep(10) + } + parameters { + stringParam('DISPLAY_NAME', '', 'Setup a specific build display name') + + stringParam('SOURCE_AUTHOR', Utils.getGitAuthor(this), 'Build author') + stringParam('SOURCE_REPOSITORY', Utils.getRepoName(this), 'Build repository name') + stringParam('SOURCE_BRANCH', Utils.getGitBranch(this), 'Build branch name') + stringParam('TARGET_BRANCH', '', '(Optional) In case of a PR to merge with target branch, please provide the target branch') + stringParam('CHANGE_ID', '', 'CHANGE_ID coming from Branch Source Plugin') + stringParam('CHANGE_URL', '', 'CHANGE_URL coming from Branch Source Plugin') + + // Build information + stringParam('MAVEN_ARTIFACTS_REPOSITORY', "${MAVEN_ARTIFACTS_REPOSITORY}") + stringParam('BUILD_KOGITO_APPS_URI', '', '(Optional) Git uri to the kogito-apps repository to use for tests.') + stringParam('BUILD_KOGITO_APPS_REF', '', '(Optional) Git reference (branch/tag) to the kogito-apps repository to use for building. Default to BUILD_BRANCH_NAME.') + stringParam('QUARKUS_PLATFORM_URL', Utils.getMavenQuarkusPlatformRepositoryUrl(this), 'URL to the Quarkus platform to use. The version to use will be guessed from artifacts.') + + // Test information + booleanParam('SKIP_TESTS', false, 'Skip tests') + stringParam('TESTS_KOGITO_EXAMPLES_URI', '', '(Optional) Git uri to the kogito-examples repository to use for tests.') + stringParam('TESTS_KOGITO_EXAMPLES_REF', '', '(Optional) Git reference (branch/tag) to the kogito-examples repository to use for tests.') + + // Deploy information + booleanParam('DEPLOY_IMAGE', false, 'Should we deploy image to given deploy registry ?') + booleanParam('DEPLOY_IMAGE_USE_OPENSHIFT_REGISTRY', false, 'Set to true if image should be deployed in Openshift registry.In this case, IMAGE_REGISTRY_CREDENTIALS, IMAGE_REGISTRY and IMAGE_NAMESPACE parameters will be ignored') + stringParam('DEPLOY_IMAGE_REGISTRY_CREDENTIALS', "${CLOUD_IMAGE_REGISTRY_CREDENTIALS}", 'Image registry credentials to use to deploy images. Will be ignored if no IMAGE_REGISTRY is given') + stringParam('DEPLOY_IMAGE_REGISTRY', "${CLOUD_IMAGE_REGISTRY}", 'Image registry to use to deploy images') + stringParam('DEPLOY_IMAGE_NAMESPACE', "${CLOUD_IMAGE_NAMESPACE}", 'Image namespace to use to deploy images') + stringParam('DEPLOY_IMAGE_NAME_SUFFIX', '', 'Image name suffix to use to deploy images. In case you need to change the final image name, you can add a suffix to it.') + stringParam('DEPLOY_IMAGE_TAG', '', 'Image tag to use to deploy images') + booleanParam('DEPLOY_WITH_LATEST_TAG', false, 'Set to true if you want the deployed images to also be with the `latest` tag') + } + } +} + void setupPromoteJob(JobType jobType) { def jobParams = JobParamsUtils.getBasicJobParams(this, 'kogito-images-promote', jobType, "${jenkins_path}/Jenkinsfile.promote", 'Kogito Images Promote') JobParamsUtils.setupJobParamsAgentDockerBuilderImageConfiguration(this, jobParams) @@ -208,8 +251,8 @@ void setupPromoteJob(JobType jobType) { GIT_AUTHOR: "${GIT_AUTHOR_NAME}", - AUTHOR_CREDS_ID: "${GIT_AUTHOR_CREDENTIALS_ID}", - GITHUB_TOKEN_CREDS_ID: "${GIT_AUTHOR_TOKEN_CREDENTIALS_ID}", + GIT_AUTHOR_CREDS_ID: "${GIT_AUTHOR_CREDENTIALS_ID}", + GIT_AUTHOR_PUSH_CREDS_ID: "${GIT_AUTHOR_PUSH_CREDENTIALS_ID}", DEFAULT_STAGING_REPOSITORY: "${MAVEN_NEXUS_STAGING_PROFILE_URL}", MAVEN_ARTIFACT_REPOSITORY: "${MAVEN_ARTIFACTS_REPOSITORY}", @@ -257,6 +300,6 @@ void setupPromoteJob(JobType jobType) { void setupQuarkusUpdateJob() { KogitoJobUtils.createQuarkusUpdateToolsJob(this, 'kogito-images', [:], [:], [], [ - "source ~/virtenvs/cekit/bin/activate && python3 scripts/update-repository.py --quarkus-platform-version %new_version%" + "python scripts/update-repository.py --quarkus-platform-version %new_version%" ]) } diff --git a/.github/workflows/jenkins-tests-PR.yml b/.github/workflows/jenkins-tests-PR.yml index 324a2deb1..d9bb4083b 100644 --- a/.github/workflows/jenkins-tests-PR.yml +++ b/.github/workflows/jenkins-tests-PR.yml @@ -15,7 +15,7 @@ jobs: runs-on: ubuntu-latest steps: - name: DSL tests - uses: kiegroup/kie-ci/.ci/actions/dsl-tests@main + uses: apache/incubator-kie-kogito-pipelines/.ci/actions/dsl-tests@main with: main-config-file-repo: apache/incubator-kie-kogito-pipelines main-config-file-path: .ci/jenkins/config/main.yaml diff --git a/.github/workflows/pr-backporting.yml b/.github/workflows/pr-backporting.yml index ae52e051d..e70052457 100644 --- a/.github/workflows/pr-backporting.yml +++ b/.github/workflows/pr-backporting.yml @@ -17,7 +17,7 @@ jobs: steps: - name: Set target branches id: set-targets - uses: kiegroup/kie-ci/.ci/actions/parse-labels@main + uses: apache/incubator-kie-kogito-pipelines/.ci/actions/parse-labels@main with: labels: ${LABELS} @@ -34,7 +34,7 @@ jobs: REVIEWERS: ${{ toJSON(github.event.pull_request.requested_reviewers) }} steps: - name: Backporting - uses: kiegroup/kie-ci/.ci/actions/backporting@main + uses: apache/incubator-kie-kogito-pipelines/.ci/actions/backporting@main with: target-branch: ${{ matrix.target-branch }} additional-reviewers: ${REVIEWERS} \ No newline at end of file diff --git a/Makefile b/Makefile index 4e2b46570..852d729af 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,7 @@ -IMAGE_VERSION := $(shell python3 scripts/retrieve_version.py) +IMAGE_VERSION := $(shell python scripts/retrieve_version.py) SHORTENED_LATEST_VERSION := $(shell echo $(IMAGE_VERSION) | awk -F. '{print $$1"."$$2}') KOGITO_APPS_TARGET_BRANCH ?= main -KOGITO_APPS_TARGET_URI ?= https://github.com/kiegroup/kogito-apps.git +KOGITO_APPS_TARGET_URI ?= https://github.com/apache/incubator-kie-kogito-apps.git BUILD_ENGINE ?= docker BUILD_ENGINE_TLS_OPTIONS ?= '' .DEFAULT_GOAL := build @@ -12,14 +12,14 @@ clone-repos: # if the ignore_test env is not defined or false, proceed with the tests, as first step prepare the examples to be used ifneq ($(ignore_test),true) ifneq ($(ignore_test_prepare),true) - cd tests/test-apps && export CONTAINER_ENGINE=$(BUILD_ENGINE) && sh clone-repo.sh $(NATIVE) $(image_name) + cd tests/test-apps && export CONTAINER_ENGINE=$(BUILD_ENGINE) && bash clone-repo.sh $(NATIVE) $(image_name) cd ../.. endif endif .PHONY: list list: - @python3 scripts/list-images.py $(arg) + @python scripts/list-images.py $(arg) .PHONY: display-image-version display-image-version: @@ -99,7 +99,7 @@ endif .PHONY: push-staging push-staging: build _push-staging _push-staging: - python3 scripts/push-staging.py ${override} + python scripts/push-staging.py ${override} # push to local registry, useful to push the built images to local registry diff --git a/README.md b/README.md index f7c8b91c7..f61da8c41 100644 --- a/README.md +++ b/README.md @@ -5,11 +5,11 @@ Kogito

-[![GitHub Stars](https://img.shields.io/github/stars/kiegroup/kogito-images.svg)](https://github.com/kiegroup/kogito-images/stargazers) -[![GitHub Forks](https://img.shields.io/github/forks/kiegroup/kogito-images.svg)](https://github.com/kiegroup/kogito-images/network/members) -[![Pull Requests](https://img.shields.io/github/issues-pr/kiegroup/kogito-images.svg?style=flat-square)](https://github.com/kiegroup/kogito-images/pulls) -[![Contributors](https://img.shields.io/github/contributors/kiegroup/kogito-images.svg?style=flat-square)](https://github.com/kiegroup/kogito-images/graphs/contributors) -[![License](https://img.shields.io/github/license/kiegroup/kogito-images.svg)](https://github.com/kiegroup/kogito-images/blob/main/LICENSE) +[![GitHub Stars](https://img.shields.io/github/stars/apache/incubator-kie-kogito-images.svg)](https://github.com/apache/incubator-kie-kogito-images/stargazers) +[![GitHub Forks](https://img.shields.io/github/forks/apache/incubator-kie-kogito-images.svg)](https://github.com/apache/incubator-kie-kogito-images/network/members) +[![Pull Requests](https://img.shields.io/github/issues-pr/apache/incubator-kie-kogito-images.svg?style=flat-square)](https://github.com/apache/incubator-kie-kogito-images/pulls) +[![Contributors](https://img.shields.io/github/contributors/apache/incubator-kie-kogito-images.svg?style=flat-square)](https://github.com/apache/incubator-kie-kogito-images/graphs/contributors) +[![License](https://img.shields.io/github/license/apache/incubator-kie-kogito-images.svg)](https://github.com/apache/incubator-kie-kogito-images/blob/main/LICENSE) [![Twitter Follow](https://img.shields.io/twitter/follow/kogito_kie.svg?label=Follow&style=social)](https://twitter.com/kogito_kie?lang=en) @@ -231,12 +231,12 @@ See the next topic for an example. #### Kogito s2i Builder Image example ##### S2i Builder Image Example with Quarkus -In this example, let's use a simple application based on Quarkus that is available in the [Kogito Examples](https://github.com/kiegroup/kogito-examples) +In this example, let's use a simple application based on Quarkus that is available in the [Kogito Examples](https://github.com/apache/incubator-kie-kogito-examples) repository: the *rules-quarkus-helloworld* example, with native compilation disabled. ```bash -$ s2i build https://github.com/kiegroup/kogito-examples.git \ +$ s2i build https://github.com/apache/incubator-kie-kogito-examples.git \ --ref main \ -e RUNTIME_TYPE=quarkus \ --context-dir kogito-quarkus-examples/rules-quarkus-helloworld \ @@ -279,11 +279,11 @@ $ curl -H "Content-Type: application/json" -X POST -d '{"strings":["hello"]}' ht ##### S2i Builder Image Example with Springboot -In this example, let's use a simple application based on Spring Boot that is available in the [Kogito Examples](https://github.com/kiegroup/kogito-examples) +In this example, let's use a simple application based on Spring Boot that is available in the [Kogito Examples](https://github.com/apache/incubator-kie-kogito-examples) repository: the *process-springboot-example*. ```bash -$ s2i build https://github.com/kiegroup/kogito-examples.git \ +$ s2i build https://github.com/apache/incubator-kie-kogito-examples.git \ --ref main \ --context-dir kogito-springboot-examples/process-springboot-example \ -e RUNTIME_TYPE=springboot \ @@ -320,7 +320,7 @@ Let's start 2 builds with the incremental option enabled and compare the time sp ```bash # First incremental build -$ time s2i build https://github.com/kiegroup/kogito-examples.git \ +$ time s2i build https://github.com/apache/incubator-kie-kogito-examples.git \ --ref main \ -e RUNTIME_TYPE=quarkus --context-dir kogito-quarkus-examples/rules-quarkus-helloworld \ @@ -338,7 +338,7 @@ And now, let's run it again. ```bash # Second incremental build -$ time s2i build https://github.com/kiegroup/kogito-examples.git \ +$ time s2i build https://github.com/apache/incubator-kie-kogito-examples.git \ --ref main \ -e RUNTIME_TYPE=quarkus --context-dir kogito-quarkus-examples/rules-quarkus-helloworld \ @@ -366,7 +366,7 @@ To make it possible we just need to set the **MAVEN_MIRROR_URL** environment var ```bash # Third incremental build, with Maven mirror option -$ time s2i build https://github.com/kiegroup/kogito-examples.git \ +$ time s2i build https://github.com/apache/incubator-kie-kogito-examples.git \ --ref main \ -e RUNTIME_TYPE=quarkus --context-dir kogito-quarkus-examples/rules-quarkus-helloworld \ @@ -435,8 +435,8 @@ If you don't have an already existing project, the best way to create a new one to generate project structure. The available archetypes are: -- [Kogito Quarkus Archetype](https://github.com/kiegroup/kogito-runtimes/tree/main/archetypes/kogito-quarkus-archetype) -- [Kogito Spring Boot Archetype](https://github.com/kiegroup/kogito-runtimes/tree/main/archetypes/kogito-springboot-archetype) +- [Kogito Quarkus Archetype](https://github.com/apache/incubator-kie-kogito-runtimes/tree/main/archetypes/kogito-quarkus-archetype) +- [Kogito Spring Boot Archetype](https://github.com/apache/incubator-kie-kogito-runtimes/tree/main/archetypes/kogito-springboot-archetype) Note that, when building Quarkus based application that is **not** an *UberJAR* we also need to copy the **lib** directory located inside the *target* directory. @@ -476,7 +476,7 @@ docker run -it quay.io/kiegroup/kogito-runtime-jvm:latest /home/kogito/kogito-ap In the next few lines let's take a look on how this image can be used to receive an already built UberJAR. To configure Quarkus to generate an UberJAR please follow the instructions described [here](https://quarkus.io/guides/maven-tooling#configuration-reference) -For this example let's use the [process-quarkus-example](https://github.com/kiegroup/kogito-examples/tree/stable/kogito-quarkus-examples/process-quarkus-example). +For this example let's use the [process-quarkus-example](https://github.com/apache/incubator-kie-kogito-examples/tree/stable/kogito-quarkus-examples/process-quarkus-example). Once you have checked out the example on your local machine follow the steps below: **Example with UberJAR** @@ -681,7 +681,7 @@ $ docker run -it --env SCRIPT_DEBUG=true --env QUARKUS_INFINISPAN_CLIENT_HOSTS=m You should notice a few debug messages present in the system output. -The [Kogito Operator](https://github.com/kiegroup/kogito-cloud-operator) can be used to deploy the Kogito Data Index Service +The [Kogito Operator](https://github.com/apache/incubator-kie-kogito-operator) can be used to deploy the Kogito Data Index Service to your Kogito infrastructure on a Kubernetes cluster and provide its capabilities to your Kogito applications. ### Kogito Explainability Component Image @@ -702,7 +702,7 @@ You should notice a few debug messages being printed in the system output. To know what configurations this image accepts please take a look [here](kogito-explainability-image.yaml) on the **envs** section. -The [Kogito Operator](https://github.com/kiegroup/kogito-cloud-operator) can be used to deploy the Kogito Explainability Service +The [Kogito Operator](https://github.com/apache/incubator-kie-kogito-operator) can be used to deploy the Kogito Explainability Service to your Kogito infrastructure on a Kubernetes cluster and provide its capabilities to your Kogito applications. @@ -746,7 +746,7 @@ You should notice a few debug messages being printed in the system output. To know what configurations this image accepts please take a look [here](kogito-trusty-image.yaml) on the **envs** section. -The [Kogito Operator](https://github.com/kiegroup/kogito-cloud-operator) can be used to deploy the Kogito Trusty Service +The [Kogito Operator](https://github.com/apache/incubator-kie-kogito-operator) can be used to deploy the Kogito Trusty Service to your Kogito infrastructure on a Kubernetes cluster and provide its capabilities to your Kogito applications. ### Kogito Jobs Service Component Images @@ -754,7 +754,7 @@ to your Kogito infrastructure on a Kubernetes cluster and provide its capabiliti The Kogito Jobs Service is a dedicated lightweight service responsible for scheduling jobs that aim at firing at a given time. It does not execute the job itself, but it triggers a callback that could be an HTTP request on a given endpoint specified on the job request, or any other callback that could be supported by the service. -For more information please visit this [link](https://github.com/kiegroup/kogito-runtimes/wiki/Job-Service). +For more information please visit this [link](https://github.com/apache/incubator-kie-kogito-runtimes/wiki/Job-Service). Today, the Jobs service contains four images: @@ -820,7 +820,7 @@ podman-compose -f contrib/jobs-service/container-compose-.yaml up The above command will spinup the Jobs-service so you can connect your application. -The [Kogito Operator](https://github.com/kiegroup/kogito-cloud-operator) can be used to deploy the Kogito Jobs Service +The [Kogito Operator](https://github.com/apache/incubator-kie-kogito-operator) can be used to deploy the Kogito Jobs Service to your Kogito infrastructure on a Kubernetes cluster and provide its capabilities to your Kogito applications @@ -849,7 +849,7 @@ You should notice a few debug messages being printed in the system output. To know what configurations this image accepts please take a look [here](kogito-management-console-image.yaml) on the **envs** section. -The [Kogito Operator](https://github.com/kiegroup/kogito-cloud-operator) can be used to deploy the Kogito Management Console +The [Kogito Operator](https://github.com/apache/incubator-kie-kogito-operator) can be used to deploy the Kogito Management Console to your Kogito infrastructure on a Kubernetes cluster and provide its capabilities to your Kogito applications. ### Kogito Task Console Component Image @@ -874,7 +874,7 @@ You should notice a few debug messages being printed in the system output. To know what configurations this image accepts please take a look [here](kogito-task-console-image.yaml) on the **envs** section. -The [Kogito Operator](https://github.com/kiegroup/kogito-cloud-operator) can be used to deploy the Kogito Task Console +The [Kogito Operator](https://github.com/apache/incubator-kie-kogito-operator) can be used to deploy the Kogito Task Console to your Kogito infrastructure on a Kubernetes cluster and provide its capabilities to your Kogito applications. ### Kogito Trusty UI Component Image @@ -899,12 +899,12 @@ You should notice a few debug messages being printed in the system output. To know what configurations this image accepts please take a look [here](kogito-trusty-ui-image.yaml) on the **envs** section. -The [Kogito Operator](https://github.com/kiegroup/kogito-cloud-operator) can be used to deploy the Kogito Trusty UI +The [Kogito Operator](https://github.com/apache/incubator-kie-kogito-operator) can be used to deploy the Kogito Trusty UI to your Kogito infrastructure on a Kubernetes cluster and provide its capabilities to your Kogito applications. ### Kogito JIT Runner Component Image -The Kogito JIT Runner provides a tool that allows you to submit a DMN model and evaluate it on the fly with a simple HTTP request. You can find more details on JIT [here](https://github.com/kiegroup/kogito-apps/tree/main/jitexecutor). +The Kogito JIT Runner provides a tool that allows you to submit a DMN model and evaluate it on the fly with a simple HTTP request. You can find more details on JIT [here](https://github.com/apache/incubator-kie-kogito-apps/tree/main/jitexecutor). Basic usage: @@ -930,10 +930,10 @@ Once the images are built and imported into a registry (quay.io or any other reg As a first step, we need to make the Kogito Images available as Image Streams in OpenShift. If you have `cluster-admin` rights you can deploy it into the **openshift** namespace, otherwise, deploy it into the namespace where you have permissions. -To install the image stream use this imagestream file: [kogito-imagestream.yaml](https://raw.githubusercontent.com/kiegroup/kogito-images/main/kogito-imagestream.yaml). +To install the image stream use this imagestream file: [kogito-imagestream.yaml](https://raw.githubusercontent.com/apache/incubator-kie-kogito-images/main/kogito-imagestream.yaml). It points to the latest released version. -Let's use the *kogito-quarkus-examples/rules-quarkus-helloworld* from [Kogito Examples](https://github.com/kiegroup/kogito-examples). +Let's use the *kogito-quarkus-examples/rules-quarkus-helloworld* from [Kogito Examples](https://github.com/apache/incubator-kie-kogito-examples). ```bash # creating a new namespace @@ -947,7 +947,7 @@ You can add applications to this project with the 'new-app' command. For example to build a new example application in Ruby. # installing the imagestream on the current namespace -$ oc create -f https://raw.githubusercontent.com/kiegroup/kogito-images/0.16.0/kogito-imagestream.yaml +$ oc create -f https://raw.githubusercontent.com/apache/incubator-kie-kogito-images/0.16.0/kogito-imagestream.yaml imagestream.image.openshift.io/kogito-runtime-native created imagestream.image.openshift.io/kogito-runtime-jvm created imagestream.image.openshift.io/kogito-s2i-builder created @@ -967,7 +967,7 @@ imagestream.image.openshift.io/kogito-management-console created # performing a new build $ oc new-build --name=rules-quarkus-helloworld-builder --image-stream=kogito-s2i-builder:latest \ - https://github.com/kiegroup/kogito-examples.git#main --context-dir=kogito-quarkus-examples/rules-quarkus-helloworld \ + https://github.com/apache/incubator-kie-kogito-examples.git#main --context-dir=kogito-quarkus-examples/rules-quarkus-helloworld \ --strategy=source --env NATIVE=false --> Found image 8c9d756 (5 days old) in image stream "rules-quarkus-helloworld/kogito-s2i-builder" under tag "latest" for "kogito-s2i-builder:latest" @@ -978,7 +978,7 @@ $ oc new-build --name=rules-quarkus-helloworld-builder --image-stream=kogito-s2i Tags: builder, kogito, quarkus * The source repository appears to match: jee - * A source build using source code from https://github.com/kiegroup/kogito-examples.git#main will be created + * A source build using source code from https://github.com/apache/incubator-kie-kogito-examples.git#main will be created * The resulting image will be pushed to image stream tag "rules-quarkus-helloworld-builder:latest" * Use 'start-build' to trigger a new build @@ -1077,7 +1077,7 @@ As output, you should see the following response: ``` -For more complex deployment, please use the [Kogito Cloud Operator](https://github.com/kiegroup/kogito-cloud-operator) +For more complex deployment, please use the [Kogito Cloud Operator](https://github.com/apache/incubator-kie-kogito-operator) diff --git a/kogito-base-builder-image.yaml b/kogito-base-builder-image.yaml index a477a7125..88be045bc 100644 --- a/kogito-base-builder-image.yaml +++ b/kogito-base-builder-image.yaml @@ -17,7 +17,7 @@ labels: - name: "org.kie.kogito.version" value: "2.0.0-SNAPSHOT" - name: "maintainer" - value: "kogito " + value: "Apache KIE " - name: "io.k8s.description" value: "Platform for building Kogito based on JDK and Maven" - name: "io.k8s.display-name" diff --git a/kogito-data-index-ephemeral-image.yaml b/kogito-data-index-ephemeral-image.yaml index ca4d1a1bc..00e9f7233 100644 --- a/kogito-data-index-ephemeral-image.yaml +++ b/kogito-data-index-ephemeral-image.yaml @@ -9,7 +9,7 @@ labels: - name: "org.kie.kogito.version" value: "2.0.0-SNAPSHOT" - name: "maintainer" - value: "kogito " + value: "Apache KIE " - name: "io.k8s.description" value: "Runtime image for Kogito Data Index Service for ephemeral PostgreSQL persistence provider" - name: "io.k8s.display-name" diff --git a/kogito-data-index-infinispan-image.yaml b/kogito-data-index-infinispan-image.yaml index c0416aee7..e8ebd3122 100644 --- a/kogito-data-index-infinispan-image.yaml +++ b/kogito-data-index-infinispan-image.yaml @@ -9,7 +9,7 @@ labels: - name: "org.kie.kogito.version" value: "2.0.0-SNAPSHOT" - name: "maintainer" - value: "kogito " + value: "Apache KIE " - name: "io.k8s.description" value: "Runtime image for Kogito Data Index Service for Infinispan persistence provider" - name: "io.k8s.display-name" diff --git a/kogito-data-index-mongodb-image.yaml b/kogito-data-index-mongodb-image.yaml index fd091fc52..ff9d55d61 100644 --- a/kogito-data-index-mongodb-image.yaml +++ b/kogito-data-index-mongodb-image.yaml @@ -9,7 +9,7 @@ labels: - name: "org.kie.kogito.version" value: "2.0.0-SNAPSHOT" - name: "maintainer" - value: "kogito " + value: "Apache KIE " - name: "io.k8s.description" value: "Runtime image for Kogito Data Index Service for Mongodb persistence provider" - name: "io.k8s.display-name" diff --git a/kogito-data-index-oracle-image.yaml b/kogito-data-index-oracle-image.yaml index f4f544ae3..af4c192de 100644 --- a/kogito-data-index-oracle-image.yaml +++ b/kogito-data-index-oracle-image.yaml @@ -9,7 +9,7 @@ labels: - name: "org.kie.kogito.version" value: "2.0.0-SNAPSHOT" - name: "maintainer" - value: "kogito " + value: "Apache KIE " - name: "io.k8s.description" value: "Runtime image for Kogito Data Index Service for Oracle persistence provider" - name: "io.k8s.display-name" diff --git a/kogito-data-index-postgresql-image.yaml b/kogito-data-index-postgresql-image.yaml index 56ecf30fb..e7ba4fb41 100644 --- a/kogito-data-index-postgresql-image.yaml +++ b/kogito-data-index-postgresql-image.yaml @@ -10,7 +10,7 @@ labels: - name: "org.kie.kogito.version" value: "2.0.0-SNAPSHOT" - name: "maintainer" - value: "kogito " + value: "Apache KIE " - name: "io.k8s.description" value: "Runtime image for Kogito Data Index Service for PostgreSQL persistence provider" - name: "io.k8s.display-name" diff --git a/kogito-explainability-image.yaml b/kogito-explainability-image.yaml index dab26f902..059c6685d 100644 --- a/kogito-explainability-image.yaml +++ b/kogito-explainability-image.yaml @@ -9,7 +9,7 @@ labels: - name: "org.kie.kogito.version" value: "2.0.0-SNAPSHOT" - name: "maintainer" - value: "kogito " + value: "Apache KIE " - name: "io.k8s.description" value: "Runtime image for Kogito Explainability Service" - name: "io.k8s.display-name" diff --git a/kogito-jit-runner-image.yaml b/kogito-jit-runner-image.yaml index 841a31039..423ac0ff4 100644 --- a/kogito-jit-runner-image.yaml +++ b/kogito-jit-runner-image.yaml @@ -9,7 +9,7 @@ labels: - name: "org.kie.kogito.version" value: "2.0.0-SNAPSHOT" - name: "maintainer" - value: "kogito " + value: "Apache KIE " - name: "io.k8s.description" value: "Runtime image for Kogito JIT Runner" - name: "io.k8s.display-name" diff --git a/kogito-jobs-service-allinone-image.yaml b/kogito-jobs-service-allinone-image.yaml index a83a110a8..60c360fb1 100644 --- a/kogito-jobs-service-allinone-image.yaml +++ b/kogito-jobs-service-allinone-image.yaml @@ -9,7 +9,7 @@ labels: - name: "org.kie.kogito.version" value: "2.0.0-SNAPSHOT" - name: "maintainer" - value: "kogito " + value: "Apache KIE " - name: "io.k8s.description" value: "Runtime image for Kogito Jobs Service with all available jdbc providers" - name: "io.k8s.display-name" diff --git a/kogito-jobs-service-ephemeral-image.yaml b/kogito-jobs-service-ephemeral-image.yaml index 497d8ef75..5975572e6 100644 --- a/kogito-jobs-service-ephemeral-image.yaml +++ b/kogito-jobs-service-ephemeral-image.yaml @@ -9,7 +9,7 @@ labels: - name: "org.kie.kogito.version" value: "2.0.0-SNAPSHOT" - name: "maintainer" - value: "kogito " + value: "Apache KIE " - name: "io.k8s.description" value: "Runtime image for Kogito in memory Jobs Service" - name: "io.k8s.display-name" diff --git a/kogito-jobs-service-infinispan-image.yaml b/kogito-jobs-service-infinispan-image.yaml index a772a6798..5ab15692a 100644 --- a/kogito-jobs-service-infinispan-image.yaml +++ b/kogito-jobs-service-infinispan-image.yaml @@ -9,7 +9,7 @@ labels: - name: "org.kie.kogito.version" value: "2.0.0-SNAPSHOT" - name: "maintainer" - value: "kogito " + value: "Apache KIE " - name: "io.k8s.description" value: "Runtime image for Kogito Jobs Service based on Infinispan" - name: "io.k8s.display-name" diff --git a/kogito-jobs-service-mongodb-image.yaml b/kogito-jobs-service-mongodb-image.yaml index 40577f658..d83a45841 100644 --- a/kogito-jobs-service-mongodb-image.yaml +++ b/kogito-jobs-service-mongodb-image.yaml @@ -9,7 +9,7 @@ labels: - name: "org.kie.kogito.version" value: "2.0.0-SNAPSHOT" - name: "maintainer" - value: "kogito " + value: "Apache KIE " - name: "io.k8s.description" value: "Runtime image for Kogito Jobs Service based on MongoDB" - name: "io.k8s.display-name" diff --git a/kogito-jobs-service-postgresql-image.yaml b/kogito-jobs-service-postgresql-image.yaml index 98e2608b4..56ea62d81 100644 --- a/kogito-jobs-service-postgresql-image.yaml +++ b/kogito-jobs-service-postgresql-image.yaml @@ -9,7 +9,7 @@ labels: - name: "org.kie.kogito.version" value: "2.0.0-SNAPSHOT" - name: "maintainer" - value: "kogito " + value: "Apache KIE " - name: "io.k8s.description" value: "Runtime image for Kogito Jobs Service based on Postgresql" - name: "io.k8s.display-name" diff --git a/kogito-management-console-image.yaml b/kogito-management-console-image.yaml index f604fdfaa..3a4de549f 100644 --- a/kogito-management-console-image.yaml +++ b/kogito-management-console-image.yaml @@ -9,7 +9,7 @@ labels: - name: "org.kie.kogito.version" value: "2.0.0-SNAPSHOT" - name: "maintainer" - value: "kogito " + value: "Apache KIE " - name: "io.k8s.description" value: "Runtime image for Kogito Management Console, manage your Business Process easily." - name: "io.k8s.display-name" diff --git a/kogito-runtime-jvm-image.yaml b/kogito-runtime-jvm-image.yaml index 245c42dbb..8871487f1 100644 --- a/kogito-runtime-jvm-image.yaml +++ b/kogito-runtime-jvm-image.yaml @@ -17,7 +17,7 @@ labels: - name: "org.kie.kogito.version" value: "2.0.0-SNAPSHOT" - name: "maintainer" - value: "kogito " + value: "Apache KIE " - name: "io.k8s.description" value: "Runtime image for Kogito based on Quarkus or Spring Boot JVM image" - name: "io.k8s.display-name" diff --git a/kogito-runtime-native-image.yaml b/kogito-runtime-native-image.yaml index 56412886d..62139b82f 100644 --- a/kogito-runtime-native-image.yaml +++ b/kogito-runtime-native-image.yaml @@ -17,7 +17,7 @@ labels: - name: "org.kie.kogito.version" value: "2.0.0-SNAPSHOT" - name: "maintainer" - value: "kogito " + value: "Apache KIE " - name: "io.k8s.description" value: "Runtime image for Kogito based on Quarkus native image" - name: "io.k8s.display-name" diff --git a/kogito-s2i-builder-image.yaml b/kogito-s2i-builder-image.yaml index a947f4f71..7c4b288ad 100644 --- a/kogito-s2i-builder-image.yaml +++ b/kogito-s2i-builder-image.yaml @@ -17,7 +17,7 @@ labels: - name: "org.kie.kogito.version" value: "2.0.0-SNAPSHOT" - name: "maintainer" - value: "kogito " + value: "Apache KIE " - name: "io.k8s.description" value: "Platform for building Kogito based on Quarkus or Spring Boot" - name: "io.k8s.display-name" diff --git a/kogito-swf-builder-image.yaml b/kogito-swf-builder-image.yaml index ee6b1d68b..421d04480 100644 --- a/kogito-swf-builder-image.yaml +++ b/kogito-swf-builder-image.yaml @@ -37,7 +37,7 @@ - name: "org.kie.kogito.version" value: "2.0.0-SNAPSHOT" - name: "maintainer" - value: "kogito " + value: "Apache KIE " - name: "io.k8s.description" value: "Kogito Serverless Workflow base builder with Quarkus extensions libraries preinstalled." - name: "io.k8s.display-name" diff --git a/kogito-swf-devmode-image.yaml b/kogito-swf-devmode-image.yaml index 7c647a715..2503a8699 100644 --- a/kogito-swf-devmode-image.yaml +++ b/kogito-swf-devmode-image.yaml @@ -33,7 +33,7 @@ - name: "org.kie.kogito.version" value: "2.0.0-SNAPSHOT" - name: "maintainer" - value: "kogito " + value: "Apache KIE " - name: "io.k8s.description" value: "Kogito Serverless Workflow base builder with Quarkus extensions libraries preinstalled." - name: "io.k8s.display-name" diff --git a/kogito-task-console-image.yaml b/kogito-task-console-image.yaml index 18ca8eaba..d4a0d1a0b 100644 --- a/kogito-task-console-image.yaml +++ b/kogito-task-console-image.yaml @@ -9,7 +9,7 @@ labels: - name: "org.kie.kogito.version" value: "2.0.0-SNAPSHOT" - name: "maintainer" - value: "kogito " + value: "Apache KIE " - name: "io.k8s.description" value: "Runtime image for Kogito Task Console, manage your Business Process easily." - name: "io.k8s.display-name" diff --git a/kogito-trusty-infinispan-image.yaml b/kogito-trusty-infinispan-image.yaml index 5e4807d85..0fcec5944 100644 --- a/kogito-trusty-infinispan-image.yaml +++ b/kogito-trusty-infinispan-image.yaml @@ -9,7 +9,7 @@ labels: - name: "org.kie.kogito.version" value: "2.0.0-SNAPSHOT" - name: "maintainer" - value: "kogito " + value: "Apache KIE " - name: "io.k8s.description" value: "Runtime image for Kogito Trusty Service for Infinispan persistence provider" - name: "io.k8s.display-name" diff --git a/kogito-trusty-postgresql-image.yaml b/kogito-trusty-postgresql-image.yaml index d0e142566..6f8848df6 100644 --- a/kogito-trusty-postgresql-image.yaml +++ b/kogito-trusty-postgresql-image.yaml @@ -9,7 +9,7 @@ labels: - name: "org.kie.kogito.version" value: "2.0.0-SNAPSHOT" - name: "maintainer" - value: "kogito " + value: "Apache KIE " - name: "io.k8s.description" value: "Runtime image for Kogito Trusty Service for PostgreSQL persistence provider" - name: "io.k8s.display-name" diff --git a/kogito-trusty-redis-image.yaml b/kogito-trusty-redis-image.yaml index 0964ab659..eb5bfc69b 100644 --- a/kogito-trusty-redis-image.yaml +++ b/kogito-trusty-redis-image.yaml @@ -9,7 +9,7 @@ labels: - name: "org.kie.kogito.version" value: "2.0.0-SNAPSHOT" - name: "maintainer" - value: "kogito " + value: "Apache KIE " - name: "io.k8s.description" value: "Runtime image for Kogito Trusty Service for Redis persistence provider" - name: "io.k8s.display-name" diff --git a/kogito-trusty-ui-image.yaml b/kogito-trusty-ui-image.yaml index b5d414945..0386231f5 100644 --- a/kogito-trusty-ui-image.yaml +++ b/kogito-trusty-ui-image.yaml @@ -9,7 +9,7 @@ labels: - name: "org.kie.kogito.version" value: "2.0.0-SNAPSHOT" - name: "maintainer" - value: "kogito " + value: "Apache KIE " - name: "io.k8s.description" value: "Runtime image for Kogito Trusty UI, manage your Business Process easily." - name: "io.k8s.display-name" diff --git a/logic-data-index-ephemeral-rhel8-image.yaml b/logic-data-index-ephemeral-rhel8-image.yaml index 0d89e1d87..9e7bf634c 100644 --- a/logic-data-index-ephemeral-rhel8-image.yaml +++ b/logic-data-index-ephemeral-rhel8-image.yaml @@ -9,7 +9,7 @@ labels: - name: "com.redhat.component" value: "openshift-serverless-1-logic-data-index-ephemeral-rhel8-container" - name: "maintainer" - value: "serverless-logic " + value: "Apache KIE " - name: "io.k8s.description" value: "Red Hat build of Runtime image for Kogito Data Index Service for ephemeral PostgreSQL persistence provider" - name: "io.k8s.display-name" diff --git a/logic-swf-builder-rhel8-image.yaml b/logic-swf-builder-rhel8-image.yaml index 10100c29e..ad674d6b3 100644 --- a/logic-swf-builder-rhel8-image.yaml +++ b/logic-swf-builder-rhel8-image.yaml @@ -16,7 +16,7 @@ labels: - name: "com.redhat.component" value: "openshift-serverless-1-logic-swf-builder-rhel8-container" - name: "maintainer" - value: "serverless-logic " + value: "Apache KIE " - name: "io.k8s.description" value: "Red Hat build of Runtime image for Kogito Serverless Workflow builder with Quarkus extensions libraries preinstalled" - name: "io.k8s.display-name" diff --git a/logic-swf-devmode-rhel8-image.yaml b/logic-swf-devmode-rhel8-image.yaml index c240e71eb..88e6e4e94 100644 --- a/logic-swf-devmode-rhel8-image.yaml +++ b/logic-swf-devmode-rhel8-image.yaml @@ -20,7 +20,7 @@ labels: - name: "com.redhat.component" value: "openshift-serverless-1-logic-swf-devmode-rhel8-container" - name: "maintainer" - value: "serverless-logic " + value: "Apache KIE " modules: repositories: diff --git a/modules/kogito-maven/3.8.x-rpm/added/configure-maven.sh b/modules/kogito-maven/3.8.x-rpm/added/configure-maven.sh index 84997daec..4fbf01fae 100644 --- a/modules/kogito-maven/3.8.x-rpm/added/configure-maven.sh +++ b/modules/kogito-maven/3.8.x-rpm/added/configure-maven.sh @@ -126,9 +126,9 @@ function ignore_maven_self_signed_certificates() { } function set_kogito_maven_repo() { - local kogito_maven_repo_url="${JBOSS_MAVEN_REPO_URL}" + local kogito_maven_repo_url="${DEFAULT_MAVEN_REPO_URL}" if [ -n "${kogito_maven_repo_url}" ]; then - sed -i.bak "s|https://repository.jboss.org/nexus/content/groups/public/|${kogito_maven_repo_url}|" "${MAVEN_SETTINGS_PATH}" + sed -i.bak "s|https://repository.apache.org/content/groups/public/|${kogito_maven_repo_url}|" "${MAVEN_SETTINGS_PATH}" fi } diff --git a/modules/kogito-maven/3.8.x-rpm/maven/settings.xml b/modules/kogito-maven/3.8.x-rpm/maven/settings.xml index 826461aa8..bf67912d2 100644 --- a/modules/kogito-maven/3.8.x-rpm/maven/settings.xml +++ b/modules/kogito-maven/3.8.x-rpm/maven/settings.xml @@ -18,9 +18,9 @@ kogito-images - jboss-public-repository-group - JBoss Public Repository Group - https://repository.jboss.org/nexus/content/groups/public/ + apache-public-repository-group + Apache Public Repository Group + https://repository.apache.org/content/groups/public/ default true @@ -36,9 +36,9 @@ - jboss-public-repository-group - JBoss Public Repository Group - https://repository.jboss.org/nexus/content/groups/public/ + apache-public-repository-group + Apache Public Repository Group + https://repository.apache.org/content/groups/public/ default true diff --git a/modules/kogito-maven/3.8.x-rpm/module.yaml b/modules/kogito-maven/3.8.x-rpm/module.yaml index 843bc5c65..479479419 100644 --- a/modules/kogito-maven/3.8.x-rpm/module.yaml +++ b/modules/kogito-maven/3.8.x-rpm/module.yaml @@ -32,9 +32,9 @@ envs: - name: "MAVEN_DOWNLOAD_OUTPUT" description: "If set to true will print the transfer logs for downloading/uploading of maven dependencies. Defaults to false" example: "true" - - name: "JBOSS_MAVEN_REPO_URL" - value: "https://repository.jboss.org/nexus/content/groups/public/" - description: "Defines the Jboss Maven repository for Kogito artifacts." + - name: "DEFAULT_MAVEN_REPO_URL" + value: "https://repository.apache.org/content/groups/public/" + description: "Defines the Default Maven repository for Kogito artifacts." - name: "MAVEN_REPO_URL" description: "Defines an extra Maven repository." example: "https://nexus.test.com/group/public" diff --git a/modules/kogito-maven/3.8.x/added/configure-maven.sh b/modules/kogito-maven/3.8.x/added/configure-maven.sh index f53617daf..0027aa01f 100644 --- a/modules/kogito-maven/3.8.x/added/configure-maven.sh +++ b/modules/kogito-maven/3.8.x/added/configure-maven.sh @@ -126,9 +126,9 @@ function ignore_maven_self_signed_certificates() { } function set_kogito_maven_repo() { - local kogito_maven_repo_url="${JBOSS_MAVEN_REPO_URL}" + local kogito_maven_repo_url="${DEFAULT_MAVEN_REPO_URL}" if [ -n "${kogito_maven_repo_url}" ]; then - sed -i.bak "s|https://repository.jboss.org/nexus/content/groups/public/|${kogito_maven_repo_url}|" "${MAVEN_SETTINGS_PATH}" + sed -i.bak "s|https://repository.apache.org/content/groups/public/|${kogito_maven_repo_url}|" "${MAVEN_SETTINGS_PATH}" fi } diff --git a/modules/kogito-maven/3.8.x/maven/settings.xml b/modules/kogito-maven/3.8.x/maven/settings.xml index 5fe723c3e..233a6a6b7 100644 --- a/modules/kogito-maven/3.8.x/maven/settings.xml +++ b/modules/kogito-maven/3.8.x/maven/settings.xml @@ -18,9 +18,9 @@ kogito-images - jboss-public-repository-group - JBoss Public Repository Group - https://repository.jboss.org/nexus/content/groups/public/ + apache-public-repository-group + Apache Public Repository Group + https://repository.apache.org/content/groups/public/ default true @@ -36,9 +36,9 @@ - jboss-public-repository-group - JBoss Public Repository Group - https://repository.jboss.org/nexus/content/groups/public/ + apache-public-repository-group + Apache Public Repository Group + https://repository.apache.org/content/groups/public/ default true diff --git a/modules/kogito-maven/3.8.x/module.yaml b/modules/kogito-maven/3.8.x/module.yaml index 0e19e6d46..147d1b652 100644 --- a/modules/kogito-maven/3.8.x/module.yaml +++ b/modules/kogito-maven/3.8.x/module.yaml @@ -32,9 +32,9 @@ envs: - name: "MAVEN_DOWNLOAD_OUTPUT" description: "If set to true will print the transfer logs for downloading/uploading of maven dependencies. Defaults to false" example: "true" - - name: "JBOSS_MAVEN_REPO_URL" - value: "https://repository.jboss.org/nexus/content/groups/public/" - description: "Defines the Jboss Maven repository for Kogito artifacts." + - name: "DEFAULT_MAVEN_REPO_URL" + value: "https://repository.apache.org/content/groups/public/" + description: "Defines the default Maven repository for Kogito artifacts." - name: "MAVEN_REPO_URL" description: "Defines an extra Maven repository." example: "https://nexus.test.com/group/public" diff --git a/modules/kogito-swf/common/scripts/added/build-app.sh b/modules/kogito-swf/common/scripts/added/build-app.sh old mode 100755 new mode 100644 diff --git a/scripts/README.md b/scripts/README.md index b11e68cfb..6b13cceba 100644 --- a/scripts/README.md +++ b/scripts/README.md @@ -50,13 +50,13 @@ Utilitary script used to retrieve all images that can be built on this repo, the the community image list: ```bash -$ python3 list-images.py +$ python list-images.py ``` And the product image list by using the `--prod` flag: ```bash -$ python3 list-images.py --prod +$ python list-images.py --prod ``` diff --git a/scripts/build-kogito-apps-components.sh b/scripts/build-kogito-apps-components.sh index d9353944b..9c77acbe7 100755 --- a/scripts/build-kogito-apps-components.sh +++ b/scripts/build-kogito-apps-components.sh @@ -2,18 +2,19 @@ # Parameters: # 1 - image name - can't be empty. # 2 - git target branch - defaults to main -# 3 - git target uri - defaults to https://github.com/kiegroup/kogito-apps.git +# 3 - git target uri - defaults to https://github.com/apache/incubator-kie-kogito-apps.git # fast fail set -e set -o pipefail -KOGITO_APPS_REPO_NAME="kogito-apps" +KOGITO_APPS_REPO_NAME="incubator-kie-kogito-apps" +KOGITO_APPS_FOLDER_NAME="kogito-apps" # Read entries before sourcing imageName="${1}" gitBranch="${2:-main}" -gitUri="${3:-https://github.com/kiegroup/kogito-apps.git}" +gitUri="${3:-https://github.com/apache/${KOGITO_APPS_REPO_NAME}.git}" contextDir="" shift $# @@ -24,7 +25,7 @@ APPS_MAVEN_OPTIONS="-Dquarkus.package.type=fast-jar -Dquarkus.build.image=false" # used for all-in-one image extended_context="" -# Fix taken from https://github.com/kiegroup/kogito-apps/pull/1762 +# Fix taken from https://github.com/apache/incubator-kie-kogito-apps/pull/1762 if [ ! -z "${CYPRESS_BINARY_URL}" ]; then export CYPRESS_INSTALL_BINARY="${CYPRESS_BINARY_URL}/cypress-9.7.0.zip" echo "Setting 'CYPRESS_INSTALL_BINARY' variable to ${CYPRESS_INSTALL_BINARY}" @@ -115,12 +116,13 @@ for ctx in ${contextDir}; do cd ${build_target_dir} echo "Using branch/tag ${gitBranch}, checking out. Temporary build dir is ${build_target_dir} and target dist is ${target_tmp_dir}" - if [ ! -d "${build_target_dir}/${KOGITO_APPS_REPO_NAME}" ]; then - git_command="git clone --single-branch --branch ${gitBranch} --depth 1 ${gitUri}" + KOGITO_APPS_DIR=${build_target_dir}/${KOGITO_APPS_FOLDER_NAME} + if [ ! -d "${KOGITO_APPS_DIR}" ]; then + git_command="git clone --single-branch --branch ${gitBranch} --depth 1 ${gitUri} ${KOGITO_APPS_DIR}" echo "cloning ${KOGITO_APPS_REPO_NAME} with the following git command: ${git_command}" eval ${git_command} fi - cd ${KOGITO_APPS_REPO_NAME} && echo "working dir `pwd`" + cd ${KOGITO_APPS_DIR} && echo "working dir `pwd`" echo "Got MAVEN_OPTIONS = ${MAVEN_OPTIONS}" mvn_command="mvn -am -pl ${ctx} package ${MAVEN_OPTIONS} -Dmaven.repo.local=${mvn_local_repo} -Dquarkus.container-image.build=false" echo "Building component(s) ${contextDir} with the following maven command [${mvn_command}]" diff --git a/scripts/common.py b/scripts/common.py index 40b8c7777..f1d669b16 100644 --- a/scripts/common.py +++ b/scripts/common.py @@ -1,4 +1,4 @@ -#!/usr/bin/python3 +#!/usr/bin/python # This script defines some common function that are used by manage-kogito-version.py and push-staging.py script @@ -319,7 +319,7 @@ def update_examples_uri_in_behave_tests(examples_uri): """ print("Set examples_uri {} in behave tests".format(examples_uri)) # pattern to get the default examples uri - pattern = re.compile(r'(https://github.com/kiegroup/kogito-examples.git)') + pattern = re.compile(r'(https://github.com/apache/incubator-kie-kogito-examples.git)') replacement = examples_uri update_in_behave_tests(pattern, replacement) @@ -361,17 +361,17 @@ def update_runtime_image_in_behave_tests(runtime_image_name, image_suffix): update_in_behave_tests(pattern, replacement) -def update_maven_repo_in_behave_tests(repo_url, replace_jboss_repository): +def update_maven_repo_in_behave_tests(repo_url, replace_default_repository): """ Update maven repository into behave tests :param repo_url: Maven repository url - :param replace_jboss_repository: Set to true if default Jboss repository needs to be overriden + :param replace_default_repository: Set to true if default repository needs to be overriden """ print("Set maven repo {} in behave tests".format(repo_url)) pattern = re.compile('\|\s*variable[\s]*\|[\s]*value[\s]*\|') env_var_key = "MAVEN_REPO_URL" - if replace_jboss_repository: - env_var_key = "JBOSS_MAVEN_REPO_URL" + if replace_default_repository: + env_var_key = "DEFAULT_MAVEN_REPO_URL" replacement = "| variable | value |\n | {} | {} |".format(env_var_key, repo_url) update_in_behave_tests(pattern, replacement) @@ -396,16 +396,16 @@ def update_maven_mirror_url_in_quarkus_plugin_behave_tests(mirror_url): "MAVEN_MIRROR_URL", mirror_url) update_in_behave_tests(pattern, replacement) -def update_maven_repo_env_value(repo_url, replace_jboss_repository, prod=False): +def update_maven_repo_env_value(repo_url, replace_default_repository, prod=False): """ Update the given maven repository value for all images/modules. :param repo_url: Maven repository url - :param replace_jboss_repository: Set to true if default Jboss repository needs to be ove + :param replace_default_repository: Set to true if default repository needs to be overidden :param prod: if the module to be updated is prod version. """ env_name = "MAVEN_REPO_URL" - if replace_jboss_repository: - env_name = "JBOSS_MAVEN_REPO_URL" + if replace_default_repository: + env_name = "DEFAULT_MAVEN_REPO_URL" update_env_value(env_name, repo_url, prod) @@ -453,29 +453,29 @@ def update_examples_uri_in_clone_repo(examples_uri): replacement = "git clone {}".format(examples_uri) update_in_file(CLONE_REPO_SCRIPT, pattern, replacement) -def update_maven_repo_in_build_config(repo_url, replace_jboss_repository): +def update_maven_repo_in_build_config(repo_url, replace_default_repository): """ Update maven repository in build config modules :param repo_url: Maven repository url - :param replace_jboss_repository: Set to true if default Jboss repository needs to be overridden + :param replace_default_repository: Set to true if default repository needs to be overridden """ maven_env_name = 'MAVEN_REPO_URL' - if replace_jboss_repository: - maven_env_name = 'JBOSS_MAVEN_REPO_URL' + if replace_default_repository: + maven_env_name = 'DEFAULT_MAVEN_REPO_URL' update_env_value_in_build_config_modules(maven_env_name, repo_url, True) -def update_maven_repo_in_setup_maven(repo_url, replace_jboss_repository): +def update_maven_repo_in_setup_maven(repo_url, replace_default_repository): """ Update maven repository into setup-maven.sh script :param repo_url: Maven repository url - :param replace_jboss_repository: Set to true if default Jboss repository needs to be overridden + :param replace_default_repository: Set to true if default repository needs to be overridden """ print("Set maven repo {} in setup-maven script".format(repo_url)) pattern = "" replacement = "" - if replace_jboss_repository: - pattern = re.compile(r'(export JBOSS_MAVEN_REPO_URL=.*)') - replacement = 'export JBOSS_MAVEN_REPO_URL="{}"'.format(repo_url) + if replace_default_repository: + pattern = re.compile(r'(export DEFAULT_MAVEN_REPO_URL=.*)') + replacement = 'export DEFAULT_MAVEN_REPO_URL="{}"'.format(repo_url) else: pattern = re.compile(r'(# export MAVEN_REPO_URL=.*)') replacement = 'export MAVEN_REPO_URL="{}"'.format(repo_url) diff --git a/scripts/list-images.py b/scripts/list-images.py index 7cfa9edee..e982d164b 100644 --- a/scripts/list-images.py +++ b/scripts/list-images.py @@ -1,4 +1,4 @@ -#!/usr/bin/python3 +#!/usr/bin/env python # Script responsible to update the tests with # Should be run from root directory of the repository diff --git a/scripts/manage-kogito-version.py b/scripts/manage-kogito-version.py index ec344bc81..346215fa4 100644 --- a/scripts/manage-kogito-version.py +++ b/scripts/manage-kogito-version.py @@ -1,4 +1,4 @@ -#!/usr/bin/python3 +#!/usr/bin/env python # This script will be responsible to help to manage kogito images and modules version, it will update all needed files # Example of usage: # # move the current version to the next one or rcX diff --git a/scripts/push-local-registry.sh b/scripts/push-local-registry.sh index 157eb11ee..79d2ca899 100644 --- a/scripts/push-local-registry.sh +++ b/scripts/push-local-registry.sh @@ -26,5 +26,5 @@ while read image; do ${BUILD_ENGINE} tag quay.io/kiegroup/${image}:${version} ${registry}/${namespace}/${image}:${version} echo "Deleting imagestream ${image} if exists `oc delete oc -n ${namespace} ${image}`" ${BUILD_ENGINE} push ${registry}/${namespace}/${image}:${version} -done <<<$(python3 scripts/list-images.py) +done <<<$(python scripts/list-images.py) diff --git a/scripts/push-staging.py b/scripts/push-staging.py index 9a95c925f..5fde35932 100644 --- a/scripts/push-staging.py +++ b/scripts/push-staging.py @@ -1,4 +1,4 @@ -#!/usr/bin/python3 +#!/usr/bin/env python # This script will be responsible to fetch the latest rc tags from each image and define the next # rc tag to avoid images get overridden. # diff --git a/scripts/retrieve_version.py b/scripts/retrieve_version.py index 64e4274c0..b1b1c7a98 100644 --- a/scripts/retrieve_version.py +++ b/scripts/retrieve_version.py @@ -1,7 +1,7 @@ -#!/usr/bin/python3 +#!/usr/bin/env python #Script responsible to update the tests with #Should be run from root directory of the repository -#Sample usage: python3 scripts/retrieve_version.py +#Sample usage: python scripts/retrieve_version.py import sys sys.dont_write_bytecode = True diff --git a/scripts/setup-maven.sh b/scripts/setup-maven.sh index 99dd300b1..5ec16cfb9 100755 --- a/scripts/setup-maven.sh +++ b/scripts/setup-maven.sh @@ -21,7 +21,7 @@ echo "Updating settings file ${maven_settings_path}" # setup maven env # Do not remove below, this can be updated by the python scripts -export JBOSS_MAVEN_REPO_URL="https://repository.jboss.org/nexus/content/groups/public/" +export DEFAULT_MAVEN_REPO_URL="https://repository.apache.org/content/groups/public/" # export MAVEN_REPO_URL= cp "${MVN_MODULE}"/maven/settings.xml "${maven_settings_path}" export MAVEN_SETTINGS_PATH="${maven_settings_path}" diff --git a/scripts/update-repository.py b/scripts/update-repository.py index 0c632d1ba..0ed9b8a2d 100644 --- a/scripts/update-repository.py +++ b/scripts/update-repository.py @@ -1,7 +1,7 @@ -#!/usr/bin/python3 +#!/usr/bin/env python #Script responsible to update the tests with #Should be run from root directory of the repository -#Sample usage: python3 scripts/update-tests.py +#Sample usage: python scripts/update-tests.py import sys sys.dont_write_bytecode = True @@ -14,8 +14,8 @@ parser = argparse.ArgumentParser(description='Update Maven information in repo from the given artifact url and ' 'version.') parser.add_argument('--repo-url', dest='repo_url', help='Defines the url of the repository to setup into the tests') - parser.add_argument('--replace-jboss-repo', dest='replace_jboss_repo', default=False, action='store_true', - help='Enable if repo-url should replace the main JBoss repository') + parser.add_argument('--replace-default-repo', dest='replace_default_repo', default=False, action='store_true', + help='Enable if repo-url should replace the default repository') parser.add_argument('--ignore-self-signed-cert', dest='ignore_self_signed_cert', default=False, action='store_true', help='If set to true will relax the SSL for user-generated self-signed certificates') @@ -41,11 +41,11 @@ args = parser.parse_args() if args.repo_url: - common.update_maven_repo_in_build_config(args.repo_url, args.replace_jboss_repo) - common.update_maven_repo_in_setup_maven(args.repo_url, args.replace_jboss_repo) - common.update_maven_repo_in_behave_tests(args.repo_url, args.replace_jboss_repo) + common.update_maven_repo_in_build_config(args.repo_url, args.replace_default_repo) + common.update_maven_repo_in_setup_maven(args.repo_url, args.replace_default_repo) + common.update_maven_repo_in_behave_tests(args.repo_url, args.replace_default_repo) if not args.tests_only: - common.update_maven_repo_env_value(args.repo_url, args.replace_jboss_repo, args.prod) + common.update_maven_repo_env_value(args.repo_url, args.replace_default_repo, args.prod) if args.ignore_self_signed_cert: common.ignore_maven_self_signed_certificate_in_build_config() diff --git a/tests/features/common-build-runtime.feature b/tests/features/common-build-runtime.feature index 9a1568507..f7a7bf7b6 100644 --- a/tests/features/common-build-runtime.feature +++ b/tests/features/common-build-runtime.feature @@ -6,5 +6,5 @@ Feature: Common tests for Kogito builder and runtime images Scenario: Verify if usage help is correctly called - When container is started with command /home/kogito/kogito-app-launch.sh -h + When container is started with command bash -c "sleep 5s; /home/kogito/kogito-app-launch.sh -h" Then container log should contain This is the diff --git a/tests/features/common-custom-truststore.feature b/tests/features/common-custom-truststore.feature index 32d7a40d8..b0d9ff3d9 100644 --- a/tests/features/common-custom-truststore.feature +++ b/tests/features/common-custom-truststore.feature @@ -18,7 +18,7 @@ @openshift-serverless-1-tech-preview/logic-data-index-ephemeral-rhel8 Feature: Common tests for Custom TrustStore configuration Scenario: Verify if a custom certificate is correctly handled - When container is started with command /home/kogito/kogito-app-launch.sh + When container is started with command bash -c "sleep 5s; /home/kogito/kogito-app-launch.sh" | variable | value | | CUSTOM_TRUSTSTORE | my-truststore.jks | | RUNTIME_TYPE | quarkus | diff --git a/tests/features/common-dynamic-resources.feature b/tests/features/common-dynamic-resources.feature index 92cb56dd5..35790b997 100644 --- a/tests/features/common-dynamic-resources.feature +++ b/tests/features/common-dynamic-resources.feature @@ -24,6 +24,7 @@ Feature: Common tests for Kogito images Scenario: Verify if the properties were correctly set using DEFAULT MEM RATIO When container is started with args | arg | value | + | command | bash -c "sleep 5s; /home/kogito/kogito-app-launch.sh" | | mem_limit | 1073741824 | | env_json | {"SCRIPT_DEBUG":"true", "JAVA_MAX_MEM_RATIO": 80, "JAVA_INITIAL_MEM_RATIO": 25} | Then container log should match regex -Xms205m @@ -32,6 +33,7 @@ Feature: Common tests for Kogito images Scenario: Verify if the DEFAULT MEM RATIO properties are overridden with different values When container is started with args | arg | value | + | command | bash -c "sleep 5s; /home/kogito/kogito-app-launch.sh" | | mem_limit | 1073741824 | | env_json | {"SCRIPT_DEBUG":"true", "JAVA_MAX_MEM_RATIO": 50, "JAVA_INITIAL_MEM_RATIO": 10} | Then container log should match regex -Xms51m @@ -39,23 +41,24 @@ Feature: Common tests for Kogito images Scenario: Verify if the properties were correctly set when aren't passed When container is started with args - | arg | value | - | mem_limit | 1073741824 | - | env_json | {"SCRIPT_DEBUG":"true"} | + | arg | value | + | command | bash -c "sleep 5s; /home/kogito/kogito-app-launch.sh" | + | mem_limit | 1073741824 | + | env_json | {"SCRIPT_DEBUG":"true"} | Then container log should match regex -Xms128m And container log should match regex -Xmx512m Scenario: Verify if Java Remote Debug is correctly configured - When container is started with env - | variable | value | - | SCRIPT_DEBUG | true | - | JAVA_DEBUG | true | - | JAVA_DEBUG_PORT | 9222 | + When container is started with args + | arg | value | + | command | bash -c "sleep 5s; /home/kogito/kogito-app-launch.sh" | + | env_json | {"SCRIPT_DEBUG":"true", "JAVA_DEBUG":"true", "JAVA_DEBUG_PORT":"9222"} | Then container log should match regex -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=9222 Scenario: Verify if the DEFAULT MEM RATIO properties are overridden with different values from user provided Xmx and Xms When container is started with args | arg | value | + | command | bash -c "sleep 5s; /home/kogito/kogito-app-launch.sh" | | mem_limit | 1073741824 | | env_json | {"SCRIPT_DEBUG":"true", "JAVA_MAX_MEM_RATIO": 50, "JAVA_INITIAL_MEM_RATIO": 10, "JAVA_OPTIONS":"-Xms4000m -Xmx8000m"} | Then container log should match regex -Xms4000m diff --git a/tests/features/data-index/kogito-data-index-ephemeral.feature b/tests/features/data-index/kogito-data-index-ephemeral.feature index a57d1941a..965bad01f 100644 --- a/tests/features/data-index/kogito-data-index-ephemeral.feature +++ b/tests/features/data-index/kogito-data-index-ephemeral.feature @@ -3,7 +3,7 @@ Feature: Kogito-data-index ephemeral postgresql feature. Scenario: verify if all labels are correctly set on kogito-data-index-ephemeral image Given image is built - Then the image should contain label maintainer with value kogito + Then the image should contain label maintainer with value Apache KIE And the image should contain label io.openshift.expose-services with value 8080:http And the image should contain label io.k8s.description with value Runtime image for Kogito Data Index Service for ephemeral PostgreSQL persistence provider And the image should contain label io.k8s.display-name with value Kogito Data Index Service - ephemeral PostgreSQL diff --git a/tests/features/data-index/kogito-data-index-infinispan.feature b/tests/features/data-index/kogito-data-index-infinispan.feature index a33e5ac87..399530742 100644 --- a/tests/features/data-index/kogito-data-index-infinispan.feature +++ b/tests/features/data-index/kogito-data-index-infinispan.feature @@ -3,7 +3,7 @@ Feature: Kogito-data-index infinispan feature. Scenario: verify if all labels are correctly set on kogito-data-index-infinispan image Given image is built - Then the image should contain label maintainer with value kogito + Then the image should contain label maintainer with value Apache KIE And the image should contain label io.openshift.expose-services with value 8080:http And the image should contain label io.k8s.description with value Runtime image for Kogito Data Index Service for Infinispan persistence provider And the image should contain label io.k8s.display-name with value Kogito Data Index Service - Infinispan diff --git a/tests/features/data-index/kogito-data-index-mongodb.feature b/tests/features/data-index/kogito-data-index-mongodb.feature index d130b8c43..10578dc94 100644 --- a/tests/features/data-index/kogito-data-index-mongodb.feature +++ b/tests/features/data-index/kogito-data-index-mongodb.feature @@ -3,7 +3,7 @@ Feature: Kogito-data-index mongodb feature. Scenario: verify if all labels are correctly set on kogito-data-index-mongodb image Given image is built - Then the image should contain label maintainer with value kogito + Then the image should contain label maintainer with value Apache KIE And the image should contain label io.openshift.expose-services with value 8080:http And the image should contain label io.k8s.description with value Runtime image for Kogito Data Index Service for Mongodb persistence provider And the image should contain label io.k8s.display-name with value Kogito Data Index Service - Mongodb diff --git a/tests/features/data-index/kogito-data-index-oracle.feature b/tests/features/data-index/kogito-data-index-oracle.feature index c24c39696..9cac42d0b 100644 --- a/tests/features/data-index/kogito-data-index-oracle.feature +++ b/tests/features/data-index/kogito-data-index-oracle.feature @@ -3,7 +3,7 @@ Feature: Kogito-data-index oracle feature. Scenario: verify if all labels are correctly set on kogito-data-index-oracle image Given image is built - Then the image should contain label maintainer with value kogito + Then the image should contain label maintainer with value Apache KIE And the image should contain label io.openshift.expose-services with value 8080:http And the image should contain label io.k8s.description with value Runtime image for Kogito Data Index Service for Oracle persistence provider And the image should contain label io.k8s.display-name with value Kogito Data Index Service - Oracle diff --git a/tests/features/data-index/kogito-data-index-postgresql.feature b/tests/features/data-index/kogito-data-index-postgresql.feature index ddd0b7618..2d3a1da77 100644 --- a/tests/features/data-index/kogito-data-index-postgresql.feature +++ b/tests/features/data-index/kogito-data-index-postgresql.feature @@ -3,7 +3,7 @@ Feature: Kogito-data-index postgresql feature. Scenario: verify if all labels are correctly set on kogito-data-index-postgresql image Given image is built - Then the image should contain label maintainer with value kogito + Then the image should contain label maintainer with value Apache KIE And the image should contain label io.openshift.expose-services with value 8080:http And the image should contain label io.k8s.description with value Runtime image for Kogito Data Index Service for PostgreSQL persistence provider And the image should contain label io.k8s.display-name with value Kogito Data Index Service - PostgreSQL diff --git a/tests/features/jobs-service/kogito-jobs-service-all-in-one.feature b/tests/features/jobs-service/kogito-jobs-service-all-in-one.feature index 3693143e7..636c458fb 100644 --- a/tests/features/jobs-service/kogito-jobs-service-all-in-one.feature +++ b/tests/features/jobs-service/kogito-jobs-service-all-in-one.feature @@ -3,7 +3,7 @@ Feature: Kogito-jobs-service-all-in-one feature. Scenario: verify if all labels are correctly set kogito-jobs-service image image Given image is built - Then the image should contain label maintainer with value kogito + Then the image should contain label maintainer with value Apache KIE And the image should contain label io.openshift.expose-services with value 8080:http And the image should contain label io.k8s.description with value Runtime image for Kogito Jobs Service with all available jdbc providers And the image should contain label io.k8s.display-name with value Kogito Jobs Service All-in-One diff --git a/tests/features/jobs-service/kogito-jobs-service-ephemeral.feature b/tests/features/jobs-service/kogito-jobs-service-ephemeral.feature index 53cd99f1f..a6658a4b9 100644 --- a/tests/features/jobs-service/kogito-jobs-service-ephemeral.feature +++ b/tests/features/jobs-service/kogito-jobs-service-ephemeral.feature @@ -3,7 +3,7 @@ Feature: Kogito-jobs-service-ephemeral feature. Scenario: verify if all labels are correctly set kogito-jobs-service image image Given image is built - Then the image should contain label maintainer with value kogito + Then the image should contain label maintainer with value Apache KIE And the image should contain label io.openshift.expose-services with value 8080:http And the image should contain label io.k8s.description with value Runtime image for Kogito in memory Jobs Service And the image should contain label io.k8s.display-name with value Kogito in memory Jobs Service diff --git a/tests/features/jobs-service/kogito-jobs-service-infinispan.feature b/tests/features/jobs-service/kogito-jobs-service-infinispan.feature index 684122643..3c235a53d 100644 --- a/tests/features/jobs-service/kogito-jobs-service-infinispan.feature +++ b/tests/features/jobs-service/kogito-jobs-service-infinispan.feature @@ -3,7 +3,7 @@ Feature: Kogito-jobs-service-infinispan feature. Scenario: verify if all labels are correctly set kogito-jobs-service image image Given image is built - Then the image should contain label maintainer with value kogito + Then the image should contain label maintainer with value Apache KIE And the image should contain label io.openshift.expose-services with value 8080:http And the image should contain label io.k8s.description with value Runtime image for Kogito Jobs Service based on Infinispan And the image should contain label io.k8s.display-name with value Kogito Jobs Service based on Infinispan diff --git a/tests/features/jobs-service/kogito-jobs-service-mongodb.feature b/tests/features/jobs-service/kogito-jobs-service-mongodb.feature index 277e82602..3642f616c 100644 --- a/tests/features/jobs-service/kogito-jobs-service-mongodb.feature +++ b/tests/features/jobs-service/kogito-jobs-service-mongodb.feature @@ -3,7 +3,7 @@ Feature: Kogito-jobs-service-mongodb feature. Scenario: verify if all labels are correctly set kogito-jobs-service image image Given image is built - Then the image should contain label maintainer with value kogito + Then the image should contain label maintainer with value Apache KIE And the image should contain label io.openshift.expose-services with value 8080:http And the image should contain label io.k8s.description with value Runtime image for Kogito Jobs Service based on MongoDB And the image should contain label io.k8s.display-name with value Kogito Jobs Service based on MongoDB diff --git a/tests/features/jobs-service/kogito-jobs-service-postgresql.feature b/tests/features/jobs-service/kogito-jobs-service-postgresql.feature index bb05ad254..2b89a2807 100644 --- a/tests/features/jobs-service/kogito-jobs-service-postgresql.feature +++ b/tests/features/jobs-service/kogito-jobs-service-postgresql.feature @@ -3,7 +3,7 @@ Feature: Kogito-jobs-service-postgresql feature. Scenario: verify if all labels are correctly set kogito-jobs-service image image Given image is built - Then the image should contain label maintainer with value kogito + Then the image should contain label maintainer with value Apache KIE And the image should contain label io.openshift.expose-services with value 8080:http And the image should contain label io.k8s.description with value Runtime image for Kogito Jobs Service based on Postgresql And the image should contain label io.k8s.display-name with value Kogito Jobs Service based on Postgresql diff --git a/tests/features/kogito-common-builder-jvm.feature b/tests/features/kogito-common-builder-jvm.feature index f405feb73..50ccacfd6 100644 --- a/tests/features/kogito-common-builder-jvm.feature +++ b/tests/features/kogito-common-builder-jvm.feature @@ -8,7 +8,7 @@ Feature: kogito-s2i-builder image JVM build tests And run sh -c 'echo $JAVA_HOME' in container and immediately check its output for /usr/lib/jvm/java-11 Scenario: Verify if the s2i build is finished as expected with non native build and no runtime image - Given s2i build https://github.com/kiegroup/kogito-examples.git from kogito-quarkus-examples/rules-quarkus-helloworld using nightly-main + Given s2i build https://github.com/apache/incubator-kie-kogito-examples.git from kogito-quarkus-examples/rules-quarkus-helloworld using nightly-main | variable | value | | NATIVE | false | | RUNTIME_TYPE | quarkus | @@ -26,7 +26,7 @@ Feature: kogito-s2i-builder image JVM build tests And file /home/kogito/cacerts should exist Scenario: Verify if the s2i build is finished as expected with non native build and no runtime image and no RUNTIME_TYPE defined - Given s2i build https://github.com/kiegroup/kogito-examples.git from kogito-quarkus-examples/rules-quarkus-helloworld using nightly-main + Given s2i build https://github.com/apache/incubator-kie-kogito-examples.git from kogito-quarkus-examples/rules-quarkus-helloworld using nightly-main | variable | value | | NATIVE | false | Then check that page is served @@ -43,7 +43,7 @@ Feature: kogito-s2i-builder image JVM build tests And file /home/kogito/cacerts should exist Scenario: Verify if the s2i build is finished as expected performing a non native build with runtime image - Given s2i build https://github.com/kiegroup/kogito-examples.git from kogito-quarkus-examples/rules-quarkus-helloworld using nightly-main and runtime-image quay.io/kiegroup/kogito-runtime-jvm:latest + Given s2i build https://github.com/apache/incubator-kie-kogito-examples.git from kogito-quarkus-examples/rules-quarkus-helloworld using nightly-main and runtime-image quay.io/kiegroup/kogito-runtime-jvm:latest | variable | value | | NATIVE | false | | RUNTIME_TYPE | quarkus | @@ -78,7 +78,7 @@ Feature: kogito-s2i-builder image JVM build tests And file /home/kogito/bin/quarkus-run.jar should exist Scenario: Verify if the multi-module s2i build is finished as expected performing a non native build - Given s2i build https://github.com/kiegroup/kogito-examples.git from . using nightly-main and runtime-image quay.io/kiegroup/kogito-runtime-jvm:latest + Given s2i build https://github.com/apache/incubator-kie-kogito-examples.git from . using nightly-main and runtime-image quay.io/kiegroup/kogito-runtime-jvm:latest | variable | value | | RUNTIME_TYPE | quarkus | | NATIVE | false | @@ -96,11 +96,11 @@ Feature: kogito-s2i-builder image JVM build tests And file /home/kogito/bin/quarkus-run.jar should exist Scenario: Perform an incremental s2i build using quarkus runtime type - Given s2i build https://github.com/kiegroup/kogito-examples.git from kogito-quarkus-examples/rules-quarkus-helloworld with env and incremental using nightly-main + Given s2i build https://github.com/apache/incubator-kie-kogito-examples.git from kogito-quarkus-examples/rules-quarkus-helloworld with env and incremental using nightly-main | variable | value | | RUNTIME_TYPE | quarkus | | NATIVE | false | - And s2i build https://github.com/kiegroup/kogito-examples.git from kogito-quarkus-examples/rules-quarkus-helloworld with env and incremental using nightly-main + And s2i build https://github.com/apache/incubator-kie-kogito-examples.git from kogito-quarkus-examples/rules-quarkus-helloworld with env and incremental using nightly-main | variable | value | | RUNTIME_TYPE | quarkus | | NATIVE | false | @@ -120,7 +120,7 @@ Feature: kogito-s2i-builder image JVM build tests #### SpringBoot Scenarios Scenario: Verify if the s2i build is finished as expected with debug enabled - Given s2i build https://github.com/kiegroup/kogito-examples.git from kogito-springboot-examples/process-springboot-example using nightly-main and runtime-image quay.io/kiegroup/kogito-runtime-jvm:latest + Given s2i build https://github.com/apache/incubator-kie-kogito-examples.git from kogito-springboot-examples/process-springboot-example using nightly-main and runtime-image quay.io/kiegroup/kogito-runtime-jvm:latest | variable | value | | RUNTIME_TYPE | springboot | | JAVA_OPTIONS | -Ddebug=true | @@ -138,7 +138,7 @@ Feature: kogito-s2i-builder image JVM build tests And run sh -c 'echo $JAVA_OPTIONS' in container and immediately check its output for -Ddebug=true Scenario: Verify if the s2i build is finished as expected with no runtime image and debug enabled - Given s2i build https://github.com/kiegroup/kogito-examples.git from kogito-springboot-examples/process-springboot-example using nightly-main + Given s2i build https://github.com/apache/incubator-kie-kogito-examples.git from kogito-springboot-examples/process-springboot-example using nightly-main | variable | value | | JAVA_OPTIONS | -Ddebug=true | | RUNTIME_TYPE | springboot | @@ -173,7 +173,7 @@ Feature: kogito-s2i-builder image JVM build tests And container log should contain Tomcat initialized with port(s): 8080 (http) Scenario: Verify if the s2i build is finished as expected using multi-module build with debug enabled - Given s2i build https://github.com/kiegroup/kogito-examples.git from . using nightly-main and runtime-image quay.io/kiegroup/kogito-runtime-jvm:latest + Given s2i build https://github.com/apache/incubator-kie-kogito-examples.git from . using nightly-main and runtime-image quay.io/kiegroup/kogito-runtime-jvm:latest | variable | value | | JAVA_OPTIONS | -Ddebug=true | | RUNTIME_TYPE | springboot | @@ -193,11 +193,11 @@ Feature: kogito-s2i-builder image JVM build tests And run sh -c 'echo $JAVA_OPTIONS' in container and immediately check its output for -Ddebug=true Scenario: Perform an incremental s2i build using springboot runtime type - Given s2i build https://github.com/kiegroup/kogito-examples.git from kogito-springboot-examples/process-springboot-example with env and incremental using nightly-main + Given s2i build https://github.com/apache/incubator-kie-kogito-examples.git from kogito-springboot-examples/process-springboot-example with env and incremental using nightly-main # Leave those here as placeholder for scripts adding variable to the test. No impact on tests if empty. | variable | value | | RUNTIME_TYPE | springboot | - And s2i build https://github.com/kiegroup/kogito-examples.git from kogito-springboot-examples/process-springboot-example with env and incremental using nightly-main + And s2i build https://github.com/apache/incubator-kie-kogito-examples.git from kogito-springboot-examples/process-springboot-example with env and incremental using nightly-main # Leave those here as placeholder for scripts adding variable to the test. No impact on tests if empty. | variable | value | | RUNTIME_TYPE | springboot | @@ -215,7 +215,7 @@ Feature: kogito-s2i-builder image JVM build tests | expected_status_code | 201 | Scenario: Verify if the s2i build is finished as expected with uber-jar package type built - Given s2i build https://github.com/kiegroup/kogito-examples.git from kogito-quarkus-examples/process-quarkus-example using nightly-main and runtime-image quay.io/kiegroup/kogito-runtime-jvm:latest + Given s2i build https://github.com/apache/incubator-kie-kogito-examples.git from kogito-quarkus-examples/process-quarkus-example using nightly-main and runtime-image quay.io/kiegroup/kogito-runtime-jvm:latest | variable | value | | MAVEN_ARGS_APPEND | -Dquarkus.package.type=uber-jar | | RUNTIME_TYPE | quarkus | diff --git a/tests/features/kogito-explainability.feature b/tests/features/kogito-explainability.feature index b7a75697b..ba997ebd4 100644 --- a/tests/features/kogito-explainability.feature +++ b/tests/features/kogito-explainability.feature @@ -3,7 +3,7 @@ Feature: Kogito-explainability feature. Scenario: verify if all labels are correctly set on kogito-explainability image Given image is built - Then the image should contain label maintainer with value kogito + Then the image should contain label maintainer with value Apache KIE And the image should contain label io.openshift.expose-services with value 8080:http And the image should contain label io.k8s.description with value Runtime image for Kogito Explainability Service And the image should contain label io.k8s.display-name with value Kogito Explainability Service diff --git a/tests/features/kogito-jit-runner.feature b/tests/features/kogito-jit-runner.feature index a38ada64d..bb5b21e4d 100644 --- a/tests/features/kogito-jit-runner.feature +++ b/tests/features/kogito-jit-runner.feature @@ -3,7 +3,7 @@ Feature: Kogito-jit-runner feature. Scenario: verify if all labels are correctly set on kogito-jit-runner image Given image is built - Then the image should contain label maintainer with value kogito + Then the image should contain label maintainer with value Apache KIE And the image should contain label io.openshift.expose-services with value 8080:http And the image should contain label io.k8s.description with value Runtime image for Kogito JIT Runner And the image should contain label io.k8s.display-name with value Kogito JIT Runner diff --git a/tests/features/kogito-management-console.feature b/tests/features/kogito-management-console.feature index 7be4652ce..ad3aaef74 100644 --- a/tests/features/kogito-management-console.feature +++ b/tests/features/kogito-management-console.feature @@ -3,7 +3,7 @@ Feature: kogito-management-console feature Scenario: verify if all labels are correctly set kogito-management-console image Given image is built - Then the image should contain label maintainer with value kogito + Then the image should contain label maintainer with value Apache KIE And the image should contain label io.openshift.expose-services with value 8080:http And the image should contain label io.k8s.description with value Runtime image for Kogito Management Console, manage your Business Process easily. And the image should contain label io.k8s.display-name with value Kogito Management Console diff --git a/tests/features/kogito-runtime-jvm.feature b/tests/features/kogito-runtime-jvm.feature index ed1302388..98732c802 100644 --- a/tests/features/kogito-runtime-jvm.feature +++ b/tests/features/kogito-runtime-jvm.feature @@ -3,7 +3,7 @@ Feature: kogito-runtime-jvm feature. Scenario: verify if all labels are correctly set on kogito-runtime-jvm image Given image is built - Then the image should contain label maintainer with value kogito + Then the image should contain label maintainer with value Apache KIE And the image should contain label io.openshift.s2i.scripts-url with value image:///usr/local/s2i And the image should contain label io.openshift.s2i.destination with value /tmp And the image should contain label io.openshift.expose-services with value 8080:http diff --git a/tests/features/kogito-runtime-native.feature b/tests/features/kogito-runtime-native.feature index 1cf48122a..314881aba 100644 --- a/tests/features/kogito-runtime-native.feature +++ b/tests/features/kogito-runtime-native.feature @@ -3,7 +3,7 @@ Feature: Kogito-runtime-native feature. Scenario: verify if all labels are correctly set on kogito-runtime-native image Given image is built - Then the image should contain label maintainer with value kogito + Then the image should contain label maintainer with value Apache KIE And the image should contain label io.openshift.s2i.scripts-url with value image:///usr/local/s2i And the image should contain label io.openshift.s2i.destination with value /tmp And the image should contain label io.openshift.expose-services with value 8080:http diff --git a/tests/features/kogito-s2i-builder-native.feature b/tests/features/kogito-s2i-builder-native.feature index 62a3a19f3..d5e78cc6d 100644 --- a/tests/features/kogito-s2i-builder-native.feature +++ b/tests/features/kogito-s2i-builder-native.feature @@ -15,7 +15,7 @@ Feature: kogito-s2i-builder image native build tests And run sh -c 'echo $GRAALVM_VERSION' in container and immediately check its output for 22.3.2 Scenario: Verify if the s2i build is finished as expected using native build and runtime image - Given s2i build https://github.com/kiegroup/kogito-examples.git from kogito-quarkus-examples/rules-quarkus-helloworld using nightly-main and runtime-image quay.io/kiegroup/kogito-runtime-native:latest + Given s2i build https://github.com/apache/incubator-kie-kogito-examples.git from kogito-quarkus-examples/rules-quarkus-helloworld using nightly-main and runtime-image quay.io/kiegroup/kogito-runtime-native:latest | variable | value | | NATIVE | true | | RUNTIME_TYPE | quarkus | @@ -33,7 +33,7 @@ Feature: kogito-s2i-builder image native build tests And s2i build log should contain -J-Xmx2576980378 Scenario: Verify if the s2i build is finished as expected using native build and no runtime image - Given s2i build https://github.com/kiegroup/kogito-examples.git from kogito-quarkus-examples/rules-quarkus-helloworld using nightly-main + Given s2i build https://github.com/apache/incubator-kie-kogito-examples.git from kogito-quarkus-examples/rules-quarkus-helloworld using nightly-main | variable | value | | NATIVE | true | | RUNTIME_TYPE | quarkus | @@ -71,7 +71,7 @@ Feature: kogito-s2i-builder image native build tests And s2i build log should contain -J-Xmx5153960755 Scenario: Verify if the s2i build is finished as expected performing a native build with persistence enabled - Step 1: build the application and copy to the runtime image - Given s2i build https://github.com/kiegroup/kogito-examples.git from kogito-quarkus-examples/process-quarkus-example using nightly-main and runtime-image quay.io/kiegroup/kogito-runtime-native:latest + Given s2i build https://github.com/apache/incubator-kie-kogito-examples.git from kogito-quarkus-examples/process-quarkus-example using nightly-main and runtime-image quay.io/kiegroup/kogito-runtime-native:latest | variable | value | | RUNTIME_TYPE | quarkus | | NATIVE | true | @@ -84,11 +84,11 @@ Feature: kogito-s2i-builder image native build tests And s2i build log should contain -J-Xmx5153960755 Scenario: Perform an incremental s2i build for native test - Given s2i build https://github.com/kiegroup/kogito-examples.git from kogito-quarkus-examples/rules-quarkus-helloworld with env and incremental using nightly-main + Given s2i build https://github.com/apache/incubator-kie-kogito-examples.git from kogito-quarkus-examples/rules-quarkus-helloworld with env and incremental using nightly-main | variable | value | | RUNTIME_TYPE | quarkus | | NATIVE | false | - And s2i build https://github.com/kiegroup/kogito-examples.git from kogito-quarkus-examples/rules-quarkus-helloworld with env and incremental using nightly-main + And s2i build https://github.com/apache/incubator-kie-kogito-examples.git from kogito-quarkus-examples/rules-quarkus-helloworld with env and incremental using nightly-main | variable | value | | RUNTIME_TYPE | quarkus | | NATIVE | true | diff --git a/tests/features/kogito-s2i-builder.feature b/tests/features/kogito-s2i-builder.feature index 5238f47f9..fe1cbfb84 100644 --- a/tests/features/kogito-s2i-builder.feature +++ b/tests/features/kogito-s2i-builder.feature @@ -3,7 +3,7 @@ Feature: kogito-s2i-builder image tests Scenario: verify if all labels are correctly set on kogito-s2i-builder image Given image is built - Then the image should contain label maintainer with value kogito + Then the image should contain label maintainer with value Apache KIE And the image should contain label io.openshift.s2i.scripts-url with value image:///usr/local/s2i And the image should contain label io.openshift.s2i.destination with value /tmp And the image should contain label io.openshift.expose-services with value 8080:http @@ -23,7 +23,7 @@ Feature: kogito-s2i-builder image tests And file /home/kogito/.m2/settings.xml should not contain https://maven.repository.redhat.com/techpreview/all Scenario: Verify if the s2i build is finished as expected performing a non native build with persistence enabled - Given s2i build https://github.com/kiegroup/kogito-examples.git from kogito-quarkus-examples/process-quarkus-example using nightly-main and runtime-image quay.io/kiegroup/kogito-runtime-jvm:latest + Given s2i build https://github.com/apache/incubator-kie-kogito-examples.git from kogito-quarkus-examples/process-quarkus-example using nightly-main and runtime-image quay.io/kiegroup/kogito-runtime-jvm:latest | variable | value | | NATIVE | false | | RUNTIME_TYPE | quarkus | @@ -33,7 +33,7 @@ Feature: kogito-s2i-builder image tests And s2i build log should contain '/home/kogito/bin/persons.proto' -> '/home/kogito/data/protobufs/persons.proto' Scenario: Verify if the s2i build is finished as expected with persistence enabled - Given s2i build https://github.com/kiegroup/kogito-examples.git from kogito-springboot-examples/process-springboot-example using nightly-main and runtime-image quay.io/kiegroup/kogito-runtime-jvm:latest + Given s2i build https://github.com/apache/incubator-kie-kogito-examples.git from kogito-springboot-examples/process-springboot-example using nightly-main and runtime-image quay.io/kiegroup/kogito-runtime-jvm:latest | variable | value | | MAVEN_ARGS_APPEND | -Ppersistence | | RUNTIME_TYPE | springboot | diff --git a/tests/features/kogito-task-console.feature b/tests/features/kogito-task-console.feature index 86ce99f71..78ba03764 100644 --- a/tests/features/kogito-task-console.feature +++ b/tests/features/kogito-task-console.feature @@ -3,7 +3,7 @@ Feature: kogito-task-console feature Scenario: verify if all labels are correctly set on kogito-task-console image Given image is built - Then the image should contain label maintainer with value kogito + Then the image should contain label maintainer with value Apache KIE And the image should contain label io.openshift.expose-services with value 8080:http And the image should contain label io.k8s.description with value Runtime image for Kogito Task Console, manage your Business Process easily. And the image should contain label io.k8s.display-name with value Kogito Task Console diff --git a/tests/features/openshift-serverless-logic/logic-data-index-ephemeral.feature b/tests/features/openshift-serverless-logic/logic-data-index-ephemeral.feature index 147918c4e..6f62ba9e6 100644 --- a/tests/features/openshift-serverless-logic/logic-data-index-ephemeral.feature +++ b/tests/features/openshift-serverless-logic/logic-data-index-ephemeral.feature @@ -4,7 +4,7 @@ Feature: logic-data-index-ephemeral-rhel8 feature Scenario: verify if all labels are correctly set on logic-data-index-ephemeral-rhel8 image Given image is built Then the image should contain label io.openshift.expose-services with value 8080:http - And the image should contain label maintainer with value serverless-logic + And the image should contain label maintainer with value Apache KIE And the image should contain label io.k8s.description with value Red Hat build of Runtime image for Kogito Data Index Service for ephemeral PostgreSQL persistence provider And the image should contain label io.k8s.display-name with value Red Hat build of Kogito Data Index Service - ephemeral PostgreSQL And the image should contain label io.openshift.tags with value logic-data-index,kogito,data-index,data-index-ephemeral diff --git a/tests/features/openshift-serverless-logic/logic-swf-builder.feature b/tests/features/openshift-serverless-logic/logic-swf-builder.feature index 4982cb886..8d1f847c3 100644 --- a/tests/features/openshift-serverless-logic/logic-swf-builder.feature +++ b/tests/features/openshift-serverless-logic/logic-swf-builder.feature @@ -4,7 +4,7 @@ Feature: logic-swf-builder-rhel8 feature Scenario: verify if all labels are correctly set on logic-swf-builder-rhel8 image Given image is built Then the image should contain label io.openshift.expose-services with value 8080:http - And the image should contain label maintainer with value serverless-logic + And the image should contain label maintainer with value Apache KIE And the image should contain label io.k8s.description with value Red Hat build of Runtime image for Kogito Serverless Workflow builder with Quarkus extensions libraries preinstalled And the image should contain label io.k8s.display-name with value Red Hat OpenShift Serverless Logic Builder image And the image should contain label io.openshift.tags with value logic-swf-builder,kogito,swf-builder diff --git a/tests/features/openshift-serverless-logic/logic-swf-devmode.feature b/tests/features/openshift-serverless-logic/logic-swf-devmode.feature index a69f5d166..e67a7c51f 100644 --- a/tests/features/openshift-serverless-logic/logic-swf-devmode.feature +++ b/tests/features/openshift-serverless-logic/logic-swf-devmode.feature @@ -4,7 +4,7 @@ Feature: logic-swf-devmode-rhel8 feature Scenario: verify if all labels are correctly set on logic-swf-devmode-rhel8 image Given image is built Then the image should contain label io.openshift.expose-services with value 8080:http,5005:http - And the image should contain label maintainer with value serverless-logic + And the image should contain label maintainer with value Apache KIE And the image should contain label io.k8s.description with value Red Hat build of Kogito Serverless Workflow development mode image with Quarkus extensions libraries preinstalled. And the image should contain label io.k8s.display-name with value Red Hat OpenShift Serverless Logic SWF Devmode And the image should contain label io.openshift.tags with value logic,devmode,kogito,kogito,development,serverless,workflow diff --git a/tests/features/trusty/kogito-trusty-common.feature b/tests/features/trusty/kogito-trusty-common.feature index f755568bc..ac5e551dc 100644 --- a/tests/features/trusty/kogito-trusty-common.feature +++ b/tests/features/trusty/kogito-trusty-common.feature @@ -3,7 +3,8 @@ @quay.io/kiegroup/kogito-trusty-postgresql Feature: Kogito-trusty common feature. Scenario: Scenario: Verify if the debug is correctly enabled and test default http port - When container is started with env - | variable | value | - | SCRIPT_DEBUG | true | + When container is started with args + | arg | value | + | command | bash -c "sleep 5s; /home/kogito/kogito-app-launch.sh" | + | env_json | {"SCRIPT_DEBUG":"true"} | Then container log should contain -Dtrusty.explainability.enabled=true -Djava.library.path=/home/kogito/lib -Dquarkus.http.host=0.0.0.0 -Dquarkus.http.port=8080 diff --git a/tests/features/trusty/kogito-trusty-infinispan.feature b/tests/features/trusty/kogito-trusty-infinispan.feature index a5d8d140f..dbf213ec9 100644 --- a/tests/features/trusty/kogito-trusty-infinispan.feature +++ b/tests/features/trusty/kogito-trusty-infinispan.feature @@ -3,7 +3,7 @@ Feature: Kogito-trusty infinispan feature. Scenario: verify if all labels are correctly set on kogito-trusty-infinispan image Given image is built - Then the image should contain label maintainer with value kogito + Then the image should contain label maintainer with value Apache KIE And the image should contain label io.openshift.expose-services with value 8080:http And the image should contain label io.k8s.description with value Runtime image for Kogito Trusty Service for Infinispan persistence provider And the image should contain label io.k8s.display-name with value Kogito Trusty Service - Infinispan diff --git a/tests/features/trusty/kogito-trusty-postgresql.feature b/tests/features/trusty/kogito-trusty-postgresql.feature index 829f255e8..a2224fbcd 100644 --- a/tests/features/trusty/kogito-trusty-postgresql.feature +++ b/tests/features/trusty/kogito-trusty-postgresql.feature @@ -3,7 +3,7 @@ Feature: Kogito-trusty postgresql feature. Scenario: verify if all labels are correctly set on kogito-trusty-postgresql image Given image is built - Then the image should contain label maintainer with value kogito + Then the image should contain label maintainer with value Apache KIE And the image should contain label io.openshift.expose-services with value 8080:http And the image should contain label io.k8s.description with value Runtime image for Kogito Trusty Service for PostgreSQL persistence provider And the image should contain label io.k8s.display-name with value Kogito Trusty Service - PostgreSQL diff --git a/tests/features/trusty/kogito-trusty-redis.feature b/tests/features/trusty/kogito-trusty-redis.feature index a093a8862..f39b831e8 100644 --- a/tests/features/trusty/kogito-trusty-redis.feature +++ b/tests/features/trusty/kogito-trusty-redis.feature @@ -3,7 +3,7 @@ Feature: Kogito-trusty redis feature. Scenario: verify if all labels are correctly set on kogito-trusty-redis image Given image is built - Then the image should contain label maintainer with value kogito + Then the image should contain label maintainer with value Apache KIE And the image should contain label io.openshift.expose-services with value 8080:http And the image should contain label io.k8s.description with value Runtime image for Kogito Trusty Service for Redis persistence provider And the image should contain label io.k8s.display-name with value Kogito Trusty Service - Redis diff --git a/tests/features/trusty/kogito-trusty-ui.feature b/tests/features/trusty/kogito-trusty-ui.feature index 3d1e875d9..1aa3a978c 100644 --- a/tests/features/trusty/kogito-trusty-ui.feature +++ b/tests/features/trusty/kogito-trusty-ui.feature @@ -3,7 +3,7 @@ Feature: kogito-trusty-ui feature Scenario: verify if all labels are correctly set on kogito-trusty-ui image Given image is built - Then the image should contain label maintainer with value kogito + Then the image should contain label maintainer with value Apache KIE And the image should contain label io.openshift.expose-services with value 8080:http And the image should contain label io.k8s.description with value Runtime image for Kogito Trusty UI, manage your Business Process easily. And the image should contain label io.k8s.display-name with value Kogito Trusty UI diff --git a/tests/test-apps/clone-repo.sh b/tests/test-apps/clone-repo.sh index f39a94bf0..4feb39f3e 100755 --- a/tests/test-apps/clone-repo.sh +++ b/tests/test-apps/clone-repo.sh @@ -3,12 +3,15 @@ # Clone the kogito-examples and edit the rules-quarkus-helloworld and dmn-quarkus-example for testing purposes # if image name is supporting services, don't build it IMAGE_NAME="$2" +KOGITO_EXAMPLES_REPO_NAME='incubator-kie-kogito-examples' +KOGITO_EXAMPLES_FOLDER_NAME='kogito-examples' # many tests rely on location /tmp/kogito-examples + prod="" if [ -n "${IMAGE_NAME}" ]; then if [[ ${IMAGE_NAME} =~ rhpam|logic* ]]; then prod="--prod" fi - if python3 ../../scripts/list-images.py ${prod} -is ${IMAGE_NAME}; then + if python ../../scripts/list-images.py ${prod} -is ${IMAGE_NAME}; then echo "Target image is supporting services, skipping examples build" exit 0 fi @@ -34,16 +37,16 @@ fi set -e # Clone examples -cd /tmp -rm -rf kogito-examples/ -git clone https://github.com/kiegroup/kogito-examples.git -cd kogito-examples/ +KOGITO_EXAMPLES_DIR=/tmp/${KOGITO_EXAMPLES_FOLDER_NAME} +rm -rf ${KOGITO_EXAMPLES_DIR} +git clone https://github.com/apache/${KOGITO_EXAMPLES_REPO_NAME}.git ${KOGITO_EXAMPLES_DIR} +cd ${KOGITO_EXAMPLES_DIR}/ git fetch origin git fetch origin --tags git checkout -b nightly-main # make a new copy of rules-quarkus-helloworld for native tests -cp -rv /tmp/kogito-examples/kogito-quarkus-examples/rules-quarkus-helloworld/ /tmp/kogito-examples/kogito-quarkus-examples/rules-quarkus-helloworld-native/ +cp -rv ${KOGITO_EXAMPLES_DIR}/kogito-quarkus-examples/rules-quarkus-helloworld/ ${KOGITO_EXAMPLES_DIR}/kogito-quarkus-examples/rules-quarkus-helloworld-native/ set -x @@ -53,19 +56,19 @@ mvn -f kogito-springboot-examples/process-springboot-example clean package ${MAV if [ "$NATIVE_BUILD" = 'true' ]; then mvn -f kogito-quarkus-examples/rules-quarkus-helloworld-native -Dnative clean package ${MAVEN_OPTIONS} ${MAVEN_QUARKUS_NATIVE_CONTAINER_BUILD_ARGS} - ls -lah /tmp/kogito-examples/kogito-quarkus-examples/rules-quarkus-helloworld-native/target/ + ls -lah ${KOGITO_EXAMPLES_DIR}/kogito-quarkus-examples/rules-quarkus-helloworld-native/target/ fi # preparing directory to run kogito maven archetypes tests -mkdir -pv /tmp/kogito-examples/dmn-example -cp /tmp/kogito-examples/kogito-quarkus-examples/dmn-quarkus-example/src/main/resources/* /tmp/kogito-examples/dmn-example/ +mkdir -pv ${KOGITO_EXAMPLES_DIR}/dmn-example +cp ${KOGITO_EXAMPLES_DIR}/kogito-quarkus-examples/dmn-quarkus-example/src/main/resources/* ${KOGITO_EXAMPLES_DIR}/dmn-example/ # by adding the application.properties file telling app to start on # port 10000, the purpose of this tests is make sure that the images # will ensure the use of the port 8080. -cp ${base_dir}/application.properties /tmp/kogito-examples/kogito-quarkus-examples/rules-quarkus-helloworld/src/main/resources/META-INF/ -(echo ""; echo "server.port=10000") >> /tmp/kogito-examples/kogito-springboot-examples/process-springboot-example/src/main/resources/application.properties +cp ${base_dir}/application.properties ${KOGITO_EXAMPLES_DIR}/kogito-quarkus-examples/rules-quarkus-helloworld/src/main/resources/META-INF/ +(echo ""; echo "server.port=10000") >> ${KOGITO_EXAMPLES_DIR}/kogito-springboot-examples/process-springboot-example/src/main/resources/application.properties set +x From 45e3ff1b651dd598e60efa17897cf14c5ddeadd7 Mon Sep 17 00:00:00 2001 From: jstastny-cz Date: Mon, 11 Dec 2023 08:30:12 +0100 Subject: [PATCH 5/9] kie-issues#749: fix nightly build and tests --- .ci/jenkins/Jenkinsfile.build-and-test | 1 + .ci/jenkins/Jenkinsfile.build-image | 1 + .ci/jenkins/Jenkinsfile.deploy | 1 + .ci/jenkins/Jenkinsfile.promote | 11 +---------- scripts/common.py | 2 +- tests/features/common-custom-truststore.feature | 2 +- 6 files changed, 6 insertions(+), 12 deletions(-) diff --git a/.ci/jenkins/Jenkinsfile.build-and-test b/.ci/jenkins/Jenkinsfile.build-and-test index 4e99f9e14..c8ca99384 100644 --- a/.ci/jenkins/Jenkinsfile.build-and-test +++ b/.ci/jenkins/Jenkinsfile.build-and-test @@ -15,6 +15,7 @@ pipeline { stage('Initialization') { steps { script { + util.waitForDocker() sh 'printenv' dir(getRepoName()) { diff --git a/.ci/jenkins/Jenkinsfile.build-image b/.ci/jenkins/Jenkinsfile.build-image index 5436d77d0..deb941c33 100644 --- a/.ci/jenkins/Jenkinsfile.build-image +++ b/.ci/jenkins/Jenkinsfile.build-image @@ -28,6 +28,7 @@ pipeline { stage('Initialization') { steps { script { + util.waitForDocker() sh 'printenv' assert getBuildImageName() : 'Please provide `BUILD_IMAGE_NAME` parameter' diff --git a/.ci/jenkins/Jenkinsfile.deploy b/.ci/jenkins/Jenkinsfile.deploy index a07f52047..f87d51844 100644 --- a/.ci/jenkins/Jenkinsfile.deploy +++ b/.ci/jenkins/Jenkinsfile.deploy @@ -29,6 +29,7 @@ pipeline { stage('Initialization') { steps { script { + util.waitForDocker() currentBuild.displayName = params.DISPLAY_NAME ?: currentBuild.displayName dir(getRepoName()) { diff --git a/.ci/jenkins/Jenkinsfile.promote b/.ci/jenkins/Jenkinsfile.promote index 41c877c7c..5a9fd416c 100644 --- a/.ci/jenkins/Jenkinsfile.promote +++ b/.ci/jenkins/Jenkinsfile.promote @@ -33,11 +33,10 @@ pipeline { stage('Initialization') { steps { script { - clean() - if (params.DISPLAY_NAME) { currentBuild.displayName = params.DISPLAY_NAME } + util.waitForDocker() readDeployProperties() @@ -61,8 +60,6 @@ pipeline { dir(getRepoName()) { checkoutRepo() } - - cloud.installSkopeo() } } } @@ -141,12 +138,6 @@ void checkoutRepo() { sh "git checkout ${getBuildBranch()}" } -void clean() { - cleanWs() - util.cleanNode() - cloud.cleanSkopeo() -} - void promoteImages() { for (String imageName : getImages()) { promoteImage(getOldImageFullTag(imageName), getNewImageFullTag(imageName, getNewImageTag())) diff --git a/scripts/common.py b/scripts/common.py index f1d669b16..682a19a73 100644 --- a/scripts/common.py +++ b/scripts/common.py @@ -450,7 +450,7 @@ def update_examples_uri_in_clone_repo(examples_uri): """ print("Set examples_uri {} in clone-repo script".format(examples_uri)) pattern = re.compile(r'(git clone.*)') - replacement = "git clone {}".format(examples_uri) + replacement = "git clone {} kogito-examples".format(examples_uri) update_in_file(CLONE_REPO_SCRIPT, pattern, replacement) def update_maven_repo_in_build_config(repo_url, replace_default_repository): diff --git a/tests/features/common-custom-truststore.feature b/tests/features/common-custom-truststore.feature index b0d9ff3d9..c82cb8cc3 100644 --- a/tests/features/common-custom-truststore.feature +++ b/tests/features/common-custom-truststore.feature @@ -18,7 +18,7 @@ @openshift-serverless-1-tech-preview/logic-data-index-ephemeral-rhel8 Feature: Common tests for Custom TrustStore configuration Scenario: Verify if a custom certificate is correctly handled - When container is started with command bash -c "sleep 5s; /home/kogito/kogito-app-launch.sh" + When container is started with command bash -c "sleep 10s; /home/kogito/kogito-app-launch.sh" | variable | value | | CUSTOM_TRUSTSTORE | my-truststore.jks | | RUNTIME_TYPE | quarkus | From f00f6176eb876c24f47ecb6a155735a2868112d7 Mon Sep 17 00:00:00 2001 From: Walter Medvedeo Date: Mon, 11 Dec 2023 17:50:43 +0100 Subject: [PATCH 6/9] kie-issues-693: Update SonataFlow buidler and dev mode images to use the kogito-addons-quarkus-microprofile-config-service-catalog (#1713) --- modules/kogito-swf/builder/build-config/module.yaml | 2 +- modules/kogito-swf/devmode/build-config/module.yaml | 2 +- scripts/logic/build-quarkus-app.sh | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/modules/kogito-swf/builder/build-config/module.yaml b/modules/kogito-swf/builder/build-config/module.yaml index 1052c0375..b90ef48bc 100644 --- a/modules/kogito-swf/builder/build-config/module.yaml +++ b/modules/kogito-swf/builder/build-config/module.yaml @@ -9,4 +9,4 @@ envs: - name: QUARKUS_EXTENSIONS # NOTE: If you change the QUARKUS_EXTENSIONS value remember to update the scripts/logic/build-quarkus-app.sh too! # Follow up issue to remove KOGITO_VERSION: https://issues.redhat.com/browse/KOGITO-9270 - value: quarkus-kubernetes,kogito-quarkus-serverless-workflow,kogito-addons-quarkus-knative-eventing,smallrye-health,org.kie.kogito:kogito-addons-quarkus-fabric8-kubernetes-service-catalog:${KOGITO_VERSION},org.kie.kogito:kogito-addons-quarkus-kubernetes:${KOGITO_VERSION},org.kie.kogito:kogito-addons-quarkus-events-process:${KOGITO_VERSION},org.kie.kogito:kogito-addons-quarkus-process-management:${KOGITO_VERSION},org.kie.kogito:kogito-addons-quarkus-source-files:${KOGITO_VERSION} + value: quarkus-kubernetes,kogito-quarkus-serverless-workflow,kogito-addons-quarkus-knative-eventing,smallrye-health,org.kie.kogito:kogito-addons-quarkus-microprofile-config-service-catalog:${KOGITO_VERSION},org.kie.kogito:kogito-addons-quarkus-kubernetes:${KOGITO_VERSION},org.kie.kogito:kogito-addons-quarkus-events-process:${KOGITO_VERSION},org.kie.kogito:kogito-addons-quarkus-process-management:${KOGITO_VERSION},org.kie.kogito:kogito-addons-quarkus-source-files:${KOGITO_VERSION} diff --git a/modules/kogito-swf/devmode/build-config/module.yaml b/modules/kogito-swf/devmode/build-config/module.yaml index beead2079..740e48b4f 100644 --- a/modules/kogito-swf/devmode/build-config/module.yaml +++ b/modules/kogito-swf/devmode/build-config/module.yaml @@ -9,4 +9,4 @@ envs: - name: QUARKUS_EXTENSIONS # NOTE: If you change the QUARKUS_EXTENSIONS value remember to update the scripts/logic/build-quarkus-app.sh too! # Follow up issue to remove KOGITO_VERSION: https://issues.redhat.com/browse/KOGITO-9270 - value: kogito-quarkus-serverless-workflow,kogito-addons-quarkus-knative-eventing,smallrye-health,kogito-quarkus-serverless-workflow-devui,kogito-addons-quarkus-source-files,kogito-addons-quarkus-process-management,kogito-addons-quarkus-jobs-service-embedded,kogito-addons-quarkus-data-index-inmemory,org.kie.kogito:kogito-addons-quarkus-fabric8-kubernetes-service-catalog:${KOGITO_VERSION},org.kie.kogito:kogito-addons-quarkus-kubernetes:${KOGITO_VERSION} + value: kogito-quarkus-serverless-workflow,kogito-addons-quarkus-knative-eventing,smallrye-health,kogito-quarkus-serverless-workflow-devui,kogito-addons-quarkus-source-files,kogito-addons-quarkus-process-management,kogito-addons-quarkus-jobs-service-embedded,kogito-addons-quarkus-data-index-inmemory,org.kie.kogito:kogito-addons-quarkus-microprofile-config-service-catalog:${KOGITO_VERSION},org.kie.kogito:kogito-addons-quarkus-kubernetes:${KOGITO_VERSION} diff --git a/scripts/logic/build-quarkus-app.sh b/scripts/logic/build-quarkus-app.sh index 83b39479a..8f127f0ee 100755 --- a/scripts/logic/build-quarkus-app.sh +++ b/scripts/logic/build-quarkus-app.sh @@ -25,7 +25,7 @@ properties_with_versions=("compiler-plugin.version:3.11.0" "surefire-plugin.vers # arch specific dependencies quarkus_extensions_arch_specific="com.aayushatharva.brotli4j:native-linux-aarch64:1.8.0" # common extensions used by the kogito-swf-builder and kogito-swf-devmode -quarkus_extensions="quarkus-kubernetes,kogito-quarkus-serverless-workflow,kogito-addons-quarkus-knative-eventing,smallrye-health,org.kie.kogito:kogito-addons-quarkus-fabric8-kubernetes-service-catalog:${kogito_version},org.kie.kogito:kogito-addons-quarkus-kubernetes:${kogito_version}" +quarkus_extensions="quarkus-kubernetes,kogito-quarkus-serverless-workflow,kogito-addons-quarkus-knative-eventing,smallrye-health,org.kie.kogito:kogito-addons-quarkus-microprofile-config-service-catalog:${kogito_version},org.kie.kogito:kogito-addons-quarkus-kubernetes:${kogito_version}" # dev mode purpose extensions used only by the kogito-swf-devmode kogito_swf_devmode_extensions="kogito-quarkus-serverless-workflow-devui,kogito-addons-quarkus-source-files,kogito-addons-quarkus-process-management,org.kie.kogito:kogito-addons-quarkus-jobs-service-embedded:${kogito_version},org.kie.kogito:kogito-addons-quarkus-data-index-inmemory:${kogito_version}" # builder/prod extensitons used only by the kogito-swf-builder From d0585deb142371e2580933bc221920a9481f47d5 Mon Sep 17 00:00:00 2001 From: jstastny-cz Date: Tue, 12 Dec 2023 10:55:07 +0100 Subject: [PATCH 7/9] kie-issues#759: make git clone pattern more robust --- scripts/common.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/common.py b/scripts/common.py index 682a19a73..e0659e818 100644 --- a/scripts/common.py +++ b/scripts/common.py @@ -449,8 +449,8 @@ def update_examples_uri_in_clone_repo(examples_uri): :param examples_uri: kogito-examples uri """ print("Set examples_uri {} in clone-repo script".format(examples_uri)) - pattern = re.compile(r'(git clone.*)') - replacement = "git clone {} kogito-examples".format(examples_uri) + pattern = re.compile(r'(git clone \S+)') + replacement = "git clone {}".format(examples_uri) update_in_file(CLONE_REPO_SCRIPT, pattern, replacement) def update_maven_repo_in_build_config(repo_url, replace_default_repository): From 7bb0d7704a59f4c125f7d626592a846a0df3b98e Mon Sep 17 00:00:00 2001 From: Ricardo Zanini <1538000+ricardozanini@users.noreply.github.com> Date: Tue, 12 Dec 2023 09:43:23 -0300 Subject: [PATCH 8/9] NO-ISSUE - Add exec permissions back to build-app.sh in kogito-swf common module (#1715) Signed-off-by: Ricardo Zanini --- modules/kogito-swf/common/scripts/added/build-app.sh | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 modules/kogito-swf/common/scripts/added/build-app.sh diff --git a/modules/kogito-swf/common/scripts/added/build-app.sh b/modules/kogito-swf/common/scripts/added/build-app.sh old mode 100644 new mode 100755 From b97c2a39f40f24ffa72a2da5eb56e2004e48647c Mon Sep 17 00:00:00 2001 From: Roberto Oliveira Date: Wed, 13 Dec 2023 14:47:20 +0100 Subject: [PATCH 9/9] restore .ci and .github folders to before apache migration changes --- .ci/jenkins/Jenkinsfile | 126 +++++++++--- .ci/jenkins/Jenkinsfile.build-and-test | 131 ------------- .ci/jenkins/Jenkinsfile.build-image | 99 +++++----- .ci/jenkins/Jenkinsfile.deploy | 204 ++++++++++---------- .ci/jenkins/Jenkinsfile.promote | 51 ++--- .ci/jenkins/Jenkinsfile.setup-branch | 35 ++-- .ci/jenkins/Jenkinsfile.update-prod-version | 103 ++++++++++ .ci/jenkins/dsl/jobs.groovy | 154 +++++++-------- .ci/jenkins/dsl/test.sh | 2 +- .github/workflows/jenkins-tests-PR.yml | 6 +- .github/workflows/pr-backporting.yml | 4 +- 11 files changed, 478 insertions(+), 437 deletions(-) delete mode 100644 .ci/jenkins/Jenkinsfile.build-and-test create mode 100644 .ci/jenkins/Jenkinsfile.update-prod-version diff --git a/.ci/jenkins/Jenkinsfile b/.ci/jenkins/Jenkinsfile index 3454a8403..9111c2a74 100644 --- a/.ci/jenkins/Jenkinsfile +++ b/.ci/jenkins/Jenkinsfile @@ -2,56 +2,126 @@ pipeline { agent { - label 'ubuntu' + label 'rhel8 && !built-in' + } + tools { + maven env.BUILD_MAVEN_TOOL + jdk env.BUILD_JDK_TOOL } options { - timeout(time: 240, unit: 'MINUTES') - disableConcurrentBuilds(abortPrevious: true) - skipDefaultCheckout() + timeout(time: 120, unit: 'MINUTES') } stages { - stage("Invoke build-and-test") { + stage('Initialization') { steps { script { + clean() + sh 'printenv' - List buildParams = [] - buildParams.add(string(name: 'DISPLAY_NAME', value: "PR #${CHANGE_ID}: ${CHANGE_URL}")) - buildParams.add(string(name: 'CHANGE_ID', value: CHANGE_ID)) - buildParams.add(string(name: 'CHANGE_URL', value: CHANGE_URL)) - buildParams.add(string(name: 'SOURCE_REPOSITORY', value: getChangeRepository())) - buildParams.add(string(name: 'SOURCE_AUTHOR', value: getChangeAuthor())) - buildParams.add(string(name: 'SOURCE_BRANCH', value: getChangeBranch())) - buildParams.add(string(name: 'TARGET_BRANCH', value: getChangeTarget())) - buildParams.add(string(name: 'BUILD_KOGITO_APPS_REF', value: getChangeTarget())) - // Keep executing so we can cancel all if needed - def job = build(job: "../kogito-images.build-and-test", wait: true, parameters: buildParams, propagate: false) - if (job.result != 'SUCCESS') { - if (job.result == 'UNSTABLE') { - unstable("Tests on images seems to have failed: ${job.absoluteUrl}") - } else { - error("Error building images. Please check the logs of the job: ${job.absoluteUrl}") - } + + githubscm.checkoutIfExists(getRepoName(), getChangeAuthor(), getChangeBranch(), 'kiegroup', getChangeTarget(), true) + } + } + } + stage('Validate CeKit Image and Modules descriptors') { + steps { + script { + sh ''' + curl -Ls https://github.com/kiegroup/kie-cloud-tools/releases/download/v1.3.6/cekit-image-validator-runner.tgz --output cekit-image-validator-runner.tgz + tar -xzvf cekit-image-validator-runner.tgz + chmod +x cekit-image-validator-runner + ''' + sh './cekit-image-validator-runner modules/' + getImages().each { image -> sh "./cekit-image-validator-runner ${image}-image.yaml" } + } + } + } + stage('Build & Test Images') { + steps { + script { + parallelStages = [:] + for(String image : getImages()){ + parallelStages[image] = createBuildAndTestStageClosure(image) } + parallel parallelStages } } } } + post { + always { + script { + clean() + } + } + unsuccessful { + script { + pullrequest.postComment(util.getMarkdownTestSummary(isProdCI() ? 'Prod' : 'PR', '', "${BUILD_URL}", 'GITHUB')) + } + } + } } -String getChangeAuthor() { - return pullrequest.getAuthorAndRepoForPr().split('/')[0] +void clean() { + util.cleanNode() +} + +Closure createBuildAndTestStageClosure(String image) { + return { + stage("Build&Test ${image}") { + List buildParams = [] + buildParams.add(string(name: "DISPLAY_NAME", value: "PR #${ghprbPullId} - ${image}: ${ghprbPullLink}")) + buildParams.add(string(name: 'BUILD_IMAGE_NAME', value: image)) + buildParams.add(string(name: 'SOURCE_AUTHOR', value: getChangeAuthor())) + buildParams.add(string(name: 'SOURCE_BRANCH', value: getChangeBranch())) + buildParams.add(string(name: 'TARGET_BRANCH', value: getChangeTarget())) + buildParams.add(string(name: 'BUILD_KOGITO_APPS_REF', value: getChangeTarget())) + + githubscm.prepareCommitStatusInformationForPullRequest(getRepoName(), getChangeAuthor(), getChangeBranch(), 'kiegroup', getGitAuthorCredentialsId()) + githubscm.updateGithubCommitStatus(image, 'PENDING', 'Queued', getRepoName()) + + // Keep executing so we can cancel all if needed + def job = build(job: "${getRepoName()}.build-image", wait: true, parameters: buildParams, propagate: false) + if (job.result != 'SUCCESS') { + if (job.result == 'UNSTABLE') { + unstable("Tests on ${image} seems to have failed") + } else { + error("Error building ${image}. Please check the logs of the job: ${job.absoluteUrl}") + } + } + } + } +} + +String[] getImages() { + if (env.IMAGES_LIST) { + return env.IMAGES_LIST.split(',') + } + String listCmd = 'make list' + if (isProdCI()) { + listCmd += ' arg=--prod' + } + return util.runWithPythonVirtualEnv("${listCmd} | tr '\\n' ','", 'cekit', true).trim().split(',') +} + +boolean isProdCI() { + return env.PROD_CI ? env.PROD_CI.toBoolean() : false } -String getChangeRepository() { - return pullrequest.getAuthorAndRepoForPr().split('/')[1] +String getChangeAuthor() { + return env.ghprbAuthorRepoGitUrl ? util.getGroup(env.ghprbAuthorRepoGitUrl) : (env.ghprbPullAuthorLogin ?: CHANGE_AUTHOR) } String getChangeBranch() { - return CHANGE_BRANCH + return env.ghprbSourceBranch ?: CHANGE_BRANCH } String getChangeTarget() { - return CHANGE_TARGET + return env.ghprbTargetBranch ?: CHANGE_TARGET +} + +String getRepoName() { + return env.REPO_NAME } String getGitAuthorCredentialsId() { diff --git a/.ci/jenkins/Jenkinsfile.build-and-test b/.ci/jenkins/Jenkinsfile.build-and-test deleted file mode 100644 index c8ca99384..000000000 --- a/.ci/jenkins/Jenkinsfile.build-and-test +++ /dev/null @@ -1,131 +0,0 @@ -@Library('jenkins-pipeline-shared-libraries')_ - -pipeline { - agent { - docker { - image env.AGENT_DOCKER_BUILDER_IMAGE - args env.AGENT_DOCKER_BUILDER_ARGS - } - } - options { - timeout(time: 240, unit: 'MINUTES') - skipDefaultCheckout() - } - stages { - stage('Initialization') { - steps { - script { - util.waitForDocker() - sh 'printenv' - - dir(getRepoName()) { - // TODO Test pupose - deleteDir() - githubscm.checkoutIfExists(getRepoName(), getChangeAuthor(), getChangeBranch(), 'apache', getChangeTarget(), true, credentials = [token: getGitAuthorTokenCredentialsId(), usernamePassword: getGitAuthorCredentialsId()]) - } - } - } - } - stage('Validate CeKit Image and Modules descriptors') { - steps { - script { - dir(getRepoName()) { - sh ''' - curl -Ls https://github.com/kiegroup/kie-cloud-tools/releases/download/v1.3.6/cekit-image-validator-runner.tgz --output cekit-image-validator-runner.tgz - tar -xzvf cekit-image-validator-runner.tgz - chmod +x cekit-image-validator-runner - ''' - sh './cekit-image-validator-runner modules/' - getImages().each { image -> sh "./cekit-image-validator-runner ${image}-image.yaml" } - } - } - } - } - stage('Build & Test Images') { - steps { - script { - dir(getRepoName()) { - githubscm.prepareCommitStatusInformationForPullRequest(getRepoName(), getChangeAuthor(), getChangeBranch(), 'apache', getGitAuthorCredentialsId()) - parallelStages = [:] - for(String image : getImages()){ - parallelStages[image] = createBuildAndTestStageClosure(image) - } - parallel parallelStages - } - } - } - } - } - post { - unsuccessful { - script { - pullrequest.postComment(util.getMarkdownTestSummary('PR', '', "${BUILD_URL}", 'GITHUB')) - } - } - } -} - -Closure createBuildAndTestStageClosure(String image) { - return { - stage("Build&Test ${image}") { - List buildParams = [] - buildParams.add(string(name: "DISPLAY_NAME", value: "PR #${getChangeId()} - ${image}: ${getChangeUrl()}")) - buildParams.add(string(name: 'BUILD_IMAGE_NAME', value: image)) - buildParams.add(string(name: 'SOURCE_AUTHOR', value: getChangeAuthor())) - buildParams.add(string(name: 'SOURCE_BRANCH', value: getChangeBranch())) - buildParams.add(string(name: 'TARGET_BRANCH', value: getChangeTarget())) - buildParams.add(string(name: 'BUILD_KOGITO_APPS_REF', value: getChangeTarget())) - - githubscm.updateGithubCommitStatus(image, 'PENDING', 'Queued', getRepoName()) - - // Keep executing so we can cancel all if needed - def job = build(job: 'kogito-images.build-image', wait: true, parameters: buildParams, propagate: false) - if (job.result != 'SUCCESS') { - if (job.result == 'UNSTABLE') { - unstable("Tests on ${image} seems to have failed") - } else { - error("Error building ${image}. Please check the logs of the job: ${job.absoluteUrl}") - } - } - } - } -} - -String[] getImages() { - if (env.IMAGES_LIST) { - return env.IMAGES_LIST.split(',') - } - return sh(returnStdout: true, script: "make list | tr '\\n' ','").trim().split(',') -} - -String getChangeAuthor() { - return SOURCE_AUTHOR -} - -String getChangeBranch() { - return SOURCE_BRANCH -} - -String getChangeTarget() { - return TARGET_BRANCH -} - -String getChangeId() { - return CHANGE_ID -} - -String getChangeUrl() { - return CHANGE_URL -} - -String getRepoName() { - return env.REPO_NAME -} - -String getGitAuthorCredentialsId() { - return env.GIT_AUTHOR_CREDS_ID -} - -String getGitAuthorTokenCredentialsId() { - return env.GIT_AUTHOR_TOKEN_CREDS_ID -} diff --git a/.ci/jenkins/Jenkinsfile.build-image b/.ci/jenkins/Jenkinsfile.build-image index deb941c33..2d5d323fc 100644 --- a/.ci/jenkins/Jenkinsfile.build-image +++ b/.ci/jenkins/Jenkinsfile.build-image @@ -4,22 +4,25 @@ QUAY_REGISTRY = 'quay.io' pipeline { agent { - docker { - image env.AGENT_DOCKER_BUILDER_IMAGE - args env.AGENT_DOCKER_BUILDER_ARGS - alwaysPull true - } + label 'kie-rhel8 && docker && !built-in' + } + tools { + maven env.BUILD_MAVEN_TOOL + jdk env.BUILD_JDK_TOOL } options { - timeout(time: 150, unit: 'MINUTES') - skipDefaultCheckout() + timeout(time: 120, unit: 'MINUTES') } environment { + CI = true + // Linked to node label // Use docker due to multiplatform build CONTAINER_ENGINE = 'docker' CONTAINER_ENGINE_TLS_OPTIONS = '' + OPENSHIFT_API = credentials('OPENSHIFT_API') + OPENSHIFT_REGISTRY = credentials('OPENSHIFT_REGISTRY') OPENSHIFT_CREDS_KEY = 'OPENSHIFT_CREDS' IMAGE_BUILD_PLATFORMS = 'linux/amd64,linux/arm64' @@ -28,7 +31,8 @@ pipeline { stage('Initialization') { steps { script { - util.waitForDocker() + clean() + sh 'printenv' assert getBuildImageName() : 'Please provide `BUILD_IMAGE_NAME` parameter' @@ -43,13 +47,17 @@ pipeline { checkout(githubscm.resolveRepository(getRepoName(), getSourceAuthor(), getSourceBranch(), false, getGitAuthorCredentialsId())) githubscm.prepareCommitStatusInformation(getRepoName(), getSourceAuthor(), getSourceBranch(), getGitAuthorCredentialsId()) } - githubscm.setUserConfig('robot', 'kie.apache.org', true) updateGithubCommitStatus('PENDING', 'Started') + if (isProdCI()) { + // Prod fix to be able to build the image as a community one + sh "echo '' > content_sets.yaml" + } + // Login to final registry if deploy is needed if (shouldDeployImage()) { if (isDeployImageInOpenshiftRegistry()) { - cloud.loginOpenShift(getOpenShiftAPI(), env.OPENSHIFT_CREDS_KEY) + cloud.loginOpenShift(env.OPENSHIFT_API, env.OPENSHIFT_CREDS_KEY) cloud.loginOpenshiftRegistry(env.CONTAINER_ENGINE, env.CONTAINER_ENGINE_TLS_OPTIONS ?: '') } else if (getDeployImageRegistryCredentials()) { cloud.loginContainerRegistry(getDeployImageRegistry(), getDeployImageRegistryCredentials(), env.CONTAINER_ENGINE, env.CONTAINER_ENGINE_TLS_OPTIONS ?: '') @@ -67,12 +75,12 @@ pipeline { env.MAVEN_MIRROR_URL = env.MAVEN_MIRROR_REPOSITORY // Ignore self-signed certificates if MAVEN_MIRROR_URL is defined - runPythonCommand("python scripts/update-repository.py --build-maven-mirror-url ${MAVEN_MIRROR_URL} --ignore-self-signed-cert") + runPythonCommand("python3 scripts/update-repository.py --build-maven-mirror-url ${MAVEN_MIRROR_URL} --ignore-self-signed-cert") } if (getMavenArtifactRepository()) { echo "Setup Repository url to '${getMavenArtifactRepository()}'" - runPythonCommand("python scripts/update-repository.py --repo-url ${getMavenArtifactRepository()}") + runPythonCommand("python3 scripts/update-repository.py --repo-url ${getMavenArtifactRepository()}") } } } @@ -89,7 +97,7 @@ pipeline { // echo "[WARN] Artifacts repository defined in env will override the quarkus platform URL in tests. Make sure the platform artifacts are available on that artifacts repository (you can use a maven group)" // } // // Setup quarkus platform repo configuration - // runPythonCommand("python scripts/update-repository.py --repo-url ${getQuarkusPlatformURL()} --ignore-self-signed-cert --quarkus-platform-version ${quarkusPlatformVersion}") + // runPythonCommand("python3 scripts/update-repository.py --repo-url ${getQuarkusPlatformURL()} --ignore-self-signed-cert --quarkus-platform-version ${quarkusPlatformVersion}") // } // } // } @@ -99,9 +107,8 @@ pipeline { script { updateGithubCommitStatus('PENDING', 'Build in progress') - int freePort = cloud.findFreePort() - env.localRegistryUrl = cloud.startLocalRegistry(freePort) - cloud.prepareForDockerMultiplatformBuild([env.localRegistryUrl],[cloud.getDockerIOMirrorRegistryConfig()], false) + String localRegistry = cloud.startLocalRegistry() + cloud.prepareForDockerMultiplatformBuild([localRegistry],[cloud.getDockerIOMirrorRegistryConfig()], false) // Generate the Dockerfile runPythonCommand("make build-image ${getMakeBuildImageArgs()} image_name=${getBuildImageName()} ignore_test=true ignore_tag=true build_options='--dry-run'") @@ -109,7 +116,7 @@ pipeline { // Build multiplatform from generated Dockerfile String squashMessage = "${getBuildImageName()}:${getImageVersion()} squashed" dir('target/image') { - cloud.dockerBuildMultiPlatformImages(getBuiltImageTag(), getImageBuildPlatforms(), shouldDeployImage(), squashMessage, false, true) + cloud.dockerBuildMultiPlatformImages(getBuiltImageTag(), getImageBuildPlatforms(), shouldDeployImage(), squashMessage) } } } @@ -120,6 +127,8 @@ pipeline { } steps { script { + cloud.installSkopeo() + // Make public if quay registry if (getDeployImageRegistry() == QUAY_REGISTRY) { String namespace = getDeployImageNamespace() @@ -152,7 +161,7 @@ pipeline { } steps { script { - updateTestsCommand = 'python scripts/update-repository.py --tests-only' + updateTestsCommand = 'python3 scripts/update-repository.py --tests-only' updateTestsCommand += getMavenArtifactRepository() ? " --repo-url ${getMavenArtifactRepository()}" : '' updateTestsCommand += getTestsKogitoExamplesRef() ? " --examples-ref ${getTestsKogitoExamplesRef()}" : '' updateTestsCommand += getTestsKogitoExamplesURI() ? " --examples-uri ${getTestsKogitoExamplesURI()}" : '' @@ -188,7 +197,7 @@ pipeline { unstable "Testing error(s) for image ${getBuildImageName()}" } finally { junit testResults: 'target/**/*.xml', allowEmptyResults: true - archiveArtifacts artifacts: 'target/**/*.xml, **/*.txt, **/*.log', allowEmptyArchive: true + archiveArtifacts artifacts: 'target/**/*.xml', allowEmptyArchive: true } } } @@ -198,22 +207,22 @@ pipeline { always { script { updateGithubCommitStatusFromBuildResult() - collectContainerLogs() - archiveArtifacts artifacts: '**/*-build.log, **/*.log', allowEmptyArchive: true - } - } - cleanup { - script { - cleanWs() + + clean() } } } } -void collectContainerLogs() { - sh '''#!/bin/bash - for container in $(docker container ls --format "{{.Names}}"); do echo "[$container:START]"; docker logs $container; echo "[$container:END]"; done &> containers.log - ''' +void clean() { + util.cleanNode(env.CONTAINER_ENGINE) + + cloud.cleanDockerMultiplatformBuild() + cloud.cleanLocalRegistry() + cloud.cleanSkopeo() + + // Clean Cekit cache, in case we reuse an old node + sh "rm -rf \$HOME/.cekit/cache" } String getMakeBuildImageArgs() { @@ -239,12 +248,12 @@ String getBuiltImageTag(String imageTag = '') { if (shouldDeployImage()) { return "${getDeployImageRegistry()}/${getDeployImageNamespace()}/${getFinalImageName()}:${imageTag ?: getDeployImageTag()}" } else { - return "${env.localRegistryUrl}/${getBuildImageName()}:${githubscm.getCommitHash()}" + return "localhost:5000/${getBuildImageName()}:${githubscm.getCommitHash()}" } } void runPythonCommand(String cmd, boolean stdout = false) { - return sh(returnStdout: stdout, script: cmd) + return util.runWithPythonVirtualEnv(cmd, 'cekit', stdout) } //////////////////////////////////////////////////////////////////////// @@ -260,7 +269,7 @@ String getDeployImageRegistryCredentials() { } String getDeployImageRegistry() { - return isDeployImageInOpenshiftRegistry() ? getOpenShiftRegistry() : params.DEPLOY_IMAGE_REGISTRY + return isDeployImageInOpenshiftRegistry() ? env.OPENSHIFT_REGISTRY : params.DEPLOY_IMAGE_REGISTRY } String getDeployImageNamespace() { @@ -291,22 +300,6 @@ boolean isDeployLatestTag() { // utils //////////////////////////////////////////////////////////////////////// -String getOpenShiftRegistry() { - String registry = '' - withCredentials([string(credentialsId: 'OPENSHIFT_REGISTRY', variable: 'OPENSHIFT_REGISTRY')]) { - registry = env.OPENSHIFT_REGISTRY - } - return registry -} - -String getOpenShiftAPI() { - String openShiftAPI = '' - withCredentials([string(credentialsId: 'OPENSHIFT_API', variable: 'OPENSHIFT_API')]) { - openShiftAPI = env.OPENSHIFT_API - } - return openShiftAPI -} - String getRepoName() { return env.REPO_NAME } @@ -332,11 +325,11 @@ String getTargetBranch() { } String getGitAuthorCredentialsId() { - return env.GIT_AUTHOR_CREDS_ID + return env.AUTHOR_CREDS_ID } String getGitAuthorTokenCredentialsId() { - return env.GIT_AUTHOR_TOKEN_CREDS_ID + return env.AUTHOR_TOKEN_CREDS_ID } boolean shouldDeployImage() { @@ -371,6 +364,10 @@ String getMavenArtifactRepository() { return params.MAVEN_ARTIFACTS_REPOSITORY } +boolean isProdCI() { + return env.PROD_CI ? Boolean.parseBoolean(env.PROD_CI) : false +} + String getQuarkusPlatformURL() { return params.QUARKUS_PLATFORM_URL } diff --git a/.ci/jenkins/Jenkinsfile.deploy b/.ci/jenkins/Jenkinsfile.deploy index f87d51844..99a9d88eb 100644 --- a/.ci/jenkins/Jenkinsfile.deploy +++ b/.ci/jenkins/Jenkinsfile.deploy @@ -4,37 +4,40 @@ deployProperties = [:] changesDone = false -BUILT_IMAGES = Collections.synchronizedList([]) -BUILD_FAILED_IMAGES = Collections.synchronizedList([]) -TEST_FAILED_IMAGES = Collections.synchronizedList([]) +BUILT_IMAGES = [] +BUILD_FAILED_IMAGES = [] +TEST_FAILED_IMAGES = [] pipeline { agent { - docker { - image env.AGENT_DOCKER_BUILDER_IMAGE - args env.AGENT_DOCKER_BUILDER_ARGS - } + label 'rhel8 && !built-in' + } + + // Needed for local build + tools { + maven env.BUILD_MAVEN_TOOL + jdk env.BUILD_JDK_TOOL } options { - timeout(time: 240, unit: 'MINUTES') - skipDefaultCheckout() + timeout(time: 120, unit: 'MINUTES') } environment { KOGITO_CI_EMAIL_TO = credentials("${JENKINS_EMAIL_CREDS_ID}") + + OPENSHIFT_REGISTRY = credentials('OPENSHIFT_REGISTRY') } stages { stage('Initialization') { steps { script { - util.waitForDocker() + clean() + currentBuild.displayName = params.DISPLAY_NAME ?: currentBuild.displayName - dir(getRepoName()) { - checkoutRepo() - } + checkoutRepo() if (isRelease()) { // Verify version is set and if on right release branch @@ -62,12 +65,10 @@ pipeline { } steps { script { - dir(getRepoName()) { - if (githubscm.isBranchExist('origin', getPRBranch())) { - githubscm.removeRemoteBranch('origin', getPRBranch(), getGitAuthorPushCredsId()) - } - githubscm.createBranch(getPRBranch()) + if (githubscm.isBranchExist('origin',getPRBranch())) { + githubscm.removeRemoteBranch('origin', getPRBranch()) } + githubscm.createBranch(getPRBranch()) } } } @@ -78,14 +79,12 @@ pipeline { } steps { script { - dir(getRepoName()) { - if (getQuarkusPlatformVersion()) { - sh "python scripts/update-repository.py --quarkus-platform-version ${getQuarkusPlatformVersion()}" + if (getQuarkusPlatformVersion()) { + runPythonCommand("python3 scripts/update-repository.py --quarkus-platform-version ${getQuarkusPlatformVersion()}") - commitAndPushChanges("Update Quarkus Platform version to ${getQuarkusPlatformVersion()}") - } else { - echo 'No new quarkus version given for the release. Statu quo ...' - } + commitAndPushChanges("Update Quarkus Platform version to ${getQuarkusPlatformVersion()}") + } else { + echo 'No new quarkus version given for the release. Statu quo ...' } } } @@ -97,18 +96,16 @@ pipeline { } steps { script { - dir(getRepoName()) { - versionCmd = "python scripts/manage-kogito-version.py --bump-to ${getProjectVersion()} --confirm" - if (getBuildBranch() != 'main') { - versionCmd += " --examples-ref ${!isRelease() ? 'nightly-' : ''}${getBuildBranch()}" - } - if (getKogitoArtifactsVersion()) { - versionCmd += " --artifacts-version ${getKogitoArtifactsVersion()}" - } - sh versionCmd - - commitAndPushChanges("Update project version to ${getProjectVersion()}") + versionCmd = "python3 scripts/manage-kogito-version.py --bump-to ${getProjectVersion()} --confirm" + if (getBuildBranch() != 'main') { + versionCmd += " --examples-ref ${!isRelease() ? 'nightly-' : ''}${getBuildBranch()}" + } + if (getKogitoArtifactsVersion()) { + versionCmd += " --artifacts-version ${getKogitoArtifactsVersion()}" } + runPythonCommand(versionCmd) + + commitAndPushChanges("Update project version to ${getProjectVersion()}") } } } @@ -116,15 +113,18 @@ pipeline { stage('Validate CeKit Image and Modules descriptors') { steps { script { - dir(getRepoName()) { - sh ''' - curl -Ls https://github.com/kiegroup/kie-cloud-tools/releases/download/v1.3.6/cekit-image-validator-runner.tgz --output cekit-image-validator-runner.tgz - tar -xzvf cekit-image-validator-runner.tgz - chmod +x cekit-image-validator-runner - ''' - sh './cekit-image-validator-runner modules/' - getImages().each { image -> sh "./cekit-image-validator-runner ${image}-image.yaml" } - } + sh ''' + curl -Ls https://github.com/kiegroup/kie-cloud-tools/releases/download/v1.3.6/cekit-image-validator-runner.tgz --output cekit-image-validator-runner.tgz + tar -xzvf cekit-image-validator-runner.tgz + chmod +x cekit-image-validator-runner + ''' + sh './cekit-image-validator-runner modules/' + getImages().each { image -> sh "./cekit-image-validator-runner ${image}-image.yaml" } + } + } + post { + always { + sh 'rm -rf cekit-image-validator-runner*' } } } @@ -132,13 +132,11 @@ pipeline { stage('Build, Push & Test Images') { steps { script { - dir(getRepoName()) { - parallelStages = [:] - getImages().each { image -> - parallelStages["Build&Test ${image}"] = createBuildAndTestStageClosure(image) - } - parallel parallelStages + parallelStages = [:] + getImages().each { image -> + parallelStages["Build&Test ${image}"] = createBuildAndTestStageClosure(image) } + parallel parallelStages } } post { @@ -164,39 +162,37 @@ pipeline { } steps { script { - dir(getRepoName()) { - def commitMsg = "[${getBuildBranch()}] Update Maven artifacts" - def prBody = "Generated by build ${BUILD_TAG}: ${BUILD_URL}." - if (isRelease()) { - commitMsg = "[${getBuildBranch()}] Update project version to ${getProjectVersion()}" - prBody += '\nPlease do not merge, it should be merged automatically.' - } else if (currentBuild.currentResult != 'SUCCESS') { - commitMsg += " (${currentBuild.currentResult})" - prBody += '\n\nSuccessful images:\n' - getBuiltImages().each { + def commitMsg = "[${getBuildBranch()}] Update Maven artifacts" + def prBody = "Generated by build ${BUILD_TAG}: ${BUILD_URL}." + if (isRelease()) { + commitMsg = "[${getBuildBranch()}] Update project version to ${getProjectVersion()}" + prBody += '\nPlease do not merge, it should be merged automatically.' + } else if (currentBuild.currentResult != 'SUCCESS') { + commitMsg += " (${currentBuild.currentResult})" + prBody += '\n\nSuccessful images:\n' + getBuiltImages().each { + prBody += "- ${it}\n" + } + if (getBuildFailedImages()) { + prBody += '\nBuild failures on those images:\n' + getBuildFailedImages().each { prBody += "- ${it}\n" } - if (getBuildFailedImages()) { - prBody += '\nBuild failures on those images:\n' - getBuildFailedImages().each { - prBody += "- ${it}\n" - } - } else { - prBody += '\nImages were all successfully built but some other problem occured in the pipeline execution...\n' - } - if (getTestFailedImages()) { - prBody += '\nTest failures on those images:\n' - getTestFailedImages().each { - prBody += "- ${it}\n" - } - } else { - prBody += '\nImages were all successfully built but some other problem occured in the pipeline execution...\n' + } else { + prBody += '\nImages were all successfully built but some other problem occured in the pipeline execution...\n' + } + if (getTestFailedImages()) { + prBody += '\nTest failures on those images:\n' + getTestFailedImages().each { + prBody += "- ${it}\n" } - prBody += '\nSee build url above for more information' + } else { + prBody += '\nImages were all successfully built but some other problem occured in the pipeline execution...\n' } - String prLink = githubscm.createPR(commitMsg, prBody, getBuildBranch(), getGitAuthorPushCredsId()) - deployProperties["${getRepoName()}.pr.link"] = prLink + prBody += '\nSee build url above for more information' } + String prLink = githubscm.createPR(commitMsg, prBody, getBuildBranch(), getGitAuthorCredsID()) + deployProperties["${getRepoName()}.pr.link"] = prLink } } post { @@ -228,12 +224,12 @@ pipeline { archiveArtifacts artifacts: env.PROPERTIES_FILE_NAME, allowEmptyArchive:true } } - cleanup { - cleanWs() - } unsuccessful { sendUnsuccessfulNotification() } + cleanup { + clean() + } } } @@ -257,15 +253,19 @@ String getNotificationSubject() { void checkoutRepo() { deleteDir() - checkout(githubscm.resolveRepository(getRepoName(), getGitAuthor(), getBuildBranch(), false, getGitAuthorCredsId())) + checkout(githubscm.resolveRepository(getRepoName(), getGitAuthor(), getBuildBranch(), false)) } void commitAndPushChanges(String commitMsg) { githubscm.commitChanges(commitMsg) - githubscm.pushObject('origin', getPRBranch(), getGitAuthorPushCredsId()) + githubscm.pushObject('origin', getPRBranch(), getGitAuthorCredsID()) changesDone = true } +void clean() { + util.cleanNode() +} + void createBuildAndTestStageClosure(String image) { return { stage("Build&Test ${image}") { @@ -309,15 +309,21 @@ void createBuildAndTestStageClosure(String image) { } void registerBuiltImage(String imageName) { - BUILT_IMAGES.add(imageName) + lock("${BUILD_URL} build success") { + BUILT_IMAGES.add(imageName) + } } void registerBuildFailedImage(String imageName) { - BUILD_FAILED_IMAGES.add(imageName) + lock("${BUILD_URL} build failed") { + BUILD_FAILED_IMAGES.add(imageName) + } } void registerTestFailedImage(String imageName) { - TEST_FAILED_IMAGES.add(imageName) + lock("${BUILD_URL} test failed") { + TEST_FAILED_IMAGES.add(imageName) + } } List getBuiltImages() { @@ -345,7 +351,7 @@ String getDeployImageRegistryCredentials() { } String getDeployImageRegistry() { - return isDeployImageInOpenshiftRegistry() ? getOpenShiftRegistry() : params.IMAGE_REGISTRY + return isDeployImageInOpenshiftRegistry() ? env.OPENSHIFT_REGISTRY : params.IMAGE_REGISTRY } String getDeployImageNamespace() { return isDeployImageInOpenshiftRegistry() ? 'openshift' : params.IMAGE_NAMESPACE @@ -389,12 +395,8 @@ String getGitAuthor() { return "${GIT_AUTHOR}" } -String getGitAuthorCredsId() { - return env.GIT_AUTHOR_CREDS_ID -} - -String getGitAuthorPushCredsId() { - return env.GIT_AUTHOR_PUSH_CREDS_ID +String getGitAuthorCredsID() { + return env.AUTHOR_CREDS_ID } String getPRBranch() { @@ -409,14 +411,6 @@ String getKogitoArtifactsVersion() { return params.KOGITO_ARTIFACTS_VERSION } -String getOpenShiftRegistry() { - String registry = '' - withCredentials([string(credentialsId: 'OPENSHIFT_REGISTRY', variable: 'OPENSHIFT_REGISTRY')]) { - registry = env.OPENSHIFT_REGISTRY - } - return registry -} - void setDeployPropertyIfNeeded(String key, def value) { if (value) { deployProperties[key] = value @@ -427,7 +421,11 @@ String[] getImages() { if (env.IMAGES_LIST) { return env.IMAGES_LIST.split(',') } - return sh(returnStdout: true, script: "make list | tr '\\n' ','").trim().split(',') + return runPythonCommand("make list | tr '\\n' ','", true).trim().split(',') +} + +void runPythonCommand(String cmd, boolean stdout = false) { + return util.runWithPythonVirtualEnv(cmd, 'cekit', stdout) } String getQuarkusPlatformVersion() { diff --git a/.ci/jenkins/Jenkinsfile.promote b/.ci/jenkins/Jenkinsfile.promote index 5a9fd416c..5604453da 100644 --- a/.ci/jenkins/Jenkinsfile.promote +++ b/.ci/jenkins/Jenkinsfile.promote @@ -5,22 +5,24 @@ deployProperties = [:] pipeline { agent { - docker { - image env.AGENT_DOCKER_BUILDER_IMAGE - args env.AGENT_DOCKER_BUILDER_ARGS - } + label 'rhel8 && podman && !built-in' } options { timeout(time: 120, unit: 'MINUTES') - skipDefaultCheckout() } + // parameters { + // For parameters, check into ./dsl/jobs.groovy file + // } environment { + // Static env is defined into ./dsl/jobs.groovy file + KOGITO_CI_EMAIL_TO = credentials("${JENKINS_EMAIL_CREDS_ID}") - CONTAINER_ENGINE = 'docker' - CONTAINER_ENGINE_TLS_OPTIONS = '' + // Linked to node label + CONTAINER_ENGINE = 'podman' + CONTAINER_ENGINE_TLS_OPTIONS = '--tls-verify=false' OPENSHIFT_API = credentials('OPENSHIFT_API') OPENSHIFT_REGISTRY = credentials('OPENSHIFT_REGISTRY') @@ -33,10 +35,11 @@ pipeline { stage('Initialization') { steps { script { + clean() + if (params.DISPLAY_NAME) { currentBuild.displayName = params.DISPLAY_NAME } - util.waitForDocker() readDeployProperties() @@ -60,6 +63,8 @@ pipeline { dir(getRepoName()) { checkoutRepo() } + + cloud.installSkopeo() } } } @@ -81,8 +86,8 @@ pipeline { // Merge PR String prLink = getDeployProperty("${getRepoName()}.pr.link") if (prLink) { - githubscm.mergePR(prLink, getGitAuthorPushCredsId()) - githubscm.pushObject('origin', getBuildBranch(), getGitAuthorPushCredsId()) + githubscm.mergePR(prLink, getGitAuthorCredsID()) + githubscm.pushObject('origin', getBuildBranch(), getGitAuthorCredsID()) } } } @@ -93,11 +98,11 @@ pipeline { steps { script { dir(getRepoName()) { - if (githubscm.isReleaseExist(getGitTag(), getGitAuthorCredsId())) { - githubscm.deleteReleaseAndTag(getGitTag(), getGitAuthorPushCredsId()) + if (githubscm.isReleaseExist(getGitTag(), getGitAuthorCredsID())) { + githubscm.deleteReleaseAndTag(getGitTag(), getGitAuthorCredsID()) } - githubscm.createReleaseWithGeneratedReleaseNotes(getGitTag(), getBuildBranch(), githubscm.getPreviousTagFromVersion(getGitTag()), getGitAuthorPushCredsId()) - githubscm.updateReleaseBody(getGitTag(), getGitAuthorPushCredsId()) + githubscm.createReleaseWithGeneratedReleaseNotes(getGitTag(), getBuildBranch(), githubscm.getPreviousTagFromVersion(getGitTag()), getGitAuthorCredsID()) + githubscm.updateReleaseBody(getGitTag(), getGitAuthorCredsID()) } } } @@ -133,11 +138,17 @@ String getNotificationSubject() { void checkoutRepo() { deleteDir() - checkout(githubscm.resolveRepository(getRepoName(), getGitAuthor(), getBuildBranch(), false, getGitAuthorCredsId())) + checkout(githubscm.resolveRepository(getRepoName(), getGitAuthor(), getBuildBranch(), false)) // need to manually checkout branch since on a detached branch after checkout command sh "git checkout ${getBuildBranch()}" } +void clean() { + cleanWs() + util.cleanNode() + cloud.cleanSkopeo() +} + void promoteImages() { for (String imageName : getImages()) { promoteImage(getOldImageFullTag(imageName), getNewImageFullTag(imageName, getNewImageTag())) @@ -270,12 +281,8 @@ String getGitAuthor() { return env.GIT_AUTHOR } -String getGitAuthorCredsId() { - return env.GIT_AUTHOR_CREDS_ID -} - -String getGitAuthorPushCredsId() { - return env.GIT_AUTHOR_PUSH_CREDS_ID +String getGitAuthorCredsID() { + return env.AUTHOR_CREDS_ID } boolean isQuayRegistry(String registry) { @@ -352,5 +359,5 @@ String[] getImages() { } void runPythonCommand(String cmd, boolean stdout = false) { - return sh(returnStdout: stdout, script: cmd) + return util.runWithPythonVirtualEnv(cmd, 'cekit', stdout) } diff --git a/.ci/jenkins/Jenkinsfile.setup-branch b/.ci/jenkins/Jenkinsfile.setup-branch index ea5a9cce4..9e0e4459c 100644 --- a/.ci/jenkins/Jenkinsfile.setup-branch +++ b/.ci/jenkins/Jenkinsfile.setup-branch @@ -3,18 +3,29 @@ import org.jenkinsci.plugins.workflow.libs.Library pipeline { agent { - docker { - image env.AGENT_DOCKER_BUILDER_IMAGE - args env.AGENT_DOCKER_BUILDER_ARGS - } + label 'rhel8 && podman && !built-in' + } + + // Needed for local build + tools { + maven env.BUILD_MAVEN_TOOL + jdk env.BUILD_JDK_TOOL } options { timeout(time: 120, unit: 'MINUTES') } + // parameters { + // For parameters, check into ./dsl/jobs.groovy file + // } + environment { + // Static env is defined into ./dsl/jobs.groovy file + KOGITO_CI_EMAIL_TO = credentials("${JENKINS_EMAIL_CREDS_ID}") + + JAVA_HOME = "${GRAALVM_HOME}" } stages { @@ -35,7 +46,7 @@ pipeline { steps { script { dir(getRepoName()) { - versionCmd = "python scripts/manage-kogito-version.py --bump-to ${getKogitoVersion()} --confirm" + versionCmd = "python3 scripts/manage-kogito-version.py --bump-to ${getKogitoVersion()} --confirm" versionCmd += " --examples-ref nightly-${getBuildBranch()}" if (getKogitoArtifactsVersion()) { versionCmd += " --artifacts-version ${getKogitoArtifactsVersion()}" @@ -87,7 +98,7 @@ pipeline { dir(getRepoName()) { if (githubscm.isThereAnyChanges()) { githubscm.commitChanges("[${getBuildBranch()}] Update version to ${getKogitoVersion()}") - githubscm.pushObject('origin', getBuildBranch(), getGitAuthorPushCredsId()) + githubscm.pushObject('origin', getBuildBranch(), getGitAuthorCredsID()) } else { println '[WARN] no changes to commit' } @@ -117,7 +128,7 @@ void sendUnsuccessfulNotification() { void checkoutRepo(String repository, String branch) { dir(repository) { deleteDir() - checkout(githubscm.resolveRepository(repository, getGitAuthor(), branch, false, getGitAuthorCredsId())) + checkout(githubscm.resolveRepository(repository, getGitAuthor(), branch, false)) sh "git checkout ${branch}" } } @@ -138,12 +149,8 @@ String getGitAuthor() { return "${GIT_AUTHOR}" } -String getGitAuthorCredsId() { - return "${GIT_AUTHOR_CREDS_ID}" -} - -String getGitAuthorPushCredsId() { - return "${GIT_AUTHOR_PUSH_CREDS_ID}" +String getGitAuthorCredsID() { + return "${AUTHOR_CREDS_ID}" } String getKogitoVersion() { @@ -175,5 +182,5 @@ String getCleanedReleaseNotes() { } void runPythonCommand(String cmd, boolean stdout = false) { - return sh(returnStdout: stdout, script: cmd) + return util.runWithPythonVirtualEnv(cmd, 'cekit', stdout) } \ No newline at end of file diff --git a/.ci/jenkins/Jenkinsfile.update-prod-version b/.ci/jenkins/Jenkinsfile.update-prod-version new file mode 100644 index 000000000..3d4bb28a0 --- /dev/null +++ b/.ci/jenkins/Jenkinsfile.update-prod-version @@ -0,0 +1,103 @@ +@Library('jenkins-pipeline-shared-libraries')_ + +pipeline { + agent { + label 'rhel8 && podman && !built-in' + } + + options { + timeout(time: 30, unit: 'MINUTES') + } + + // parameters { + // For parameters, check into ./dsl/jobs.groovy file + // } + + environment { + // Static env is defined into ./dsl/jobs.groovy file + + PR_BRANCH_HASH = "${util.generateHash(10)}" + } + + stages { + stage('Initialization') { + steps { + script { + assert getProdProjectVersion() + assert getJiraNumber() + + currentBuild.displayName = getProdProjectVersion() + + deleteDir() + checkout(githubscm.resolveRepository(getRepoName(), getGitAuthor(), getBuildBranch(), false)) + } + } + } + stage('Prepare for PR') { + steps { + script { + githubscm.createBranch(getPRBranch()) + } + } + } + stage('Update prod version') { + when { + expression { return getProdProjectVersion() != '' } + } + steps { + script { + sh "python3 scripts/manage-kogito-version.py --bump-to ${getProdProjectVersion()} --confirm --prod" + } + } + } + stage('Create PR') { + steps { + script { + String commitMsg = "[${getJiraNumber()}] Update product version to ${getProdProjectVersion()}" + if (githubscm.isThereAnyChanges()) { + githubscm.commitChanges(commitMsg) + } else { + error 'No update version can be done' + } + githubscm.pushObject('origin', getPRBranch(), getGitAuthorCredsID()) + String prLink = githubscm.createPR(commitMsg, 'Please review and merge', getBuildBranch(), getGitAuthorCredsID()) + + echo "Created PR ${prLink}" + } + } + } + } + post { + cleanup { + cleanWs() + } + } +} + +String getRepoName() { + return "${REPO_NAME}" +} + +String getBuildBranch() { + return "${BUILD_BRANCH_NAME}" +} + +String getGitAuthor() { + return "${GIT_AUTHOR}" +} + +String getGitAuthorCredsID() { + return env.AUTHOR_CREDS_ID +} + +String getPRBranch() { + return "${getProdProjectVersion() ?: getBuildBranch()}-${env.PR_BRANCH_HASH}" +} + +String getProdProjectVersion() { + return "${PROD_PROJECT_VERSION}" +} + +String getJiraNumber() { + return "${JIRA_NUMBER}" +} \ No newline at end of file diff --git a/.ci/jenkins/dsl/jobs.groovy b/.ci/jenkins/dsl/jobs.groovy index 656d44ec8..7ffb080f9 100644 --- a/.ci/jenkins/dsl/jobs.groovy +++ b/.ci/jenkins/dsl/jobs.groovy @@ -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/apache/incubator-kie-kogito-pipelines repository. +* The main part of Jenkins job generation is defined into the https://github.com/kiegroup/kogito-pipelines repository. * * This file is making use of shared libraries defined in -* https://github.com/apache/incubator-kie-kogito-pipelines/tree/main/dsl/seed/src/main/groovy/org/kie/jenkins/jobdsl. +* https://github.com/kiegroup/kogito-pipelines/tree/main/dsl/seed/src/main/groovy/org/kie/jenkins/jobdsl. */ import org.kie.jenkins.jobdsl.model.JobType @@ -30,6 +30,12 @@ KogitoJobUtils.createEnvironmentIntegrationBranchNightlyJob(this, 'quarkus-lts') setupDeployJob(JobType.RELEASE) setupPromoteJob(JobType.RELEASE) +if (Utils.isProductizedBranch(this)) { + setupPrJob(true) // Prod CI job + setupProdUpdateVersionJob() + setupQuarkusUpdateJob(true) // Prod CI job +} + // Update quarkus on community setupQuarkusUpdateJob() @@ -37,24 +43,43 @@ setupQuarkusUpdateJob() // Methods ///////////////////////////////////////////////////////////////// -void setupPrJob() { - setupBuildImageJob(JobType.PULL_REQUEST) - setupBuildAndTestJob(JobType.PULL_REQUEST) - - // Branch Source Plugin multibranchPipelineJob - Utils.isMainBranch(this) && KogitoJobTemplate.createPullRequestMultibranchPipelineJob(this, "${jenkins_path}/Jenkinsfile", JobType.PULL_REQUEST.getName()) +void setupPrJob(boolean isProdCI = false) { + setupBuildImageJob(JobType.PULL_REQUEST, isProdCI) + + def jobParams = JobParamsUtils.getBasicJobParams(this, 'kogito-images', JobType.PULL_REQUEST, "${jenkins_path}/Jenkinsfile", "Kogito Images${isProdCI ? ' Prod' : ''} PR check") + JobParamsUtils.setupJobParamsDefaultMavenConfiguration(this, jobParams) + jobParams.pr.putAll([ + run_only_for_branches: [ "${GIT_BRANCH}" ], + disable_status_message_error: true, + disable_status_message_failure: true, + commitContext: 'Retrieve and Launch Image Checks', + contextShowtestResults: false, + ]) + if (isProdCI) { + jobParams.job.name += '.prod' + jobParams.pr.trigger_phrase = '.*[j|J]enkins,?.*(rerun|run) [prod|Prod|PROD].*' + jobParams.pr.trigger_phrase_only = true + jobParams.pr.commitContext = '(Prod) Retrieve and Launch Image Checks' + jobParams.env.put('PROD_CI', true) + } else if (Utils.hasBindingValue(this, 'CLOUD_IMAGES')) { + jobParams.env.put('IMAGES_LIST', Utils.getBindingValue(this, 'CLOUD_IMAGES')) + } + jobParams.env.putAll([ + AUTHOR_CREDS_ID: "${GIT_AUTHOR_CREDENTIALS_ID}", + ]) + KogitoJobTemplate.createPRJob(this, jobParams) } void createSetupBranchJob() { def jobParams = JobParamsUtils.getBasicJobParams(this, 'kogito-images', JobType.SETUP_BRANCH, "${jenkins_path}/Jenkinsfile.setup-branch", 'Kogito Images Init Branch') - JobParamsUtils.setupJobParamsAgentDockerBuilderImageConfiguration(this, jobParams) + JobParamsUtils.setupJobParamsDefaultMavenConfiguration(this, jobParams) jobParams.env.putAll([ + REPO_NAME: 'kogito-images', GIT_AUTHOR: "${GIT_AUTHOR_NAME}", JENKINS_EMAIL_CREDS_ID: "${JENKINS_EMAIL_CREDS_ID}", - GIT_AUTHOR_CREDS_ID: "${GIT_AUTHOR_CREDENTIALS_ID}", - GIT_AUTHOR_PUSH_CREDS_ID: "${GIT_AUTHOR_PUSH_CREDENTIALS_ID}", + AUTHOR_CREDS_ID: "${GIT_AUTHOR_CREDENTIALS_ID}", IS_MAIN_BRANCH: "${Utils.isMainBranch(this)}" ]) @@ -77,7 +102,7 @@ void setupDeployJob(JobType jobType) { setupBuildImageJob(jobType) def jobParams = JobParamsUtils.getBasicJobParams(this, 'kogito-images-deploy', jobType, "${jenkins_path}/Jenkinsfile.deploy", 'Kogito Images Deploy') - JobParamsUtils.setupJobParamsAgentDockerBuilderImageConfiguration(this, jobParams) + JobParamsUtils.setupJobParamsDefaultMavenConfiguration(this, jobParams) jobParams.env.putAll([ PROPERTIES_FILE_NAME: 'deployment.properties', @@ -86,8 +111,8 @@ void setupDeployJob(JobType jobType) { JENKINS_EMAIL_CREDS_ID: "${JENKINS_EMAIL_CREDS_ID}", GIT_AUTHOR: "${GIT_AUTHOR_NAME}", - GIT_AUTHOR_CREDS_ID: "${GIT_AUTHOR_CREDENTIALS_ID}", - GIT_AUTHOR_PUSH_CREDS_ID: "${GIT_AUTHOR_PUSH_CREDENTIALS_ID}", + AUTHOR_CREDS_ID: "${GIT_AUTHOR_CREDENTIALS_ID}", + GITHUB_TOKEN_CREDS_ID: "${GIT_AUTHOR_TOKEN_CREDENTIALS_ID}", MAVEN_ARTIFACT_REPOSITORY: "${MAVEN_ARTIFACTS_REPOSITORY}", DEFAULT_STAGING_REPOSITORY: "${MAVEN_NEXUS_STAGING_PROFILE_URL}", @@ -114,7 +139,7 @@ void setupDeployJob(JobType jobType) { // Deploy information booleanParam('DEPLOY_IMAGE', !Utils.getBindingValue(this, 'DISABLE_DEPLOY').toBoolean(), 'Should we deploy image to given deploy registry ?') booleanParam('IMAGE_USE_OPENSHIFT_REGISTRY', false, 'Set to true if image should be deployed in Openshift registry.In this case, IMAGE_REGISTRY_CREDENTIALS, IMAGE_REGISTRY and IMAGE_NAMESPACE parameters will be ignored') - stringParam('IMAGE_REGISTRY_CREDENTIALS', "${CLOUD_IMAGE_REGISTRY_CREDENTIALS}", 'Image registry credentials to use to deploy images. Will be ignored if no IMAGE_REGISTRY is given') + stringParam('IMAGE_REGISTRY_CREDENTIALS', "${CLOUD_IMAGE_REGISTRY_CREDENTIALS_NIGHTLY}", 'Image registry credentials to use to deploy images. Will be ignored if no IMAGE_REGISTRY is given') stringParam('IMAGE_REGISTRY', "${CLOUD_IMAGE_REGISTRY}", 'Image registry to use to deploy images') stringParam('IMAGE_NAMESPACE', "${CLOUD_IMAGE_NAMESPACE}", 'Image namespace to use to deploy images') stringParam('IMAGE_NAME_SUFFIX', '', 'Image name suffix to use to deploy images. In case you need to change the final image name, you can add a suffix to it.') @@ -134,18 +159,19 @@ void setupDeployJob(JobType jobType) { } } -void setupBuildImageJob(JobType jobType) { +void setupBuildImageJob(JobType jobType, boolean prodCI = false) { def jobParams = JobParamsUtils.getBasicJobParams(this, 'kogito-images.build-image', jobType, "${jenkins_path}/Jenkinsfile.build-image", 'Kogito Images Build single image') // Use jenkinsfile from the build branch jobParams.git.author = '${SOURCE_AUTHOR}' jobParams.git.branch = '${SOURCE_BRANCH}' - JobParamsUtils.setupJobParamsAgentDockerBuilderImageConfiguration(this, jobParams) + JobParamsUtils.setupJobParamsDefaultMavenConfiguration(this, jobParams) jobParams.env.putAll([ MAX_REGISTRY_RETRIES: 3, TARGET_AUTHOR: Utils.getGitAuthor(this), // In case of a PR to merge with target branch + PROD_CI: prodCI, - GIT_AUTHOR_CREDS_ID: "${GIT_AUTHOR_CREDENTIALS_ID}", - GIT_AUTHOR_TOKEN_CREDS_ID: "${GIT_AUTHOR_TOKEN_CREDENTIALS_ID}", + AUTHOR_CREDS_ID: "${GIT_AUTHOR_CREDENTIALS_ID}", + AUTHOR_TOKEN_CREDS_ID: "${GIT_AUTHOR_TOKEN_CREDENTIALS_ID}", ]) KogitoJobTemplate.createPipelineJob(this, jobParams)?.with { logRotator { @@ -174,62 +200,7 @@ void setupBuildImageJob(JobType jobType) { // Deploy information booleanParam('DEPLOY_IMAGE', !Utils.getBindingValue(this, 'DISABLE_DEPLOY').toBoolean(), 'Should we deploy image to given deploy registry ?') booleanParam('DEPLOY_IMAGE_USE_OPENSHIFT_REGISTRY', false, 'Set to true if image should be deployed in Openshift registry.In this case, IMAGE_REGISTRY_CREDENTIALS, IMAGE_REGISTRY and IMAGE_NAMESPACE parameters will be ignored') - stringParam('DEPLOY_IMAGE_REGISTRY_CREDENTIALS', "${CLOUD_IMAGE_REGISTRY_CREDENTIALS}", 'Image registry credentials to use to deploy images. Will be ignored if no IMAGE_REGISTRY is given') - stringParam('DEPLOY_IMAGE_REGISTRY', "${CLOUD_IMAGE_REGISTRY}", 'Image registry to use to deploy images') - stringParam('DEPLOY_IMAGE_NAMESPACE', "${CLOUD_IMAGE_NAMESPACE}", 'Image namespace to use to deploy images') - stringParam('DEPLOY_IMAGE_NAME_SUFFIX', '', 'Image name suffix to use to deploy images. In case you need to change the final image name, you can add a suffix to it.') - stringParam('DEPLOY_IMAGE_TAG', '', 'Image tag to use to deploy images') - booleanParam('DEPLOY_WITH_LATEST_TAG', false, 'Set to true if you want the deployed images to also be with the `latest` tag') - } - } -} - -void setupBuildAndTestJob(JobType jobType) { - def jobParams = JobParamsUtils.getBasicJobParams(this, 'kogito-images.build-and-test', jobType, "${jenkins_path}/Jenkinsfile.build-and-test", 'Kogito Images Build And test images') - // Use jenkinsfile from the build branch - jobParams.git.author = '${SOURCE_AUTHOR}' - jobParams.git.repository = '${SOURCE_REPOSITORY}' - jobParams.git.branch = '${SOURCE_BRANCH}' - JobParamsUtils.setupJobParamsAgentDockerBuilderImageConfiguration(this, jobParams) - jobParams.env.putAll([ - MAX_REGISTRY_RETRIES: 3, - TARGET_AUTHOR: Utils.getGitAuthor(this), // In case of a PR to merge with target branch - - GIT_AUTHOR_CREDS_ID: "${GIT_AUTHOR_CREDENTIALS_ID}", - GIT_AUTHOR_TOKEN_CREDS_ID: "${GIT_AUTHOR_TOKEN_CREDENTIALS_ID}", - ]) - if (Utils.hasBindingValue(this, 'CLOUD_IMAGES')) { - jobParams.env.put('IMAGES_LIST', Utils.getBindingValue(this, 'CLOUD_IMAGES')) - } - KogitoJobTemplate.createPipelineJob(this, jobParams)?.with { - logRotator { - daysToKeep(10) - } - parameters { - stringParam('DISPLAY_NAME', '', 'Setup a specific build display name') - - stringParam('SOURCE_AUTHOR', Utils.getGitAuthor(this), 'Build author') - stringParam('SOURCE_REPOSITORY', Utils.getRepoName(this), 'Build repository name') - stringParam('SOURCE_BRANCH', Utils.getGitBranch(this), 'Build branch name') - stringParam('TARGET_BRANCH', '', '(Optional) In case of a PR to merge with target branch, please provide the target branch') - stringParam('CHANGE_ID', '', 'CHANGE_ID coming from Branch Source Plugin') - stringParam('CHANGE_URL', '', 'CHANGE_URL coming from Branch Source Plugin') - - // Build information - stringParam('MAVEN_ARTIFACTS_REPOSITORY', "${MAVEN_ARTIFACTS_REPOSITORY}") - stringParam('BUILD_KOGITO_APPS_URI', '', '(Optional) Git uri to the kogito-apps repository to use for tests.') - stringParam('BUILD_KOGITO_APPS_REF', '', '(Optional) Git reference (branch/tag) to the kogito-apps repository to use for building. Default to BUILD_BRANCH_NAME.') - stringParam('QUARKUS_PLATFORM_URL', Utils.getMavenQuarkusPlatformRepositoryUrl(this), 'URL to the Quarkus platform to use. The version to use will be guessed from artifacts.') - - // Test information - booleanParam('SKIP_TESTS', false, 'Skip tests') - stringParam('TESTS_KOGITO_EXAMPLES_URI', '', '(Optional) Git uri to the kogito-examples repository to use for tests.') - stringParam('TESTS_KOGITO_EXAMPLES_REF', '', '(Optional) Git reference (branch/tag) to the kogito-examples repository to use for tests.') - - // Deploy information - booleanParam('DEPLOY_IMAGE', false, 'Should we deploy image to given deploy registry ?') - booleanParam('DEPLOY_IMAGE_USE_OPENSHIFT_REGISTRY', false, 'Set to true if image should be deployed in Openshift registry.In this case, IMAGE_REGISTRY_CREDENTIALS, IMAGE_REGISTRY and IMAGE_NAMESPACE parameters will be ignored') - stringParam('DEPLOY_IMAGE_REGISTRY_CREDENTIALS', "${CLOUD_IMAGE_REGISTRY_CREDENTIALS}", 'Image registry credentials to use to deploy images. Will be ignored if no IMAGE_REGISTRY is given') + stringParam('DEPLOY_IMAGE_REGISTRY_CREDENTIALS', "${CLOUD_IMAGE_REGISTRY_CREDENTIALS_NIGHTLY}", 'Image registry credentials to use to deploy images. Will be ignored if no IMAGE_REGISTRY is given') stringParam('DEPLOY_IMAGE_REGISTRY', "${CLOUD_IMAGE_REGISTRY}", 'Image registry to use to deploy images') stringParam('DEPLOY_IMAGE_NAMESPACE', "${CLOUD_IMAGE_NAMESPACE}", 'Image namespace to use to deploy images') stringParam('DEPLOY_IMAGE_NAME_SUFFIX', '', 'Image name suffix to use to deploy images. In case you need to change the final image name, you can add a suffix to it.') @@ -241,8 +212,8 @@ void setupBuildAndTestJob(JobType jobType) { void setupPromoteJob(JobType jobType) { def jobParams = JobParamsUtils.getBasicJobParams(this, 'kogito-images-promote', jobType, "${jenkins_path}/Jenkinsfile.promote", 'Kogito Images Promote') - JobParamsUtils.setupJobParamsAgentDockerBuilderImageConfiguration(this, jobParams) jobParams.env.putAll([ + REPO_NAME: 'kogito-images', PROPERTIES_FILE_NAME: 'deployment.properties', MAX_REGISTRY_RETRIES: 3, @@ -251,8 +222,8 @@ void setupPromoteJob(JobType jobType) { GIT_AUTHOR: "${GIT_AUTHOR_NAME}", - GIT_AUTHOR_CREDS_ID: "${GIT_AUTHOR_CREDENTIALS_ID}", - GIT_AUTHOR_PUSH_CREDS_ID: "${GIT_AUTHOR_PUSH_CREDENTIALS_ID}", + AUTHOR_CREDS_ID: "${GIT_AUTHOR_CREDENTIALS_ID}", + GITHUB_TOKEN_CREDS_ID: "${GIT_AUTHOR_TOKEN_CREDENTIALS_ID}", DEFAULT_STAGING_REPOSITORY: "${MAVEN_NEXUS_STAGING_PROFILE_URL}", MAVEN_ARTIFACT_REPOSITORY: "${MAVEN_ARTIFACTS_REPOSITORY}", @@ -271,7 +242,7 @@ void setupPromoteJob(JobType jobType) { // Base images information which can override `deployment.properties` booleanParam('BASE_IMAGE_USE_OPENSHIFT_REGISTRY', false, 'Override `deployment.properties`. Set to true if base image should be retrieved from Openshift registry.In this case, BASE_IMAGE_REGISTRY_CREDENTIALS, BASE_IMAGE_REGISTRY and BASE_IMAGE_NAMESPACE parameters will be ignored') - stringParam('BASE_IMAGE_REGISTRY_CREDENTIALS', "${CLOUD_IMAGE_REGISTRY_CREDENTIALS}", 'Override `deployment.properties`. Base Image registry credentials to use to deploy images. Will be ignored if no BASE_IMAGE_REGISTRY is given') + stringParam('BASE_IMAGE_REGISTRY_CREDENTIALS', "${CLOUD_IMAGE_REGISTRY_CREDENTIALS_NIGHTLY}", 'Override `deployment.properties`. Base Image registry credentials to use to deploy images. Will be ignored if no BASE_IMAGE_REGISTRY is given') stringParam('BASE_IMAGE_REGISTRY', "${CLOUD_IMAGE_REGISTRY}", 'Override `deployment.properties`. Base image registry') stringParam('BASE_IMAGE_NAMESPACE', "${CLOUD_IMAGE_NAMESPACE}", 'Override `deployment.properties`. Base image namespace') stringParam('BASE_IMAGE_NAMES', '', 'Override `deployment.properties`. Comma separated list of images') @@ -280,7 +251,7 @@ void setupPromoteJob(JobType jobType) { // Promote images information booleanParam('PROMOTE_IMAGE_USE_OPENSHIFT_REGISTRY', false, 'Set to true if base image should be deployed in Openshift registry.In this case, PROMOTE_IMAGE_REGISTRY_CREDENTIALS, PROMOTE_IMAGE_REGISTRY and PROMOTE_IMAGE_NAMESPACE parameters will be ignored') - stringParam('PROMOTE_IMAGE_REGISTRY_CREDENTIALS', "${CLOUD_IMAGE_REGISTRY_CREDENTIALS}", 'Promote Image registry credentials to use to deploy images. Will be ignored if no PROMOTE_IMAGE_REGISTRY is given') + stringParam('PROMOTE_IMAGE_REGISTRY_CREDENTIALS', "${CLOUD_IMAGE_REGISTRY_CREDENTIALS_NIGHTLY}", 'Promote Image registry credentials to use to deploy images. Will be ignored if no PROMOTE_IMAGE_REGISTRY is given') stringParam('PROMOTE_IMAGE_REGISTRY', "${CLOUD_IMAGE_REGISTRY}", 'Promote image registry') stringParam('PROMOTE_IMAGE_NAMESPACE', "${CLOUD_IMAGE_NAMESPACE}", 'Promote image namespace') stringParam('PROMOTE_IMAGE_NAME_SUFFIX', '', 'Promote image name suffix') @@ -298,8 +269,27 @@ void setupPromoteJob(JobType jobType) { } } -void setupQuarkusUpdateJob() { +void setupProdUpdateVersionJob() { + def jobParams = JobParamsUtils.getBasicJobParams(this, 'kogito-images-update-prod-version', JobType.TOOLS, "${jenkins_path}/Jenkinsfile.update-prod-version", 'Update prod version for Kogito Images') + jobParams.env.putAll([ + REPO_NAME: 'kogito-images', + + BUILD_BRANCH_NAME: "${GIT_BRANCH}", + GIT_AUTHOR: "${GIT_AUTHOR_NAME}", + AUTHOR_CREDS_ID: "${GIT_AUTHOR_CREDENTIALS_ID}", + GITHUB_TOKEN_CREDS_ID: "${GIT_AUTHOR_TOKEN_CREDENTIALS_ID}", + ]) + KogitoJobTemplate.createPipelineJob(this, jobParams)?.with { + parameters { + stringParam('JIRA_NUMBER', '', 'KIECLOUD-XXX or RHPAM-YYYY or else. This will be added to the commit and PR.') + stringParam('PROD_PROJECT_VERSION', '', 'Which version to set ?') + } + } +} + +void setupQuarkusUpdateJob(boolean isProdCI = false) { + def prodFlag = isProdCI ? '--prod' : '' KogitoJobUtils.createQuarkusUpdateToolsJob(this, 'kogito-images', [:], [:], [], [ - "python scripts/update-repository.py --quarkus-platform-version %new_version%" + "source ~/virtenvs/cekit/bin/activate && python3 scripts/update-repository.py --quarkus-platform-version %new_version% ${prodFlag}" ]) } diff --git a/.ci/jenkins/dsl/test.sh b/.ci/jenkins/dsl/test.sh index 2d518eb9f..ad8af34ac 100755 --- a/.ci/jenkins/dsl/test.sh +++ b/.ci/jenkins/dsl/test.sh @@ -1,6 +1,6 @@ #!/bin/bash -e file=$(mktemp) # For more usage of the script, use ./test.sh -h -curl -o ${file} https://raw.githubusercontent.com/apache/incubator-kie-kogito-pipelines/main/dsl/seed/scripts/seed_test.sh +curl -o ${file} https://raw.githubusercontent.com/kiegroup/kogito-pipelines/main/dsl/seed/scripts/seed_test.sh chmod u+x ${file} ${file} $@ \ No newline at end of file diff --git a/.github/workflows/jenkins-tests-PR.yml b/.github/workflows/jenkins-tests-PR.yml index d9bb4083b..bf3815cbc 100644 --- a/.github/workflows/jenkins-tests-PR.yml +++ b/.github/workflows/jenkins-tests-PR.yml @@ -15,8 +15,8 @@ jobs: runs-on: ubuntu-latest steps: - name: DSL tests - uses: apache/incubator-kie-kogito-pipelines/.ci/actions/dsl-tests@main + uses: kiegroup/kie-ci/.ci/actions/dsl-tests@main with: - main-config-file-repo: apache/incubator-kie-kogito-pipelines + main-config-file-repo: kiegroup/kogito-pipelines main-config-file-path: .ci/jenkins/config/main.yaml - branch-config-file-repo: apache/incubator-kie-kogito-pipelines + branch-config-file-repo: kiegroup/kogito-pipelines diff --git a/.github/workflows/pr-backporting.yml b/.github/workflows/pr-backporting.yml index e70052457..ae52e051d 100644 --- a/.github/workflows/pr-backporting.yml +++ b/.github/workflows/pr-backporting.yml @@ -17,7 +17,7 @@ jobs: steps: - name: Set target branches id: set-targets - uses: apache/incubator-kie-kogito-pipelines/.ci/actions/parse-labels@main + uses: kiegroup/kie-ci/.ci/actions/parse-labels@main with: labels: ${LABELS} @@ -34,7 +34,7 @@ jobs: REVIEWERS: ${{ toJSON(github.event.pull_request.requested_reviewers) }} steps: - name: Backporting - uses: apache/incubator-kie-kogito-pipelines/.ci/actions/backporting@main + uses: kiegroup/kie-ci/.ci/actions/backporting@main with: target-branch: ${{ matrix.target-branch }} additional-reviewers: ${REVIEWERS} \ No newline at end of file