From 8a094da52f682e104ecf8f11c47d57172ff187aa Mon Sep 17 00:00:00 2001 From: Dmitrij Prokov Date: Thu, 27 Feb 2025 18:00:49 +0300 Subject: [PATCH] [DO-674] Add pod template for sonarqube (!65) Co-authored-by: Denis Patrakeev Reviewed-on: https://git.avroid.tech/DevOps/jenkins-shared-lib/pulls/65 Reviewed-by: Denis Patrakeev Co-authored-by: Dmitrij Prokov Co-committed-by: Dmitrij Prokov --- src/tech/avroid/kube/PodTemplates.groovy | 29 ++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/src/tech/avroid/kube/PodTemplates.groovy b/src/tech/avroid/kube/PodTemplates.groovy index e1765a5..acf6eef 100644 --- a/src/tech/avroid/kube/PodTemplates.groovy +++ b/src/tech/avroid/kube/PodTemplates.groovy @@ -463,4 +463,33 @@ class PodTemplates implements Serializable { body.call() } } + + public void sonarQube(imageVersion='11.2', body) { + this.script.podTemplate( + cloud: this.cloud, + imagePullSecrets: this.dockerCreds, + containers: [ + this.script.containerTemplate( + alwaysPullImage: true, + name: 'sonar-scanner-cli', + image: "${this.registry}/docker-hub-proxy/sonar-scanner-cli:${imageVersion}", + ttyEnabled: true, + command: "cat", + resourceRequestCpu: '5', + resourceRequestMemory: '10Gi', + resourceLimitCpu: '7', + resourceLimitMemory: '16Gi', + ), + ], + showRawYaml: false, + volumes: [ + this.script.emptyDirVolume(memory: false, mountPath: '/tmp'), + ], + workspaceVolume: this.script.emptyDirWorkspaceVolume(false), + ) + + { + body.call() + } +} }