adds artifact push to

This commit is contained in:
Hyatt 2022-01-20 15:03:41 -06:00
parent a59322aa74
commit ea0ed188c1
Signed by: nhyatt
GPG Key ID: C50D0BBB5BC40BEA

View File

@ -28,7 +28,14 @@ spec:
tty: true tty: true
""" """
} }
if (config.fedora == true) {
output += """
- name: fedora
imagePullPolicy: Always
image: ${config.repo}/dockerhub/library/fedora:latest
tty: true
"""
}
return output return output
} }
@ -45,7 +52,7 @@ def deletePod (Map config) {
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"
} }
@ -60,7 +67,7 @@ def buildContainer (Map config, List buildArg = []) {
writeFile (file: ws + "/Dockerfile", text: config.dockerFile) writeFile (file: ws + "/Dockerfile", text: config.dockerFile)
withCredentials([usernameColonPassword( withCredentials([usernameColonPassword(
credentialsId: config.repoCreds, credentialsId: config.repoCreds,
variable: "dCreds", 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"
} }
@ -78,3 +85,18 @@ def buildContainer (Map config, List buildArg = []) {
} }
} }
} }
def pushArtifact (Map config) {
def ws = pwd()
stage ("Push Artifact") {
container ("alpine") {
sh "apk add --no-cache curl"
withCredentials([usernameColonPassword(
credentialsId: config.repoCreds,
variable: "aCreds"
)]) {
sh 'curl --request PUT --user "$aCreds" --upload-file "' + config.fileName + '" "' + config.filePath + '"'
}
}
}
}