move to support new registry.
This commit is contained in:
		@@ -21,9 +21,9 @@ UOemMEg3PjcKNsN65W2WVon5HIZx2XVfGRPjf5ZTVWzZ
 | 
				
			|||||||
"""
 | 
					"""
 | 
				
			||||||
 | 
					
 | 
				
			||||||
podTemplate(
 | 
					podTemplate(
 | 
				
			||||||
    label: label,
 | 
						label: label,
 | 
				
			||||||
    name: "pipeline-worker",
 | 
						name: "pipeline-worker",
 | 
				
			||||||
    yaml: """---
 | 
						yaml: """---
 | 
				
			||||||
apiVersion: v1
 | 
					apiVersion: v1
 | 
				
			||||||
kind: Pod
 | 
					kind: Pod
 | 
				
			||||||
metadata:
 | 
					metadata:
 | 
				
			||||||
@@ -38,21 +38,44 @@ spec:
 | 
				
			|||||||
    - /busybox/cat
 | 
					    - /busybox/cat
 | 
				
			||||||
""",
 | 
					""",
 | 
				
			||||||
) {
 | 
					) {
 | 
				
			||||||
    node (label) {
 | 
						node (label) {
 | 
				
			||||||
        def workspace = pwd()
 | 
							def workspace = pwd()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        stage("Build Alpine with CA") {
 | 
							stage ("Prepare Kaniko") {
 | 
				
			||||||
            container("kaniko") {
 | 
								container ("kaniko") {
 | 
				
			||||||
                def DF = """FROM alpine:latest
 | 
									withCredentials([usernameColonPassword(
 | 
				
			||||||
 | 
										credentialsId: repositoryCreds,
 | 
				
			||||||
 | 
										variable: "dCreds",
 | 
				
			||||||
 | 
									)]) {
 | 
				
			||||||
 | 
										def dockerJSON = """{
 | 
				
			||||||
 | 
											"auths": {
 | 
				
			||||||
 | 
												"registry.test-chamber-13.lan:5000": {
 | 
				
			||||||
 | 
													"auth": "${dcreds.bytes.encodeBase64().toString()}"
 | 
				
			||||||
 | 
												}
 | 
				
			||||||
 | 
											}
 | 
				
			||||||
 | 
										}"""
 | 
				
			||||||
 | 
										sh """
 | 
				
			||||||
 | 
											set +x
 | 
				
			||||||
 | 
											echo '${dockerJSON}' > /kaniko/.docker/config.json
 | 
				
			||||||
 | 
											printf '%s\\n' "${caContent}" >> /kaniko/ssl/certs/ca-certificates.crt
 | 
				
			||||||
 | 
											set -x
 | 
				
			||||||
 | 
										"""
 | 
				
			||||||
 | 
									}
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							stage("Build Alpine with CA") {
 | 
				
			||||||
 | 
								container("kaniko") {
 | 
				
			||||||
 | 
									def DF = """FROM alpine:latest
 | 
				
			||||||
COPY ${caName} /usr/local/share/ca-certificates/
 | 
					COPY ${caName} /usr/local/share/ca-certificates/
 | 
				
			||||||
RUN apk add --no-cache --virtual=.packagecache ca-certificates && \\
 | 
					RUN apk add --no-cache --virtual=.packagecache ca-certificates && \\
 | 
				
			||||||
    update-ca-certificates --fresh && \\
 | 
						update-ca-certificates --fresh && \\
 | 
				
			||||||
    apk del .packagecache
 | 
						apk del .packagecache
 | 
				
			||||||
"""
 | 
					"""
 | 
				
			||||||
                writeFile(file: workspace + "/" + caName, text: caContent)
 | 
									writeFile(file: workspace + "/" + caName, text: caContent)
 | 
				
			||||||
                writeFile(file: workspace + "/Dockerfile", text: DF)
 | 
									writeFile(file: workspace + "/Dockerfile", text: DF)
 | 
				
			||||||
                sh "/kaniko/executor --cleanup --insecure --skip-tls-verify --context \"${workspace}\" -f \"${workspace}/Dockerfile\" --destination \"${pushRepo}/alpine:latest\""
 | 
									sh "/kaniko/executor --cleanup --skip-tls-verify --context \"${workspace}\" -f \"${workspace}/Dockerfile\" --destination \"${pushRepo}/nhyatt/alpine:latest\""
 | 
				
			||||||
            }
 | 
								}
 | 
				
			||||||
        }
 | 
							}
 | 
				
			||||||
    }
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
		Reference in New Issue
	
	Block a user