Skip to content

Commit

Permalink
Fix deploy pipeline for release (#1591)
Browse files Browse the repository at this point in the history
  • Loading branch information
radtriste authored Jun 20, 2023
1 parent 7462b26 commit ea4b4cd
Showing 1 changed file with 25 additions and 10 deletions.
35 changes: 25 additions & 10 deletions .ci/jenkins/Jenkinsfile.deploy
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ pipeline {
KOGITO_CI_EMAIL_TO = credentials("${JENKINS_EMAIL_CREDS_ID}")

BOT_BRANCH_HASH = "${util.generateHash(10)}"

OPENSHIFT_REGISTRY = credentials('OPENSHIFT_REGISTRY')
}

stages {
Expand Down Expand Up @@ -281,13 +283,13 @@ void createBuildAndTestStageClosure(String image) {
buildParams.add(string(name: 'TESTS_MAVEN_ARTIFACTS_REPOSITORY_URL', value: env.MAVEN_ARTIFACT_REPOSITORY ?: (isRelease() ? env.DEFAULT_STAGING_REPOSITORY : '')))

buildParams.add(booleanParam(name: 'DEPLOY_IMAGE', value: true))
buildParams.add(booleanParam(name: 'DEPLOY_IMAGE_USE_OPENSHIFT_REGISTRY', value: params.IMAGE_USE_OPENSHIFT_REGISTRY))
buildParams.add(string(name: 'DEPLOY_IMAGE_REGISTRY_CREDENTIALS', value: params.IMAGE_REGISTRY_CREDENTIALS))
buildParams.add(string(name: 'DEPLOY_IMAGE_REGISTRY', value: params.IMAGE_REGISTRY))
buildParams.add(string(name: 'DEPLOY_IMAGE_NAMESPACE', value: params.IMAGE_NAMESPACE))
buildParams.add(string(name: 'DEPLOY_IMAGE_NAME_SUFFIX', value: params.IMAGE_NAME_SUFFIX))
buildParams.add(string(name: 'DEPLOY_IMAGE_TAG', value: params.IMAGE_TAG))
buildParams.add(booleanParam(name: 'DEPLOY_WITH_LATEST_TAG', value: params.DEPLOY_WITH_LATEST_TAG))
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()))
buildParams.add(string(name: 'DEPLOY_IMAGE_NAMESPACE', value: getDeployImageNamespace()))
buildParams.add(string(name: 'DEPLOY_IMAGE_NAME_SUFFIX', value: getDeployImageNameSuffix()))
buildParams.add(string(name: 'DEPLOY_IMAGE_TAG', value: getDeployImageTag()))
buildParams.add(booleanParam(name: 'DEPLOY_WITH_LATEST_TAG', value: isDeployLatestTag()))

def job = build(job: 'kogito-images.build-image', wait: true, parameters: buildParams, propagate: false)
if (!job.result == 'SUCCESS') {
Expand Down Expand Up @@ -340,18 +342,23 @@ List getTestFailedImages() {
// Deploy image information
////////////////////////////////////////////////////////////////////////

boolean isDeployImageInOpenshiftRegistry() {
return params.IMAGE_USE_OPENSHIFT_REGISTRY
}

String getDeployImageRegistryCredentials() {
return params.IMAGE_REGISTRY_CREDENTIALS
}

String getDeployImageRegistry() {
return isDeployImageInOpenshiftRegistry() ? env.OPENSHIFT_REGISTRY : params.IMAGE_REGISTRY
}

String getDeployImageNamespace() {
return isDeployImageInOpenshiftRegistry() ? 'openshift' : params.IMAGE_NAMESPACE
}

String getDeployImageNameSuffix() {
return params.IMAGE_NAME_SUFFIX
}

String getDeployImageTag() {
if (params.IMAGE_TAG != '') {
return params.IMAGE_TAG
Expand All @@ -360,6 +367,10 @@ String getDeployImageTag() {
}
}

boolean isDeployLatestTag() {
return params.DEPLOY_WITH_LATEST_TAG
}

////////////////////////////////////////////////////////////////////////
// utils
////////////////////////////////////////////////////////////////////////
Expand Down Expand Up @@ -413,3 +424,7 @@ String[] getImages() {
void runPythonCommand(String cmd, boolean stdout = false) {
return util.runWithPythonVirtualEnv(cmd, 'cekit', stdout)
}

String getQuarkusPlatformVersion() {
return params.QUARKUS_PLATFORM_VERSION
}

0 comments on commit ea4b4cd

Please sign in to comment.