#!groovy def repository = "registry.c.test-chamber-13.lan" def repositoryCreds = "harbor-repository-creds" def workspace def dockerFile def label = "kubernetes-${UUID.randomUUID().toString()}" def templateName = "pipeline-worker" pipeline { agent { kubernetes { yaml functions.podYaml( repo: repository, templateName: templateName, kaniko: true ) } } stages { stage ('Initalize Jenkins') { steps { script { workspace = pwd() writeFile(file: workspace + "/test-chamber-13.lan.root.crt", text: functions.getLocalRootCA()) def dockerFile = """ FROM ${repository}/dockerhub/sonarsource/sonar-scanner-cli:latest USER root COPY test-chamber-13.lan.root.crt /usr/local/share/ca-certificates/test-chamber-13.lan.root.crt RUN update-ca-certificates --fresh USER scanner-cli """ } } } stage ('Build & Push') { steps { container ('kaniko') { script { declarativeFunctions.buildContainerMultipleDestinations( dockerFile: dockerFile, repositoryAccess: [ [ repository: repository, credentials: repositoryCreds ], ], destination: [ "${repository}/library/sonarscanner:latest", ] ) } } } } } }