def call(String podTemplateName) { Object alpineTemplate = """ apiVersion: v1 kind: Pod spec: containers: - name: linux image: ${env.JENKINS_DOCKER_REGISTRY}/docker-hub-proxy/library/alpine:3.18.5 command: - sleep args: - 99d resources: limits: cpu: 100m memory: 64Mi requests: cpu: 100m memory: 64Mi """ Object auroraV4Template = """ apiVersion: v1 kind: Pod metadata: annotations: container.apparmor.security.beta.kubernetes.io/aurora: unconfined spec: containers: - name: aurora image: ${env.JENKINS_DOCKER_REGISTRY}/devops/build-aurora-image:4.0.2.249-2 securityContext: runAsUser: 1000 runAsGroup: 1000 capabilities: add: - SYS_ADMIN tty: true resources: limits: cpu: 15 memory: 128Gi requests: cpu: 15 memory: 32Gi volumeMounts: - mountPath: ${global.AURORA_CUSTOM_WORKSPACE} # Because home path removed within chroot name: "workspace-volume" ttyEnabled: true imagePullSecrets: - name: ${env.JENKINS_K8S_HARBOR_SECRET} """ Object auroraV5_1Template = """ apiVersion: v1 kind: Pod metadata: annotations: container.apparmor.security.beta.kubernetes.io/aurora: unconfined spec: containers: - name: aurora image: ${env.JENKINS_DOCKER_REGISTRY}/devops/build-aurora-image:5.1.0.24 securityContext: runAsUser: 1000 runAsGroup: 1000 capabilities: add: - SYS_ADMIN tty: true resources: limits: cpu: 15 memory: 128Gi requests: cpu: 15 memory: 32Gi volumeMounts: - mountPath: ${global.AURORA_CUSTOM_WORKSPACE} # Because home path removed within chroot name: "workspace-volume" ttyEnabled: true imagePullSecrets: - name: ${env.JENKINS_K8S_HARBOR_SECRET} """ Object sonarCubeScannerTemplate = """ apiVersion: v1 kind: Pod spec: containers: - name: sonar-scanner image: ${env.JENKINS_DOCKER_REGISTRY}/docker-hub-proxy/sonarsource/sonar-scanner-cli:5.0.1 command: ["bash"] securityContext: runAsUser: 1000 runAsGroup: 1000 tty: true resources: limits: cpu: 7 memory: 16Gi requests: cpu: 7 memory: 16Gi ttyEnabled: true volumeMounts: - mountPath: ${global.AURORA_CUSTOM_WORKSPACE} # Because home path removed within chroot name: "workspace-volume" """ switch (podTemplateName) { case 'alpine': return alpineTemplate case 'auroraV4': return auroraV4Template case 'auroraV5_1': return auroraV5_1Template case "sonarCubeScanner": return sonarCubeScannerTemplate } }