diff --git a/vars/functions.groovy b/vars/functions.groovy index e9facb0..fb046db 100644 --- a/vars/functions.groovy +++ b/vars/functions.groovy @@ -28,7 +28,14 @@ spec: tty: true """ } - + if (config.fedora == true) { + output += """ + - name: fedora + imagePullPolicy: Always + image: ${config.repo}/dockerhub/library/fedora:latest + tty: true +""" + } return output } @@ -45,7 +52,7 @@ def deletePod (Map config) { withKubeConfig ([ credentialsId: config.kubeAuth, 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" } @@ -60,7 +67,7 @@ def buildContainer (Map config, List buildArg = []) { writeFile (file: ws + "/Dockerfile", text: config.dockerFile) withCredentials([usernameColonPassword( 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" } @@ -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 + '"' + } + } + } +} \ No newline at end of file