adds stages
This commit is contained in:
parent
b0d9923b8b
commit
b5545c64ca
@ -34,38 +34,42 @@ spec:
|
||||
|
||||
def deletePod (Map config) {
|
||||
def ws = pwd()
|
||||
container ("alpine") {
|
||||
sh """
|
||||
apk add --no-cache curl
|
||||
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
|
||||
"""
|
||||
stage ("Delete Pod") {
|
||||
container ("alpine") {
|
||||
sh """
|
||||
apk add --no-cache curl
|
||||
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 ([
|
||||
credentialsId: config.kubeAuth,
|
||||
serverUrl: config.kubeURL,
|
||||
namespace: config.namespace,
|
||||
]) {
|
||||
sh "for i in \$(kubectl get pods --selector ${config.selector} -o name); do kubectl delete \${i}; done"
|
||||
withKubeConfig ([
|
||||
credentialsId: config.kubeAuth,
|
||||
serverUrl: config.kubeURL,
|
||||
namespace: config.namespace,
|
||||
]) {
|
||||
sh "for i in \$(kubectl get pods --selector ${config.selector} -o name); do kubectl delete \${i}; done"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
def buildContainer (Map config) {
|
||||
def ws = pwd()
|
||||
container("kaniko") {
|
||||
writeFile (file: ws + "/Dockerfile", text: config.dockerFile)
|
||||
withCredentials([usernameColonPassword(
|
||||
credentialsId: config.repoCreds,
|
||||
variable: "dCreds",
|
||||
)]) {
|
||||
sh "set +x; printf '{\"auths\":{\"%s\":{\"auth\": \"%s\"}}}' \"${config.repository}\" \"${dcreds.bytes.encodeBase64().toString()}\" > /kaniko/.docker/config.json"
|
||||
stage ("Build Container") {
|
||||
container ("kaniko") {
|
||||
writeFile (file: ws + "/Dockerfile", text: config.dockerFile)
|
||||
withCredentials([usernameColonPassword(
|
||||
credentialsId: config.repoCreds,
|
||||
variable: "dCreds",
|
||||
)]) {
|
||||
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