Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

kie-issues#1250: prepare for release branch,gpg,svn #1770

Merged
merged 4 commits into from
May 27, 2024
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
44 changes: 44 additions & 0 deletions .ci/jenkins/Jenkinsfile.build-image
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,31 @@ pipeline {
}
}
}
stage('Export, Sign and Archive Image and signature') {
when {
expression { return shouldExportAndGpgSign() }
}
steps {
script {
def resultingFileName = "${getFinalImageName()}.tar.gz"
def signatureFileName = "${resultingFileName}.asc"
sh """
docker pull ${getBuiltImageTag()}
docker save ${getBuiltImageTag()} | gzip > ${resultingFileName}
"""
release.gpgImportKeyFromFileWithPassword(getReleaseGpgSignKeyCredsId(), getReleaseGpgSignPassphraseCredsId())
release.gpgSignFileDetachedSignatureWithPassword(resultingFileName, signatureFileName, getReleaseGpgSignPassphraseCredsId())
release.svnUploadFileToRepository(getReleaseSvnRepository(), getReleaseSvnCredsId(), getReleaseVersion(), resultingFileName, signatureFileName)
}
}
post {
always {
script {
archiveArtifacts(artifacts: '**/*.tar.gz,**/*.tar.gz.asc', fingerprint: false, allowEmptyArchive: true)
}
}
}
}
}
post {
always {
Expand Down Expand Up @@ -372,6 +397,10 @@ boolean shouldDeployImage() {
return params.DEPLOY_IMAGE
}

boolean shouldExportAndGpgSign() {
return params.EXPORT_AND_GPG_SIGN_IMAGE
}

String getBuildKogitoAppsRef() {
return params.BUILD_KOGITO_APPS_REF
}
Expand Down Expand Up @@ -427,3 +456,18 @@ String getTriggeringProjectName() {
}
return ""
}
String getReleaseGpgSignKeyCredsId() {
return env.RELEASE_GPG_SIGN_KEY_CREDS_ID
}

String getReleaseGpgSignPassphraseCredsId() {
return env.RELEASE_GPG_SIGN_PASSPHRASE_CREDS_ID
}

String getReleaseSvnRepository() {
return env.RELEASE_SVN_REPOSITORY
}

String getReleaseSvnCredsId() {
return env.RELEASE_SVN_CREDS_ID
}
6 changes: 5 additions & 1 deletion .ci/jenkins/Jenkinsfile.deploy
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@ void createBuildAndTestStageClosure(String image) {
buildParams.add(string(name: 'TESTS_KOGITO_EXAMPLES_URI', value: params.EXAMPLES_URI))
buildParams.add(string(name: 'TESTS_KOGITO_EXAMPLES_REF', value: params.EXAMPLES_REF))

buildParams.add(booleanParam(name: 'DEPLOY_IMAGE', value: true))
buildParams.add(booleanParam(name: 'DEPLOY_IMAGE', value: isDeployImage()))
buildParams.add(booleanParam(name: 'DEPLOY_IMAGE_USE_OPENSHIFT_REGISTRY', value: isDeployImageInOpenshiftRegistry()))
buildParams.add(string(name: 'DEPLOY_IMAGE_REGISTRY_CREDENTIALS', value: getDeployImageRegistryCredentials()))
buildParams.add(string(name: 'DEPLOY_IMAGE_REGISTRY', value: getDeployImageRegistry()))
Expand Down Expand Up @@ -354,6 +354,10 @@ List getTestFailedImages() {
// Deploy image information
////////////////////////////////////////////////////////////////////////

boolean isDeployImage() {
return !env.DISABLE_IMAGES_DEPLOY
}

boolean isDeployImageInOpenshiftRegistry() {
return params.IMAGE_USE_OPENSHIFT_REGISTRY
}
Expand Down
8 changes: 8 additions & 0 deletions .ci/jenkins/dsl/jobs.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,8 @@ void setupDeployJob(JobType jobType) {
DEFAULT_STAGING_REPOSITORY: "${MAVEN_NEXUS_STAGING_PROFILE_URL}",

QUARKUS_PLATFORM_NEXUS_URL: Utils.getMavenQuarkusPlatformRepositoryUrl(this),

DISABLE_IMAGES_DEPLOY: (jobType==JobType.NIGHTLY) ? true : Utils.isImagesDeployDisabled(this)
])
if (Utils.hasBindingValue(this, 'CLOUD_IMAGES')) {
jobParams.env.put('IMAGES_LIST', Utils.getBindingValue(this, 'CLOUD_IMAGES'))
Expand Down Expand Up @@ -167,6 +169,11 @@ void setupBuildImageJob(JobType jobType) {

GIT_AUTHOR_CREDS_ID: "${GIT_AUTHOR_CREDENTIALS_ID}",
GIT_AUTHOR_TOKEN_CREDS_ID: "${GIT_AUTHOR_TOKEN_CREDENTIALS_ID}",

RELEASE_GPG_SIGN_KEY_CREDS_ID: Utils.getReleaseGpgSignKeyCredentialsId(this),
RELEASE_GPG_SIGN_PASSPHRASE_CREDS_ID: Utils.getReleaseGpgSignPassphraseCredentialsId(this),
RELEASE_SVN_REPOSITORY: Utils.getReleaseSvnCredentialsId(this),
RELEASE_SVN_CREDS_ID: Utils.getReleaseSvnStagingRepository(this)
])
KogitoJobTemplate.createPipelineJob(this, jobParams)?.with {
logRotator {
Expand Down Expand Up @@ -202,6 +209,7 @@ void setupBuildImageJob(JobType jobType) {
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')
booleanParam('EXPORT_AND_GPG_SIGN_IMAGE', jobType == JobType.RELEASE, 'Set to true if should images be exported and signed.')
}
}
}
Expand Down
Loading