Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[incubator-kie-issues#732] Refactor uploading artifacts to deploy repo #3037

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

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 26 additions & 19 deletions .ci/jenkins/Jenkinsfile.deploy
Original file line number Diff line number Diff line change
Expand Up @@ -158,39 +158,46 @@ pipeline {
}
}
}

stage('Deploy to repository') {
when {
expression { return !shouldStageArtifacts() && !isSpecificArtifactsUpload() && shouldDeployToRepository() }
}
steps {
script {
runMavenDeploy(getOptaplannerMavenCommand())
runMavenDeploy(getOptaplannerQuickstartsMavenCommand().withOptions(['-pl', ':optaplanner-distribution']))
}
}
}
stage('Deploy locally') {
when {
expression { return shouldStageArtifacts() || isSpecificArtifactsUpload() }
}
steps {
script {
runMavenDeploy(getOptaplannerMavenCommand(), optaplannerRepository)
}
}
}
stage('Upload artifacts to given repository') {
stage('Deploy to repository') {
when {
expression { return isSpecificArtifactsUpload() }
expression { return shouldDeployToRepository() }
}
steps {
script {
// Deploy to specific repository with credentials
maven.uploadLocalArtifacts(env.MAVEN_REPO_CREDS_ID, getLocalDeploymentFolder(optaplannerRepository), getMavenRepoZipUrl())
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')]) {
new MavenCommand(this)
.withSettingsXmlFile(MAVEN_SETTINGS_FILE)
.withProperty('wagon.source', "file://${getLocalDeploymentFolder(optaplannerRepository)}")
.withProperty('wagon.target', 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('Upload artifacts to given repository') {
// when {
// expression { return isSpecificArtifactsUpload() }
// }
// steps {
// script {
// // Deploy to specific repository with credentials
// maven.uploadLocalArtifacts(env.MAVEN_REPO_CREDS_ID, getLocalDeploymentFolder(optaplannerRepository), getMavenRepoZipUrl())
// }
// }
// }
stage('Stage artifacts') {
when {
expression { return shouldStageArtifacts() }
Expand Down
4 changes: 3 additions & 1 deletion .ci/jenkins/dsl/jobs.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,9 @@ void setupDeployJob(JobType jobType, String envName = '') {
GIT_AUTHOR_PUSH_CREDS_ID: "${GIT_AUTHOR_PUSH_CREDENTIALS_ID}",

MAVEN_DEPENDENCIES_REPOSITORY: "${MAVEN_ARTIFACTS_REPOSITORY}",
MAVEN_DEPLOY_REPOSITORY: "${MAVEN_ARTIFACTS_REPOSITORY}",

MAVEN_DEPLOY_REPOSITORY: "${MAVEN_ARTIFACTS_UPLOAD_REPOSITORY_URL}",
MAVEN_REPO_CREDS_ID: "${MAVEN_ARTIFACTS_UPLOAD_REPOSITORY_CREDS_ID}",

OPERATOR_IMAGE_NAME: 'optaplanner-operator',
MAX_REGISTRY_RETRIES: 3,
Expand Down