switches to declarative pipeline
This commit is contained in:
		| @@ -3,7 +3,30 @@ | ||||
| def repository = "registry.c.test-chamber-13.lan" | ||||
| def repositoryCreds = "harbor-repository-creds" | ||||
|  | ||||
| def dockerFile = """FROM ${repository}/dockerhub/gitea/gitea:latest-rootless | ||||
| 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, | ||||
|                 alpine: true | ||||
|             ) | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     stages { | ||||
|         stage ('Initalize Jenkins') { | ||||
|             steps { | ||||
|                 script { | ||||
|                     workspace = pwd() | ||||
|                     writeFile(file: workspace + "/test-chamber-13.lan.root.crt", text: functions.getLocalRootCA()) | ||||
|                     dockerFile = """FROM ${repository}/dockerhub/gitea/gitea:latest-rootless | ||||
|  | ||||
| USER root | ||||
|  | ||||
| @@ -15,34 +38,39 @@ RUN apk add --no-cache --virtual=.packagecache ca-certificates && \\ | ||||
|  | ||||
| USER git | ||||
| """ | ||||
|  | ||||
| def label = "kubernetes-${UUID.randomUUID().toString()}" | ||||
| def templateName = "pipeline-worker" | ||||
| podTemplate( | ||||
|     label: label, | ||||
|     name: templateName, | ||||
|     yaml: functions.podYaml( | ||||
|         repo: repository, | ||||
|         templateName: templateName, | ||||
|         kaniko: true, | ||||
|         alpine: true | ||||
|     ) | ||||
| ) { | ||||
|     node (label) { | ||||
|         def workspace = pwd() | ||||
|  | ||||
|         stage ('Write cert to local file') { | ||||
|             writeFile(file: workspace + "/test-chamber-13.lan.root.crt", text: functions.getLocalRootCA()) | ||||
|                 } | ||||
|             } | ||||
|  | ||||
|         functions.buildContainer( | ||||
|             repository: repository, | ||||
|             imageDest: "${repository}/library/gitea:latest-rootless", | ||||
|         stage ('Build & Push') { | ||||
|             steps { | ||||
|                 container ('kaniko') { | ||||
|                     script { | ||||
|                         declarativeFunctions.buildContainerMultipleDestinations( | ||||
|                             dockerFile: dockerFile, | ||||
|             repoCreds: repositoryCreds | ||||
|                             repositoryAccess: [ | ||||
|                                 [ | ||||
|                                     repository: repository, | ||||
|                                     credentials: repositoryCreds | ||||
|                                 ], | ||||
|                             ], | ||||
|                             destination: [ | ||||
|                                 "${repository}/library/gitea:latest-rootless", | ||||
|                             ], | ||||
|                             [ | ||||
|                                 "LANG=${GlibcLanguage}", | ||||
|                                 "TZ=${TimeZone}" | ||||
|                             ] | ||||
|                         ) | ||||
|                     } | ||||
|                 } | ||||
|             } | ||||
|         } | ||||
|  | ||||
|         functions.deletePod( | ||||
|         stage ('Delete Running Container') { | ||||
|             steps { | ||||
|                 container ('alpine') { | ||||
|                     script { | ||||
|                         declarativeFunctions.deletePod( | ||||
|                             kubeAuth: "k8s-development-access", | ||||
|                             kubeURL: "https://kubernetes.test-chamber-13.lan:6443", | ||||
|                             namespace: "development", | ||||
| @@ -50,3 +78,7 @@ podTemplate( | ||||
|                         ) | ||||
|                     } | ||||
|                 } | ||||
|             } | ||||
|         } | ||||
|     } | ||||
| } | ||||
		Reference in New Issue
	
	Block a user