adds stages
This commit is contained in:
parent
b0d9923b8b
commit
b5545c64ca
@ -34,38 +34,42 @@ spec:
|
|||||||
|
|
||||||
def deletePod (Map config) {
|
def deletePod (Map config) {
|
||||||
def ws = pwd()
|
def ws = pwd()
|
||||||
container ("alpine") {
|
stage ("Delete Pod") {
|
||||||
sh """
|
container ("alpine") {
|
||||||
apk add --no-cache curl
|
sh """
|
||||||
curl -L --silent https://storage.googleapis.com/kubernetes-release/release/\$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/linux/amd64/kubectl -o /usr/local/bin/kubectl
|
apk add --no-cache curl
|
||||||
chmod +x /usr/local/bin/kubectl
|
curl -L --silent https://storage.googleapis.com/kubernetes-release/release/\$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/linux/amd64/kubectl -o /usr/local/bin/kubectl
|
||||||
"""
|
chmod +x /usr/local/bin/kubectl
|
||||||
|
"""
|
||||||
|
|
||||||
withKubeConfig ([
|
withKubeConfig ([
|
||||||
credentialsId: config.kubeAuth,
|
credentialsId: config.kubeAuth,
|
||||||
serverUrl: config.kubeURL,
|
serverUrl: config.kubeURL,
|
||||||
namespace: config.namespace,
|
namespace: config.namespace,
|
||||||
]) {
|
]) {
|
||||||
sh "for i in \$(kubectl get pods --selector ${config.selector} -o name); do kubectl delete \${i}; done"
|
sh "for i in \$(kubectl get pods --selector ${config.selector} -o name); do kubectl delete \${i}; done"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
def buildContainer (Map config) {
|
def buildContainer (Map config) {
|
||||||
def ws = pwd()
|
def ws = pwd()
|
||||||
container("kaniko") {
|
stage ("Build Container") {
|
||||||
writeFile (file: ws + "/Dockerfile", text: config.dockerFile)
|
container ("kaniko") {
|
||||||
withCredentials([usernameColonPassword(
|
writeFile (file: ws + "/Dockerfile", text: config.dockerFile)
|
||||||
credentialsId: config.repoCreds,
|
withCredentials([usernameColonPassword(
|
||||||
variable: "dCreds",
|
credentialsId: config.repoCreds,
|
||||||
)]) {
|
variable: "dCreds",
|
||||||
sh "set +x; printf '{\"auths\":{\"%s\":{\"auth\": \"%s\"}}}' \"${config.repository}\" \"${dcreds.bytes.encodeBase64().toString()}\" > /kaniko/.docker/config.json"
|
)]) {
|
||||||
|
sh "set +x; printf '{\"auths\":{\"%s\":{\"auth\": \"%s\"}}}' \"${config.repository}\" \"${dcreds.bytes.encodeBase64().toString()}\" > /kaniko/.docker/config.json"
|
||||||
|
}
|
||||||
|
sh """
|
||||||
|
/kaniko/executor \\
|
||||||
|
--context "${ws}" \\
|
||||||
|
-f "${ws}/Dockerfile" \\
|
||||||
|
--destination "${config.imageDest}"
|
||||||
|
"""
|
||||||
}
|
}
|
||||||
sh """
|
|
||||||
/kaniko/executor \\
|
|
||||||
--context "${ws}" \\
|
|
||||||
-f "${ws}/Dockerfile" \\
|
|
||||||
--destination "${config.imageDest}"
|
|
||||||
"""
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user