moves to declarative pipeline
This commit is contained in:
		| @@ -12,6 +12,8 @@ | |||||||
| def repository = "registry.c.test-chamber-13.lan" | def repository = "registry.c.test-chamber-13.lan" | ||||||
| def repositoryCreds = "harbor-repository-creds" | def repositoryCreds = "harbor-repository-creds" | ||||||
|  |  | ||||||
|  | def workspace | ||||||
|  |  | ||||||
| def dockerFile = """FROM ${repository}/dockerhub/library/alpine:latest | def dockerFile = """FROM ${repository}/dockerhub/library/alpine:latest | ||||||
|  |  | ||||||
| LABEL maintainer="The_Spider <spider@smoothnet.org>" | LABEL maintainer="The_Spider <spider@smoothnet.org>" | ||||||
| @@ -25,25 +27,46 @@ RUN apk add --no-cache --virtual=.packagecache ca-certificates && \\ | |||||||
|  |  | ||||||
| def label = "kubernetes-${UUID.randomUUID().toString()}" | def label = "kubernetes-${UUID.randomUUID().toString()}" | ||||||
| def templateName = "pipeline-worker" | def templateName = "pipeline-worker" | ||||||
| podTemplate( | pipeline { | ||||||
|     label: label, |     agent { | ||||||
|     name: templateName, |         kubernetes { | ||||||
|     yaml: functions.podYaml( |             yaml functions.podYaml( | ||||||
|         repo: repository, |                 repo: repository, | ||||||
|         templateName: templateName, |                 templateName: templateName, | ||||||
|         kaniko: true |                 kaniko: true | ||||||
|     ) |             ) | ||||||
| ) { |         } | ||||||
|     node (label) { |     } | ||||||
|         def workspace = pwd() |  | ||||||
|  |  | ||||||
|         writeFile(file: workspace + "/test-chamber-13.lan.root.crt", text: functions.getLocalRootCA()) |     stages { | ||||||
|  |         stage ('Initalize Jenkins') { | ||||||
|  |             steps { | ||||||
|  |                 script { | ||||||
|  |                     workspace = pwd() | ||||||
|  |                     writeFile(file: workspace + "/test-chamber-13.lan.root.crt", text: functions.getLocalRootCA()) | ||||||
|  |                 } | ||||||
|  |             } | ||||||
|  |         } | ||||||
|  |  | ||||||
|         functions.buildContainer( |         stage ('Build & Push') { | ||||||
|             repository: repository, |             steps { | ||||||
|             imageDest: "${repository}/library/alpine:latest", |                 container ('kaniko') { | ||||||
|             dockerFile: dockerFile, |                     script { | ||||||
|             repoCreds: repositoryCreds, |                         declarativeFunctions.buildContainerMultipleDestinations( | ||||||
|         ) |                             dockerFile: dockerFile, | ||||||
|  |                             repositoryAccess: [ | ||||||
|  |                                 [ | ||||||
|  |                                     repository: repository, | ||||||
|  |                                     credentials: repositoryCreds | ||||||
|  |                                 ], | ||||||
|  |                             ], | ||||||
|  |                             destination: [ | ||||||
|  |                                 "${repository}/library/alpine:latest", | ||||||
|  |                             ] | ||||||
|  |                         ) | ||||||
|  |                     } | ||||||
|  |                 } | ||||||
|  |             } | ||||||
|  |         } | ||||||
|     } |     } | ||||||
| } | } | ||||||
		Reference in New Issue
	
	Block a user