Jenkinsfile CIFSPublisher不使用通配符复制正确的文件 [英] Jenkinsfile cifsPublisher not copying right files using wildcards

查看:506
本文介绍了Jenkinsfile CIFSPublisher不使用通配符复制正确的文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的Jenkins脚本化管道中,我尝试使用 cifsPublisher

In my Jenkins scripted pipeline I'm trying to copy files to a remote Windows Share using cifsPublisher

如记录在此处,我应该使用myPrj/deploy/**/*sourceFiles模式,但不是我希望复制的文件.

As documented here I should use myPrj/deploy/**/* as sourceFiles pattern but files I expect to be copied are not.

这是我的Jenkinsfile步骤:

This is my Jenkinsfile step:

stage('Save WAR'){
    //
    sh 'ls -laR ./myPrj/deploy/'
    //
    cifsPublisher(publishers: [[
        configName: 'myConfig',
        transfers: [[cleanRemote: false,
            excludes: '',
            flatten: false,
            makeEmptyDirs: true,
            noDefaultExcludes: false,
            patternSeparator: '',
            remoteDirectory: 'Server',
            remoteDirectorySDF: false,
            removePrefix: '',
            sourceFiles: './myPrj/deploy/**/*' ]],
        usePromotionTimestamp: false,
        useWorkspaceInPromotion: false,
        verbose: true]])        
}

这是详细的输出:

+ ls -laR ./myPrj/deploy/
./myPrj/deploy/:
totale 0
drwxr-xr-x  3 jenkins jenkins  41 ago  3 11:55 .
drwxr-xr-x 11 jenkins jenkins 299 ago  3 11:56 ..
drwxr-xr-x  2 jenkins jenkins  65 ago  3 11:57 myPrj-01.01.01-201808031155

./myPrj/deploy/myPrj-01.01.01-201808031155:
totale 443392
drwxr-xr-x 2 jenkins jenkins        65 ago  3 11:57 .
drwxr-xr-x 3 jenkins jenkins        41 ago  3 11:55 ..
-rw-r--r-- 1 jenkins jenkins 269154173 ago  3 11:57 Dist.zip
-rw-r--r-- 1 jenkins jenkins       168 ago  3 11:55 INFO.txt
-rw-r--r-- 1 jenkins jenkins 184870342 ago  3 11:57 myPrj##01.01.01.war
[Pipeline] cifsPublisher
CIFS: Connecting from host [jenkins]
CIFS: Connecting with configuration [myConfig] ...
CIFS: Removing WINS from name resolution
CIFS: Setting response timeout [30.000]
CIFS: Setting socket timeout [35.000]
CIFS: Setting buffer size to: [4.096] Bytes
CIFS: copy [smb://WinServer/SHARE/Jenkins/Server/.com.apple.timemachine.supported]
CIFS: copy [smb://WinServer/SHARE//Jenkins/Server/Jenkinsfile]
CIFS: copy [smb://WinServer/SHARE/Jenkins/Server/build.gradle]
CIFS: copy [smb://WinServer/SHARE/Jenkins/Server/gradlew]
CIFS: copy [smb://WinServer/SHARE/Jenkins/Server/gradlew.bat]
CIFS: copy [smb://WinServer/SHARE/Jenkins/Server/sonar-project.properties]
CIFS: copy [smb://WinServer/SHARE/Jenkins/Server/vstop.png]
CIFS: Disconnecting configuration [myConfig] ...
CIFS: Transferred 7 file(s)
[Pipeline] }
[Pipeline] // stage
[Pipeline] }
[Pipeline] // node
[Pipeline] End of Pipeline
Finished: SUCCESS

要复制的文件来自工作区根目录.

Files that are copied are from the workspace root directory.

我在哪里做错了?

推荐答案

我不知道这是否是一个错误,但是我找到了使用dir并将patternSeparator设置为/

I don't know if it's a bug but i found a workaround using dir and setting patternSeparator to /

stage('Save WAR'){
    dir('myPrj/deploy/') {
        cifsPublisher(publishers: [[
            configName: 'myConfig',
            transfers: [[cleanRemote: false,
                excludes: '',
                flatten: false,
                makeEmptyDirs: true,
                noDefaultExcludes: false,
                patternSeparator: '/',
                remoteDirectory: "Server/",
                remoteDirectorySDF: false,
                removePrefix: '',
                sourceFiles: '**/*' ]],
            usePromotionTimestamp: false,
            useWorkspaceInPromotion: false,
            verbose: true]]
        )
    }
}

这篇关于Jenkinsfile CIFSPublisher不使用通配符复制正确的文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆