Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Declarative Jenkinsfile CIFS share

i have another question about the jenkins pipeline.

How can i publish the build artifacts to a windows share? In normal build jobs there is a "CIFS Publisher" post build action. But how can i use it in

post{
    success {
       //publish build artifacts
    }
}

Is there any example?

like image 432
Kai Mildner Avatar asked Jun 20 '17 08:06

Kai Mildner


2 Answers

I've succesfully managed it in this way:

cifsPublisher alwaysPublishFromMaster: false, continueOnError: false, failOnError: false, publishers: [[
  configName: 'NAME_OF_THE_CIFS_CONFIG', transfers: [[
    cleanRemote: false, 
    excludes: '', 
    flatten: false, 
    makeEmptyDirs: false, 
    noDefaultExcludes: false, 
    patternSeparator: '[, ]+', 
    remoteDirectory: '$BUILD_NUMBER', 
    remoteDirectorySDF: false, 
    removePrefix: '', 
    sourceFiles: 'myfile']], 
  usePromotionTimestamp: false, 
  useWorkspaceInPromotion: false, 
  verbose: true
]]
like image 111
sgargel Avatar answered Nov 12 '22 09:11

sgargel


Please use the auto generate tool in Jenkins to help you. enter image description here

As you can see the highlight link. Click it. enter image description here

Fill all the required value that you expected.

After scroll down and click Generate pipeline script, you will see the syntax that you need.

enter image description here

Last step, copy the generated script into success clause.

like image 31
Charles Wu Avatar answered Nov 12 '22 09:11

Charles Wu