registry changers

This commit is contained in:
Hyatt 2020-07-17 13:41:41 -05:00
parent 7dd35efbc2
commit ade689a47d
Signed by: nhyatt
GPG Key ID: C50D0BBB5BC40BEA
3 changed files with 12 additions and 16 deletions

View File

@ -1,7 +1,7 @@
def label = "jenkins-${UUID.randomUUID().toString()}" def label = "jenkins-${UUID.randomUUID().toString()}"
def repository = "registry.test-chamber-13.lan:8443/nhyatt" def repository = "registry.test-chamber-13.lan:8443"
def kanikoImage = "${repository}/kaniko:latest" def kanikoImage = "${repository}/nhyatt/kaniko:latest"
def repositoryCreds = "quay-repository-creds" def repositoryCreds = "quay-repository-creds"
def caName = "test-chamber-13.lan.root.crt" def caName = "test-chamber-13.lan.root.crt"
@ -51,7 +51,7 @@ spec:
)]) { )]) {
def dockerJSON = """{ def dockerJSON = """{
"auths": { "auths": {
"registry.test-chamber-13.lan:5000": { "${repository}": {
"auth": "${dcreds.bytes.encodeBase64().toString()}" "auth": "${dcreds.bytes.encodeBase64().toString()}"
} }
} }
@ -75,7 +75,7 @@ RUN apk add --no-cache --virtual=.packagecache ca-certificates && \\
""" """
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 --context \"${workspace}\" -f \"${workspace}/Dockerfile\" --destination \"${repository}/alpine:latest\"" sh "/kaniko/executor --cleanup --context \"${workspace}\" -f \"${workspace}/Dockerfile\" --destination \"${repository}/nhyatt/alpine:latest\""
} }
} }
} }

View File

@ -1,6 +1,6 @@
def label = "jenkins-${UUID.randomUUID().toString()}" def label = "jenkins-${UUID.randomUUID().toString()}"
def repository = "registry.test-chamber-13.lan:8443/nhyatt" def repository = "registry.test-chamber-13.lan:8443"
def repositoryCreds = "quay-repository-creds" def repositoryCreds = "quay-repository-creds"
def caContent = """ def caContent = """
@ -49,7 +49,7 @@ spec:
)]) { )]) {
def dockerJSON = """{ def dockerJSON = """{
"auths": { "auths": {
"registry.test-chamber-13.lan:5000": { "${repository}": {
"auth": "${dcreds.bytes.encodeBase64().toString()}" "auth": "${dcreds.bytes.encodeBase64().toString()}"
} }
} }
@ -71,7 +71,7 @@ COPY kaniko-chain.crt /kaniko/ssl/certs/ca-certificates.crt
""" """
sh "cp /kaniko/ssl/certs/ca-certificates.crt \"${workspace}/kaniko-chain.crt\"" sh "cp /kaniko/ssl/certs/ca-certificates.crt \"${workspace}/kaniko-chain.crt\""
writeFile(file: workspace + "/Dockerfile", text: DF) writeFile(file: workspace + "/Dockerfile", text: DF)
sh "/kaniko/executor --cleanup --context \"${workspace}\" -f \"${workspace}/Dockerfile\" --destination \"${repository}/kaniko:latest\"" sh "/kaniko/executor --cleanup --context \"${workspace}\" -f \"${workspace}/Dockerfile\" --destination \"${repository}/nhyatt/kaniko:latest\""
} }
} }
} }

View File

@ -2,16 +2,12 @@
def nodeLabel = "${UUID.randomUUID().toString()}" def nodeLabel = "${UUID.randomUUID().toString()}"
// Kaniko Image // Kaniko Image
def kanikoImage = "registry.test-chamber-13.lan:5000/nhyatt/kaniko:latest" def repository = "registry.test-chamber-13.lan:8443"
def kanikoImage = "${repository}/nhyatt/kaniko:latest"
def repositoryCreds = "quay-repository-creds" def repositoryCreds = "quay-repository-creds"
// Repository Locations
def pushRepo = "registry.test-chamber-13.lan:5000/nhyatt"
def pushImage = "minecraft"
def pushTag = "latest"
// Container Variables // Container Variables
def baseImage = "${pushRepo}/alpine" def baseImage = "${repository}/nhyatt/alpine"
def baseImageTag = "latest" def baseImageTag = "latest"
def alpineJavaPackage = "openjdk11" def alpineJavaPackage = "openjdk11"
@ -51,7 +47,7 @@ spec:
)]) { )]) {
def dockerJSON = """{ def dockerJSON = """{
"auths": { "auths": {
"registry.test-chamber-13.lan:5000": { "${repository}": {
"auth": "${dcreds.bytes.encodeBase64().toString()}" "auth": "${dcreds.bytes.encodeBase64().toString()}"
} }
} }
@ -93,7 +89,7 @@ CMD cd data; java -Xms${memoryMin} -Xmx${memoryMax} -jar ../paper-mc.jar
stage ("Build & Push") { stage ("Build & Push") {
container ("kaniko") { container ("kaniko") {
sh "/kaniko/executor --cleanup --context \"${workspace}\" -f \"${workspace}/Dockerfile\" --destination \"${pushRepo}/${pushImage}:${pushTag}\"" sh "/kaniko/executor --cleanup --context \"${workspace}\" -f \"${workspace}/Dockerfile\" --destination \"${repository}/nhyatt/minecraft:latest\""
} }
} }
} }