Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // requires ssh pipeline steps plugin
- //preliminary schtuff
- def destDir = '/srv/buildfiles'
- def remote = [:]
- remote.name = '<servername>'
- remote.host = '<FQDN or IP address>'
- remote.allowAnyHosts = true
- // Get the date and git sha tag
- def date = sh (script:'date +%Y%m%d', returnStdout: true).trim()
- def gitTag = sh (script: 'git describe --always --match "v[0-9].*"', returnStdout: true).trim()
- //append these to your destdir root path
- destDir += "/${date}-${gitTag}"
- //publish it
- stage("Publish Bitstream"){
- if (fileExists("build_${gbsName}/megh_sira_DCPRCA10_${gbsName}.gbs")) {
- withCredentials([sshUserPrivateKey(credentialsId: '<your credentials key goes here>', keyFileVariable: 'userKey', passphraseVariable: 'userPass', usernameVariable: 'userName')]) {
- remote.user = userName
- remote.identityFile = userKey
- sshCommand remote: remote, command: "mkdir -p ${destDir}"
- sshPut remote: remote, from:"<file or directory to publish>", into: destDir
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement