Skip to content

Instantly share code, notes, and snippets.

@t3knoid
Created February 2, 2018 16:39
Show Gist options
  • Save t3knoid/69436c466a3c6d5a5a412fb624080efa to your computer and use it in GitHub Desktop.
Save t3knoid/69436c466a3c6d5a5a412fb624080efa to your computer and use it in GitHub Desktop.
Jenkins pipeline script that will copy build artifacts to a CIFS folder
def deployToCIFS(prefix = "", cifsConfig, destination) {
/**
* Copies file artifacts to a given CIFS share and folder.
* This requires the Jenkins Publish over CIFS plugin https://wiki.jenkins.io/display/JENKINS/Publish+Over+CIFS+Plugin
* @param prefix The file artifact's folder prefix. Everything after this prefix will be copied to the destination. The destination will not include this folder structure. Note that this is case-sensitive.
* @cifsConfig The CIFS configuration defined in the Jenkins Publish over CIFS system configuration.
* @destination The folder appended to the CIFS share to create a fully qualified path of the destination.
*/
cifsConfig = 'myShare' // Define a share named "myShare" in the Jenkins Publish over CIFS system configuration
srcFiles = "${prefix}/**/**" // Copy everything after prefix
cifsPublisher alwaysPublishFromMaster: false, continueOnError: false, failOnError: true, publishers: [
[configName: cifsConfig,
transfers: [
[cleanRemote: true, excludes: '', flatten: false, makeEmptyDirs: true, noDefaultExcludes: false, patternSeparator: '[,]+', remoteDirectory: destination, remoteDirectorySDF: false, removePrefix: prefix, sourceFiles: srcFiles],
],
usePromotionTimestamp: false, useWorkspaceInPromotion: false, verbose: false
]
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment