From 7daa9bacba1cced1390ebadeb9f1fb8c22c261c9 Mon Sep 17 00:00:00 2001 From: Tristan Radisson Date: Fri, 8 Sep 2023 16:39:19 +0200 Subject: [PATCH] Update pipelines (#249) --- .ci/jenkins/Jenkinsfile | 10 ++++------ .ci/jenkins/Jenkinsfile.deploy | 20 ++++++++------------ .ci/jenkins/Jenkinsfile.e2e.cluster | 15 ++++----------- .ci/jenkins/Jenkinsfile.promote | 14 ++++---------- .ci/jenkins/Jenkinsfile.setup-branch | 9 ++++----- .ci/jenkins/dsl/jobs.groovy | 4 ++++ .ci/jenkins/scripts/minikube.groovy | 2 +- 7 files changed, 29 insertions(+), 45 deletions(-) diff --git a/.ci/jenkins/Jenkinsfile b/.ci/jenkins/Jenkinsfile index c82ccc2e8..59468c96b 100644 --- a/.ci/jenkins/Jenkinsfile +++ b/.ci/jenkins/Jenkinsfile @@ -8,10 +8,10 @@ testsFailed = false pipeline { agent { - label 'kogito-jenkins-node && !master' - } - tools { - go 'golang-1.19' + docker { + image env.AGENT_DOCKER_BUILDER_IMAGE + args env.AGENT_DOCKER_BUILDER_ARGS + } } options { buildDiscarder logRotator(artifactDaysToKeepStr: '', artifactNumToKeepStr: '', daysToKeepStr: '', numToKeepStr: '10') @@ -19,8 +19,6 @@ pipeline { } environment { OPENSHIFT_INTERNAL_REGISTRY = 'image-registry.openshift-image-registry.svc:5000' - - CONTAINER_ENGINE = 'podman' } stages { stage('Setup pipeline') { diff --git a/.ci/jenkins/Jenkinsfile.deploy b/.ci/jenkins/Jenkinsfile.deploy index 320963143..0443be01e 100644 --- a/.ci/jenkins/Jenkinsfile.deploy +++ b/.ci/jenkins/Jenkinsfile.deploy @@ -6,7 +6,10 @@ commitDone = false pipeline { agent { - label 'ubuntu' + docker { + image env.AGENT_DOCKER_BUILDER_IMAGE + args env.AGENT_DOCKER_BUILDER_ARGS + } } options { @@ -14,18 +17,9 @@ pipeline { timestamps() } - tools { - go 'golang-1.19' - } - environment { KOGITO_CI_EMAIL_TO = credentials("${JENKINS_EMAIL_CREDS_ID}") - // Linked to node label - // Use docker due to multiplatform build - CONTAINER_ENGINE = 'docker' - CONTAINER_ENGINE_TLS_OPTIONS = '' - PR_BRANCH_HASH = "${util.generateHash(10)}" IMAGE_BUILD_PLATFORMS = 'linux/amd64,linux/arm64' @@ -61,6 +55,8 @@ pipeline { // Prepare for multiplatform build String localRegistry = cloud.startLocalRegistry() + + // TODO docker buildx could be preinstalled onto the docker image cloud.prepareForDockerMultiplatformBuild([localRegistry],[cloud.getDockerIOMirrorRegistryConfig()], false) cloud.installSkopeo() } @@ -277,8 +273,8 @@ String getTempBuiltImageTag() { return "localhost:5000/kogito-serverless-operator:${getOperatorVersion()}" } -def runPythonCommand(String cmd, boolean stdout = false) { - return util.runWithPythonVirtualEnv(cmd, 'cekit', stdout) +void runPythonCommand(String cmd, boolean stdout = false) { + return sh(returnStdout: stdout, script: cmd) } void pushFinalImage(String oldImageName, String newImageName) { diff --git a/.ci/jenkins/Jenkinsfile.e2e.cluster b/.ci/jenkins/Jenkinsfile.e2e.cluster index c00f07ffa..3b90cab28 100644 --- a/.ci/jenkins/Jenkinsfile.e2e.cluster +++ b/.ci/jenkins/Jenkinsfile.e2e.cluster @@ -7,7 +7,10 @@ openshiftClusterPlatform = 'openshift' pipeline { agent { - label "${env.AGENT_LABEL ?: "rhel8"} && podman && !built-in" + docker { + image env.AGENT_DOCKER_BUILDER_IMAGE + args env.AGENT_DOCKER_BUILDER_ARGS + } } options { @@ -15,16 +18,6 @@ pipeline { timestamps() } - tools { - go 'golang-1.19' - } - - environment { - // Linked to node label - CONTAINER_ENGINE='podman' - CONTAINER_ENGINE_TLS_OPTIONS='--tls-verify=false' - } - stages { stage('Setup pipeline') { steps { diff --git a/.ci/jenkins/Jenkinsfile.promote b/.ci/jenkins/Jenkinsfile.promote index 606e5d4ad..d42257b88 100644 --- a/.ci/jenkins/Jenkinsfile.promote +++ b/.ci/jenkins/Jenkinsfile.promote @@ -6,7 +6,10 @@ helper = null pipeline { agent { - label 'ubuntu' + docker { + image env.AGENT_DOCKER_BUILDER_IMAGE + args env.AGENT_DOCKER_BUILDER_ARGS + } } options { @@ -14,19 +17,10 @@ pipeline { timestamps() } - tools { - go 'golang-1.19' - } - environment { KOGITO_CI_EMAIL_TO = credentials("${JENKINS_EMAIL_CREDS_ID}") - // Linked to node label - CONTAINER_ENGINE = 'podman' - CONTAINER_ENGINE_TLS_OPTIONS = '--tls-verify=false' - PR_BRANCH_HASH = "${util.generateHash(10)}" - GITHUB_REPO = "${REPO_NAME}" // for github-release cli } stages { diff --git a/.ci/jenkins/Jenkinsfile.setup-branch b/.ci/jenkins/Jenkinsfile.setup-branch index 2c3bb2159..63f2cf938 100644 --- a/.ci/jenkins/Jenkinsfile.setup-branch +++ b/.ci/jenkins/Jenkinsfile.setup-branch @@ -5,11 +5,10 @@ testsFailed = false pipeline { agent { - label 'ubuntu' - } - - tools { - go 'golang-1.19' + docker { + image env.AGENT_DOCKER_BUILDER_IMAGE + args env.AGENT_DOCKER_BUILDER_ARGS + } } options { diff --git a/.ci/jenkins/dsl/jobs.groovy b/.ci/jenkins/dsl/jobs.groovy index ae5cd7c72..6201c49b3 100644 --- a/.ci/jenkins/dsl/jobs.groovy +++ b/.ci/jenkins/dsl/jobs.groovy @@ -42,6 +42,7 @@ setupPromoteJob(JobType.RELEASE) void createSetupBranchJob() { def jobParams = JobParamsUtils.getBasicJobParams(this, 'kogito-serverless-operator', JobType.SETUP_BRANCH, "${jenkins_path}/Jenkinsfile.setup-branch", 'Kogito Serverless Cloud Operator Setup Branch') + JobParamsUtils.setupJobParamsAgentDockerBuilderImageConfiguration(this, jobParams) jobParams.env.putAll([ JENKINS_EMAIL_CREDS_ID: "${JENKINS_EMAIL_CREDS_ID}", REPO_NAME: 'kogito-serverless-operator', @@ -67,6 +68,7 @@ void createSetupBranchJob() { void setupDeployJob(JobType jobType) { def jobParams = JobParamsUtils.getBasicJobParams(this, 'kogito-serverless-operator-deploy', jobType, "${jenkins_path}/Jenkinsfile.deploy", 'Kogito Serverless Cloud Operator Deploy') + JobParamsUtils.setupJobParamsAgentDockerBuilderImageConfiguration(this, jobParams) jobParams.env.putAll([ JENKINS_EMAIL_CREDS_ID: "${JENKINS_EMAIL_CREDS_ID}", @@ -115,6 +117,7 @@ void setupDeployJob(JobType jobType) { void setupPromoteJob(JobType jobType) { def jobParams = JobParamsUtils.getBasicJobParams(this, 'kogito-serverless-operator-promote', jobType, "${jenkins_path}/Jenkinsfile.promote", 'Kogito Serverless Cloud Operator Promote') + JobParamsUtils.setupJobParamsAgentDockerBuilderImageConfiguration(this, jobParams) jobParams.env.putAll([ JENKINS_EMAIL_CREDS_ID: "${JENKINS_EMAIL_CREDS_ID}", MAX_REGISTRY_RETRIES: 3, @@ -162,6 +165,7 @@ void setupPromoteJob(JobType jobType) { void setupE2EJob(JobType jobType, String clusterName, Map extraEnv = [:]) { def jobParams = JobParamsUtils.getBasicJobParams(this, "kogito-serverless-operator.e2e.${clusterName}", jobType, "${jenkins_path}/Jenkinsfile.e2e.cluster", 'Kogito Serverless Cloud Operator Deploy') + JobParamsUtils.setupJobParamsAgentDockerBuilderImageConfiguration(this, jobParams) jobParams.env.putAll([ JENKINS_EMAIL_CREDS_ID: "${JENKINS_EMAIL_CREDS_ID}", CLUSTER_NAME: clusterName, diff --git a/.ci/jenkins/scripts/minikube.groovy b/.ci/jenkins/scripts/minikube.groovy index 355396a45..445e2da82 100644 --- a/.ci/jenkins/scripts/minikube.groovy +++ b/.ci/jenkins/scripts/minikube.groovy @@ -1,6 +1,6 @@ minikubeVersion = env.MINIKUBE_VERSION ?: '1.30.1' minikubeKubernetesVersion = env.KUBERNETES_VERSION ?: '1.26.3' -minikubeContainerEngine = env.CONTAINER_ENGINE ?: 'podman' +minikubeContainerEngine = env.CONTAINER_ENGINE ?: 'docker' minikubeCpus = 'max' minikubeMemory = '4g'