Skip to content

Commit

Permalink
KOGITO-9671 CI: Remove bot account usage (apache#1503)
Browse files Browse the repository at this point in the history
  • Loading branch information
radtriste committed Aug 7, 2023
1 parent c35f396 commit 59892d2
Show file tree
Hide file tree
Showing 9 changed files with 98 additions and 254 deletions.
27 changes: 10 additions & 17 deletions .ci/jenkins/Jenkinsfile.deploy
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,10 @@ pipeline {
KOGITO_CI_EMAIL_TO = credentials("${JENKINS_EMAIL_CREDS_ID}")

CONTAINER_ENGINE = 'podman'
CONTAINER_TLS_OPTIONS = '--tls-verify=false'
CONTAINER_ENGINE_TLS_OPTIONS = '--tls-verify=false'

JAVA_HOME = "${GRAALVM_HOME}"

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

// Environment required by OLM tests when run from process
OP_TEST_CONTAINER_OPT = '-t'
OP_TEST_DEBUG = 1
Expand Down Expand Up @@ -66,7 +64,7 @@ pipeline {
}

// Verify we have the connectivity to Openshift
openshift.loginOpenshift()
cloud.loginOpenShiftFromAPICreds(env.OPENSHIFT_API_KEY, env.OPENSHIFT_CREDS_KEY)
}
}
post {
Expand Down Expand Up @@ -181,11 +179,10 @@ pipeline {
stage('Push Operator Image to Openshift Registry') {
steps {
script {
container.loginOpenshiftRegistry()
cloud.loginOpenshiftRegistry(env.CONTAINER_ENGINE, env.CONTAINER_ENGINE_TLS_OPTIONS)

container.tagImage("quay.io/kiegroup/${env.OPERATOR_IMAGE_NAME}:${getOperatorVersion()}",
helper.buildTempOpenshiftImageFullName())
container.pushImage(helper.buildTempOpenshiftImageFullName())
helper.getContainerEngineService().tagImage("quay.io/kiegroup/${env.OPERATOR_IMAGE_NAME}:${getOperatorVersion()}", helper.buildTempOpenshiftImageFullName())
helper.getContainerEngineService().pushImage(helper.buildTempOpenshiftImageFullName())
}
}
}
Expand Down Expand Up @@ -239,20 +236,16 @@ pipeline {
script {
helper.loginRegistry()

container.tagImage(helper.buildTempOpenshiftImageFullName(), helper.getImageFullTag(env.OPERATOR_IMAGE_NAME))
container.pushImage(helper.getImageFullTag(env.OPERATOR_IMAGE_NAME))
String imageTag = helper.buildTempOpenshiftImageFullName()
helper.promoteImage(imageTag, helper.getImageFullTag(env.OPERATOR_IMAGE_NAME))

if (helper.isDeployLatestTag()) {
String finalFullImage = helper.getImageFullTag(env.OPERATOR_IMAGE_NAME, defaultImageParamsPrefix, 'latest')
container.tagImage(helper.buildTempOpenshiftImageFullName(), finalFullImage)
container.pushImage(finalFullImage)
helper.promoteImage(imageTag, helper.getImageFullTag(env.OPERATOR_IMAGE_NAME, defaultImageParamsPrefix, 'latest'))
}

String reducedTag = helper.getReducedTag()
if (reducedTag) {
String finalFullImage = helper.getImageFullTag(env.OPERATOR_IMAGE_NAME, defaultImageParamsPrefix, reducedTag)
container.tagImage(helper.buildTempOpenshiftImageFullName(), finalFullImage)
container.pushImage(finalFullImage)
helper.promoteImage(imageTag, helper.getImageFullTag(env.OPERATOR_IMAGE_NAME, defaultImageParamsPrefix, reducedTag))
}

// Store image deployment information
Expand Down Expand Up @@ -295,7 +288,7 @@ pipeline {
properties.writeToFile(env.PROPERTIES_FILE_NAME)
archiveArtifacts(artifacts: env.PROPERTIES_FILE_NAME)

// Verify here if BDD tests due to test errors or build error
// Verify here if getContainerEngineServiceDD tests due to test ercloud.rors or build error
if (testsFailed && currentBuild.currentResult == 'SUCCESS') {
error 'There was a test execution failure'
}
Expand Down
16 changes: 6 additions & 10 deletions .ci/jenkins/Jenkinsfile.examples-images.deploy
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ pipeline {
KOGITO_CI_EMAIL_TO = credentials("${JENKINS_EMAIL_CREDS_ID}")

CONTAINER_ENGINE = 'docker'
CONTAINER_TLS_OPTIONS = ''
CONTAINER_ENGINE_TLS_OPTIONS = ''

JAVA_HOME = "${GRAALVM_HOME}"
}
Expand All @@ -46,8 +46,7 @@ pipeline {
helper.checkoutRepo()

// Openshift login is needed for the examples generation
openshift.loginOpenshift()

cloud.loginOpenShiftFromAPICreds(env.OPENSHIFT_API_KEY, env.OPENSHIFT_CREDS_KEY)
helper.loginRegistry()
}
}
Expand Down Expand Up @@ -118,19 +117,16 @@ pipeline {
images = readFile(file: 'test/examples/logs/built_project_image_names.log').split('\n')

for (String imageName : images) {
String imageTag = helper.getImageFullTag(imageName)
if (helper.isDeployLatestTag()) {
String finalFullImage = helper.getImageFullTag(imageName, defaultImageParamsPrefix, 'latest')
container.tagImage(helper.getImageFullTag(imageName), finalFullImage)
container.pushImage(finalFullImage)
helper.promoteImage(imageTag, helper.getImageFullTag(imageName, defaultImageParamsPrefix, 'latest'))
}
String reducedTag = helper.getReducedTag()
if (reducedTag) {
String finalFullImage = helper.getImageFullTag(imageName, defaultImageParamsPrefix, reducedTag)
container.tagImage(helper.getImageFullTag(imageName), finalFullImage)
container.pushImage(finalFullImage)
helper.promoteImage(imageTag, helper.getImageFullTag(imageName, defaultImageParamsPrefix, reducedTag))
}

if (helper.getImageRegistry() == 'quay.io') {
if (helper.isQuayRegistry()) {
helper.makeQuayImagePublic(helper.getFullImageName(imageName))
}
}
Expand Down
54 changes: 17 additions & 37 deletions .ci/jenkins/Jenkinsfile.examples-images.promote
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,7 @@ pipeline {
KOGITO_CI_EMAIL_TO = credentials("${JENKINS_EMAIL_CREDS_ID}")

CONTAINER_ENGINE = 'podman'
CONTAINER_TLS_OPTIONS = '--tls-verify=false'

GITHUB_REPO = "${REPO_NAME}" // for github-release cli
CONTAINER_ENGINE_TLS_OPTIONS = '--tls-verify=false'
}

stages {
Expand All @@ -38,60 +36,42 @@ pipeline {

properties.readFromUrl(helper.getDeployPropertiesFileUrl())

if (helper.isRelease()) {
// Verify version is set and if on right release branch
assert helper.getProjectVersion()
assert helper.getProjectVersion()
assert helper.getBuildBranch() == util.getReleaseBranchFromVersion(helper.getProjectVersion())

assert helper.getBuildBranch() == util.getReleaseBranchFromVersion(helper.getProjectVersion())
}
cloud.installSkopeo()
}
}
}
stage('Pull "old" images') {
stage('Promote images') {
steps {
script {
helper.loginRegistry(baseImageParamsPrefix)
helper.loginRegistry(promoteImageParamsPrefix)

for (String imageName : getImages()) {
container.pullImage(helper.getImageFullTag(imageName, baseImageParamsPrefix))
}
}
}
}
stage('Tag images') {
steps {
script {
for (String imageName : getImages()) {
container.tagImage(helper.getImageFullTag(imageName, baseImageParamsPrefix), helper.getImageFullTag(imageName, promoteImageParamsPrefix))
String imageTag = helper.getImageFullTag(imageName, baseImageParamsPrefix)
helper.promoteImage(imageTag, helper.getImageFullTag(imageName, promoteImageParamsPrefix))
if (helper.isDeployLatestTag()) {
container.tagImage(helper.getImageFullTag(imageName, baseImageParamsPrefix), helper.getImageFullTag(imageName, promoteImageParamsPrefix, 'latest'))
helper.promoteImage(imageTag, helper.getImageFullTag(imageName, promoteImageParamsPrefix, 'latest'))
}
String reducedTag = helper.getReducedTag(promoteImageParamsPrefix)
String reducedTag = getReducedTag()
if (reducedTag) {
container.tagImage(helper.getImageFullTag(imageName, baseImageParamsPrefix), helper.getImageFullTag(imageName, promoteImageParamsPrefix, reducedTag))
helper.promoteImage(imageTag, helper.getImageFullTag(imageName, promoteImageParamsPrefix, reducedTag))
}
}
}
}
}
stage('Pushing') {

stage('Make Quay images public') {
when {
expression { helper.isQuayRegistry(promoteImageParamsPrefix) }
}
steps {
script {
helper.loginRegistry(promoteImageParamsPrefix)

for (String imageName : getImages()) {
container.pushImage(helper.getImageFullTag(imageName, promoteImageParamsPrefix))
if (helper.isDeployLatestTag()) {
container.pushImage(helper.getImageFullTag(imageName, promoteImageParamsPrefix, 'latest'))
}
String reducedTag = helper.getReducedTag(promoteImageParamsPrefix)
if (reducedTag) {
container.pushImage(helper.getImageFullTag(imageName, promoteImageParamsPrefix, reducedTag))
}

if (helper.getImageRegistry(promoteImageParamsPrefix) == 'quay.io') {
helper.makeQuayImagePublic(helper.getFullImageName(imageName, promoteImageParamsPrefix), promoteImageParamsPrefix)
}
helper.makeQuayImagePublic(helper.getFullImageName(imageName, promoteImageParamsPrefix), promoteImageParamsPrefix)
}
}
}
Expand Down
11 changes: 5 additions & 6 deletions .ci/jenkins/Jenkinsfile.profiling
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ pipeline {
KOGITO_CI_EMAIL_TO = credentials("${JENKINS_EMAIL_CREDS_ID}")

CONTAINER_ENGINE = 'podman'
CONTAINER_TLS_OPTIONS = '--tls-verify=false'
CONTAINER_ENGINE_TLS_OPTIONS = '--tls-verify=false'

CODECOV_TOKEN = credentials('KOGITO_OPERATOR_CODECOV_TOKEN')

Expand All @@ -46,7 +46,7 @@ pipeline {
helper.checkoutRepo()

// Verify we have the connectivity to Openshift
openshift.loginOpenshift()
cloud.loginOpenShiftFromAPICreds(env.OPENSHIFT_API_KEY, env.OPENSHIFT_CREDS_KEY)
}
}
}
Expand Down Expand Up @@ -85,11 +85,10 @@ pipeline {
stage('Push Operator Image to Openshift Registry') {
steps {
script {
container.loginOpenshiftRegistry()
cloud.loginOpenshiftRegistry(env.CONTAINER_ENGINE, env.CONTAINER_ENGINE_TLS_OPTIONS)

container.tagImage("quay.io/kiegroup/${env.OPERATOR_IMAGE_NAME}:${getOperatorVersion()}",
helper.buildTempOpenshiftImageFullName())
container.pushImage(helper.buildTempOpenshiftImageFullName())
helper.getContainerEngineService().tagImage("quay.io/kiegroup/${env.OPERATOR_IMAGE_NAME}:${getOperatorVersion()}", helper.buildTempOpenshiftImageFullName())
helper.getContainerEngineService().pushImage(helper.buildTempOpenshiftImageFullName())
}
}
}
Expand Down
Loading

0 comments on commit 59892d2

Please sign in to comment.