This is an automated email from the ASF dual-hosted git repository.
jstastnycz pushed a commit to branch main
in repository
https://gitbox.apache.org/repos/asf/incubator-kie-kogito-runtimes.git
The following commit(s) were added to refs/heads/main by this push:
new fcd5d3aecb [kie-issues#1123] adjust deploy operation (#3517)
fcd5d3aecb is described below
commit fcd5d3aecb826dc842bbead3ea338e844842356f
Author: Jan Stastny <[email protected]>
AuthorDate: Tue May 21 16:24:56 2024 +0200
[kie-issues#1123] adjust deploy operation (#3517)
* [kie-issues#1123] adjust deploy operation
* fix missing curly
---------
Co-authored-by: jstastny-cz <[email protected]>
---
.ci/jenkins/Jenkinsfile.deploy | 94 ++++-------------------------------
.ci/jenkins/Jenkinsfile.weekly.deploy | 58 ++++++++-------------
.ci/jenkins/dsl/jobs.groovy | 5 --
3 files changed, 29 insertions(+), 128 deletions(-)
diff --git a/.ci/jenkins/Jenkinsfile.deploy b/.ci/jenkins/Jenkinsfile.deploy
index f9aca3a402..795ed5f8a1 100644
--- a/.ci/jenkins/Jenkinsfile.deploy
+++ b/.ci/jenkins/Jenkinsfile.deploy
@@ -21,7 +21,6 @@ import org.jenkinsci.plugins.workflow.libs.Library
@Library('jenkins-pipeline-shared-libraries')_
import org.kie.jenkins.MavenCommand
-import org.kie.jenkins.MavenStagingHelper
deployProperties = [:]
@@ -49,7 +48,6 @@ pipeline {
KOGITO_CI_EMAIL_TO = credentials("${JENKINS_EMAIL_CREDS_ID}")
PR_BRANCH_HASH = "${util.generateHash(10)}"
- MAVEN_DEPLOY_LOCAL_DIR = "/tmp/maven_deploy_dir"
}
stages {
@@ -136,10 +134,16 @@ pipeline {
}
}
}
- stage('Build & Test') {
+ stage('Deploy kogito-runtimes') {
steps {
script {
- dir(getRepoName()) {
+ withCredentials([usernamePassword(credentialsId:
env.MAVEN_REPO_CREDS_ID, usernameVariable: 'REPOSITORY_USER', passwordVariable:
'REPOSITORY_TOKEN')]) {
+ def installOrDeploy
+ if (shouldDeployToRepository()) {
+ installOrDeploy = "deploy -DdeployAtEnd
-Dapache.repository.username=${REPOSITORY_USER}
-Dapache.repository.password=${REPOSITORY_TOKEN} -DretryFailedDeploymentCount=5"
+ } else {
+ installOrDeploy = 'install'
+ }
def mvnCmd = getMavenCommand()
.withOptions(env.BUILD_MVN_OPTS_CURRENT ? [
env.BUILD_MVN_OPTS_CURRENT ] : [])
.withOptions(env.KOGITO_RUNTIMES_BUILD_MVN_OPTS ?
[ env.KOGITO_RUNTIMES_BUILD_MVN_OPTS ] : [])
@@ -151,7 +155,7 @@ pipeline {
configFileProvider([configFile(fileId:
env.MAVEN_SETTINGS_CONFIG_FILE_ID, variable: 'MAVEN_SETTINGS_FILE')]){
mvnCmd
.withSettingsXmlFile(MAVEN_SETTINGS_FILE)
- .run('clean install')
+ .run("clean $installOrDeploy")
}
}
}
@@ -165,37 +169,6 @@ pipeline {
}
}
}
- stage('Deploy locally') {
- steps {
- script {
- dir(getRepoName()) {
- runMavenDeploy(true)
- }
- }
- }
- }
- stage('Upload artifacts to given repository') {
- when {
- expression { return !isRelease() && shouldDeployToRepository()
}
- }
- steps {
- script {
- // Deploy to specific repository with credentials
- maven.uploadLocalArtifacts(env.MAVEN_REPO_CREDS_ID,
getLocalDeploymentFolder(), getMavenRepoZipUrl())
- }
- }
- }
- stage('Stage artifacts') {
- when {
- expression { return shouldStageArtifacts() }
- }
- steps {
- script {
- // Stage release artifacts
- runMavenStage()
- }
- }
- }
stage('Create PR') {
when {
expression { return isRelease() || isCreatePr() }
@@ -268,14 +241,6 @@ void sendNotification() {
}
}
-boolean isSpecificArtifactsUpload() {
- return env.MAVEN_DEPLOY_REPOSITORY && env.MAVEN_REPO_CREDS_ID
-}
-
-boolean shouldStageArtifacts() {
- return isRelease()
-}
-
boolean shouldDeployToRepository() {
return env.MAVEN_DEPLOY_REPOSITORY && env.MAVEN_REPO_CREDS_ID &&
getGitAuthor() == 'apache'
}
@@ -335,47 +300,6 @@ MavenCommand getMavenCommand(String directory = '') {
.withProperty('full')
}
-void runMavenDeploy(boolean localDeployment = false) {
- mvnCmd = getMavenCommand()
- .withOptions(env.KOGITO_RUNTIMES_BUILD_MVN_OPTS ? [
env.KOGITO_RUNTIMES_BUILD_MVN_OPTS ] : [])
- .withOptions(env.BUILD_MVN_OPTS_CURRENT ? [
env.BUILD_MVN_OPTS_CURRENT ] : [])
-
- if (localDeployment) {
- mvnCmd.withLocalDeployFolder(getLocalDeploymentFolder())
- } else if (env.MAVEN_DEPLOY_REPOSITORY) {
- mvnCmd.withDeployRepository(env.MAVEN_DEPLOY_REPOSITORY)
- }
-
- configFileProvider([configFile(fileId: env.MAVEN_SETTINGS_CONFIG_FILE_ID,
variable: 'MAVEN_SETTINGS_FILE')]){
- mvnCmd
- .skipTests(true)
- .withSettingsXmlFile(MAVEN_SETTINGS_FILE)
- .run('clean deploy')
- }
-}
-
-String getMavenRepoZipUrl() {
- return "${env.MAVEN_DEPLOY_REPOSITORY.replaceAll('/content/',
'/service/local/').replaceFirst('/*$', '')}/content-compressed"
-}
-
-void runMavenStage() {
- configFileProvider([configFile(fileId: env.MAVEN_SETTINGS_CONFIG_FILE_ID,
variable: 'MAVEN_SETTINGS_FILE')]){
- MavenStagingHelper stagingHelper =
getStagingHelper(getMavenCommand().withSettingsXmlFile(MAVEN_SETTINGS_FILE))
-
deployProperties.putAll(stagingHelper.stageLocalArtifacts(env.NEXUS_STAGING_PROFILE_ID,
getLocalDeploymentFolder()))
-
stagingHelper.promoteStagingRepository(env.NEXUS_BUILD_PROMOTION_PROFILE_ID)
- }
-}
-
-MavenStagingHelper getStagingHelper(MavenCommand mavenCommand) {
- return new MavenStagingHelper(this, mavenCommand)
- .withNexusReleaseUrl(env.NEXUS_RELEASE_URL)
- .withNexusReleaseRepositoryId(env.NEXUS_RELEASE_REPOSITORY_ID)
-}
-
-String getLocalDeploymentFolder() {
- return "${env.MAVEN_DEPLOY_LOCAL_DIR}/${getRepoName()}"
-}
-
String getWorkflowCommonDeploymentPath() {
return
"${getRepoName()}/quarkus/extensions/kogito-quarkus-workflow-extension-common/kogito-quarkus-workflow-common-deployment"
}
diff --git a/.ci/jenkins/Jenkinsfile.weekly.deploy
b/.ci/jenkins/Jenkinsfile.weekly.deploy
index 24b9848365..e2c1b95886 100644
--- a/.ci/jenkins/Jenkinsfile.weekly.deploy
+++ b/.ci/jenkins/Jenkinsfile.weekly.deploy
@@ -101,10 +101,28 @@ pipeline {
}
}
- stage('Build & Test & Deploy locally') {
+ stage('Build & Test & Install/Deploy') {
steps {
script {
- runMavenLocalDeploy(params.SKIP_TESTS)
+ withCredentials([usernamePassword(credentialsId:
env.MAVEN_REPO_CREDS_ID, usernameVariable: 'REPOSITORY_USER', passwordVariable:
'REPOSITORY_TOKEN')]) {
+ def installOrDeploy
+ if (shouldDeployToRepository()) {
+ installOrDeploy = "deploy -DdeployAtEnd
-Dapache.repository.username=${REPOSITORY_USER}
-Dapache.repository.password=${REPOSITORY_TOKEN} -DretryFailedDeploymentCount=5"
+ } else {
+ installOrDeploy = 'install'
+ }
+ def mvnCmd =
getMavenCommand().withProperty('maven.test.failure.ignore', true)
+ .withOptions(env.BUILD_MVN_OPTS_CURRENT ? [
env.BUILD_MVN_OPTS_CURRENT ] : [])
+
.withOptions(env.KOGITO_RUNTIMES_BUILD_MVN_OPTS ? [
env.KOGITO_RUNTIMES_BUILD_MVN_OPTS ] : [])
+ if (params.SKIP_TESTS) {
+ mvnCmd.skipTests() // Conflict somehow with Python
testing. If `skipTests={anyvalue}` is set, then exec plugin is not executed ...
+ }
+ configFileProvider([configFile(fileId:
env.MAVEN_SETTINGS_CONFIG_FILE_ID, variable: 'MAVEN_SETTINGS_FILE')]){
+ mvnCmd
+ .withSettingsXmlFile(MAVEN_SETTINGS_FILE)
+ .run("clean $installOrDeploy")
+ }
+ }
}
}
post {
@@ -117,28 +135,6 @@ pipeline {
}
}
- stage('Upload artifacts to given repository') {
- when {
- expression { return shouldDeployToRepository() }
- }
- steps {
- script {
- withCredentials([usernamePassword(credentialsId:
env.MAVEN_REPO_CREDS_ID, usernameVariable: 'REPOSITORY_USER', passwordVariable:
'REPOSITORY_TOKEN')]) {
- configFileProvider([configFile(fileId:
env.MAVEN_SETTINGS_CONFIG_FILE_ID, variable: 'MAVEN_SETTINGS_FILE')]) {
- getMavenCommand()
- .withSettingsXmlFile(MAVEN_SETTINGS_FILE)
- .withProperty('wagon.source',
"file://${getLocalDeploymentFolder()}")
- .withProperty('wagon.target',
env.MAVEN_DEPLOY_REPOSITORY)
- .withProperty('wagon.targetId',
'apache-snapshots-repository')
-
.withProperty('apache.snapshot.repository.username', REPOSITORY_USER)
-
.withProperty('apache.snapshot.repository.password', REPOSITORY_TOKEN)
-
.run("org.codehaus.mojo:wagon-maven-plugin:2.0.2:merge-maven-repos")
- }
- }
- }
- }
- }
-
stage('Create and push a new tag') {
steps {
script {
@@ -237,20 +233,6 @@ MavenCommand getMavenCommand(String directory = '') {
.withProperty('full')
}
-void runMavenLocalDeploy(boolean skipTests = true) {
- mvnCmd = getMavenCommand()
- mvnCmd.withLocalDeployFolder(getLocalDeploymentFolder())
-
- configFileProvider([configFile(fileId: env.MAVEN_SETTINGS_CONFIG_FILE_ID,
variable: 'MAVEN_SETTINGS_FILE')]){
- mvnCmd.withProperty('maven.test.failure.ignore', true)
- .withOptions(env.BUILD_MVN_OPTS_CURRENT ? [
env.BUILD_MVN_OPTS_CURRENT ] : [])
- .withOptions(env.KOGITO_RUNTIMES_BUILD_MVN_OPTS ? [
env.KOGITO_RUNTIMES_BUILD_MVN_OPTS ] : [])
- //.skipTests(skipTests) // Conflict somehow with Python testing.
If `skipTests={anyvalue}` is set, then exec plugin is not executed ...
- .withSettingsXmlFile(MAVEN_SETTINGS_FILE)
- .run('clean deploy')
- }
-}
-
String getLocalDeploymentFolder() {
return "${env.MAVEN_DEPLOY_LOCAL_DIR}/${getRepoName()}"
}
diff --git a/.ci/jenkins/dsl/jobs.groovy b/.ci/jenkins/dsl/jobs.groovy
index fce2201fab..aba056af65 100644
--- a/.ci/jenkins/dsl/jobs.groovy
+++ b/.ci/jenkins/dsl/jobs.groovy
@@ -196,11 +196,6 @@ void setupReleaseDeployJob() {
MAVEN_DEPENDENCIES_REPOSITORY: "${MAVEN_ARTIFACTS_REPOSITORY}",
MAVEN_DEPLOY_REPOSITORY: "${MAVEN_ARTIFACTS_UPLOAD_REPOSITORY_URL}",
MAVEN_REPO_CREDS_ID: "${MAVEN_ARTIFACTS_UPLOAD_REPOSITORY_CREDS_ID}",
-
- NEXUS_RELEASE_URL: "${MAVEN_NEXUS_RELEASE_URL}",
- NEXUS_RELEASE_REPOSITORY_ID: "${MAVEN_NEXUS_RELEASE_REPOSITORY}",
- NEXUS_STAGING_PROFILE_ID: "${MAVEN_NEXUS_STAGING_PROFILE_ID}",
- NEXUS_BUILD_PROMOTION_PROFILE_ID:
"${MAVEN_NEXUS_BUILD_PROMOTION_PROFILE_ID}",
])
KogitoJobTemplate.createPipelineJob(this, jobParams)?.with {
parameters {
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]