From 361a620085163b97cef4cdc637104a57f8ea6816 Mon Sep 17 00:00:00 2001 From: The_Spider Date: Fri, 18 Feb 2022 12:15:28 -0600 Subject: [PATCH] adds declarative cersion of pushArtifact --- vars/declarativeFunctions.groovy | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 vars/declarativeFunctions.groovy diff --git a/vars/declarativeFunctions.groovy b/vars/declarativeFunctions.groovy new file mode 100644 index 0000000..379c90d --- /dev/null +++ b/vars/declarativeFunctions.groovy @@ -0,0 +1,20 @@ +#!groovy + +def pushArtifact (Map config) { + def ws = pwd() + stage ("Push Artifact: " + config.fileName) { + steps { + container ("alpine") { + script { + sh "apk add --no-cache curl" + withCredentials([usernameColonPassword( + credentialsId: config.repoCreds, + variable: "aCreds" + )]) { + sh 'curl --fail --request PUT --user "$aCreds" --upload-file "' + config.filePath + config.fileName + '" "' + config.fileURL + config.fileName + '"' + } + } + } + } + } +} \ No newline at end of file