我想在Jenkins管道中使用curl
命令通过ftp上传一些文件。我使用的命令如下所示:
sh "curl --verbose -T my.file --proxytunnel --proxy http://${PROXY_USER}:${PROXY_PASS}@MYPROXY:MYPROXYPORT ftp://${AZURE_USER}:${AZURE_PASS}@MYSITE.ftp.azurewebsites.windows.net/site/wwwroot/"
有时,我连续5次点击Jenkins中的" Build" - 按钮,所有5个版本都成功。然后,10分钟后,我再次点击构建按钮,它连续5次失败 - 没有改变Jenkins工作内的任何内容!
所以它看起来好像有时某种会话被缓存,有时候没有。但我不知道哪种会话,因为我设置了{http|https|ftp|no}_proxy
,PROXY_USER
和AZURE_USER
。
以下是构建失败时的错误消息:
* About to connect() to proxy MYPROXY port 80 (#0)
* Trying 1.2.3.4... connected
* Connected to MYPROXY (1.2.3.4) port 80 (#0)
* Establish HTTP proxy tunnel to MYSITE.ftp.azurewebsites.windows.net:21
* Proxy auth using Basic with user '****'
* Server auth using Basic with user 'MYUSER\****'
> CONNECT MYSITE.ftp.azurewebsites.windows.net:21 HTTP/1.1
> Host: MYSITE.ftp.azurewebsites.windows.net:21
> Proxy-Authorization: Basic xxx-xxx-xxx
> User-Agent: curl/7.19.7 (x86_64-redhat-linux-gnu) libcurl/7.19.7 NSS/3.27.1 zlib/1.2.3 libidn/1.18 libssh2/1.4.2
> Proxy-Connection: Keep-Alive
>
< HTTP/1.1 200 Connection Established
< Proxy-Agent: Zscaler/6.0
<
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0* Proxy replied OK to CONNECT request
< 220 Microsoft FTP Service
> USER MYUSER\****
< 331 Password required
> PASS ****
< 230 User logged in.
> PWD
< 257 "/" is current directory.
* Entry path is '/'
> CWD site
< 250 CWD command successful.
> CWD wwwroot
< 250 CWD command successful.
> EPSV
* Connect data stream passively
< 229 Entering Extended Passive Mode (|||10201|)
* Trying 1.2.3.4... connected
* Connecting to MYSITE.ftp.azurewebsites.windows.net (1.2.3.4) port 80
* Establish HTTP proxy tunnel to MYSITE.ftp.azurewebsites.windows.net:10201
* Proxy auth using Basic with user '****'
* Server auth using Basic with user 'MYUSER\****'
> CONNECT MYSITE.ftp.azurewebsites.windows.net:10201 HTTP/1.1
> Host: MYSITE.ftp.azurewebsites.windows.net:10201
> Proxy-Authorization: Basic xxxxx
> User-Agent: curl/7.19.7 (x86_64-redhat-linux-gnu) libcurl/7.19.7 NSS/3.27.1 zlib/1.2.3 libidn/1.18 libssh2/1.4.2
> Proxy-Connection: Keep-Alive
>
< HTTP/1.1 200 Connection Established
< Proxy-Agent: Zscaler/6.0
<
0 0 0 0 0 0 0 0 --:--:-- 0:00:02 --:--:-- 0* Proxy replied OK to CONNECT request
> TYPE I
< 200 Type set to I.
> STOR web.config
< 150 Opening BINARY mode data connection.
} [data not shown]
104 521 0 0 104 521 0 201 0:00:02 0:00:02 --:--:-- 204* Remembering we are in dir "site/wwwroot/"
104 521 0 0 104 521 0 145 0:00:03 0:00:03 --:--:-- 146
104 521 0 0 104 521 0 113 0:00:04 0:00:04 --:--:-- 114
104 521 0 0 104 521 0 93 0:00:05 0:00:05 --:--:-- 93
104 521 0 0 104 521 0 79 0:00:06 0:00:06 --:--:-- 128
104 521 0 0 104 521 0 68 0:00:07 0:00:07 --:--:-- 0
104 521 0 0 104 521 0 60 0:00:08 0:00:08 --:--:-- 0
104 521 0 0 104 521 0 54 0:00:09 0:00:09 --:--:-- 0
104 521 0 0 104 521 0 49 0:00:10 0:00:10 --:--:-- 0
104 521 0 0 104 521 0 44 0:00:11 0:00:11 --:--:-- 0
104 521 0 0 104 521 0 41 0:00:12 0:00:12 --:--:-- 0
104 521 0 0 104 521 0 38 0:00:13 0:00:13 --:--:-- 0
104 521 0 0 104 521 0 35 0:00:14 0:00:14 --:--:-- 0
104 521 0 0 104 521 0 33 0:00:15 0:00:15 --:--:-- 0
104 521 0 0 104 521 0 31 0:00:16 0:00:16 --:--:-- 0
104 521 0 0 104 521 0 29 0:00:17 0:00:17 --:--:-- 0
104 521 0 0 104 521 0 28 0:00:18 0:00:18 --:--:-- 0
104 521 0 0 104 521 0 26 0:00:20 0:00:19 0:00:01 0
104 521 0 0 104 521 0 25 0:00:20 0:00:20 --:--:-- 0
104 521 0 0 104 521 0 24 0:00:21 0:00:21 --:--:-- 0
104 521 0 0 104 521 0 23 0:00:22 0:00:22 --:--:-- 0
104 521 0 0 104 521 0 22 0:00:23 0:00:23 --:--:-- 0
104 521 0 0 104 521 0 21 0:00:24 0:00:24 --:--:-- 0
104 521 0 0 104 521 0 20 0:00:26 0:00:25 0:00:01 0
104 521 0 0 104 521 0 19 0:00:27 0:00:26 0:00:01 0
104 521 0 0 104 521 0 18 0:00:28 0:00:27 0:00:01 0
104 521 0 0 104 521 0 18 0:00:28 0:00:28 --:--:-- 0
104 521 0 0 104 521 0 17 0:00:30 0:00:29 0:00:01 0
104 521 0 0 104 521 0 17 0:00:30 0:00:30 --:--:-- 0
104 521 0 0 104 521 0 16 0:00:32 0:00:31 0:00:01 0
104 521 0 0 104 521 0 15 0:00:34 0:00:32 0:00:02 0
104 521 0 0 104 521 0 15 0:00:34 0:00:33 0:00:01 0
104 521 0 0 104 521 0 15 0:00:34 0:00:34 --:--:-- 0
104 521 0 0 104 521 0 14 0:00:37 0:00:35 0:00:02 0
104 521 0 0 104 521 0 14 0:00:37 0:00:36 0:00:01 0
104 521 0 0 104 521 0 13 0:00:40 0:00:37 0:00:03 0
104 521 0 0 104 521 0 13 0:00:40 0:00:38 0:00:02 0
104 521 0 0 104 521 0 13 0:00:40 0:00:39 0:00:01 0
104 521 0 0 104 521 0 12 0:00:43 0:00:40 0:00:03 0< 425 Data channel timed out.
* server did not report OK, got 425
104 521 0 0 104 521 0 12 0:00:43 0:00:40 0:00:03 0* Connection #0 to host MYPROXY left intact
curl: (18) server did not report OK, got 425
> QUIT
< 221 Goodbye.
* Closing connection #0
你有什么想法吗?
答案 0 :(得分:0)
解决方案是我必须输入不同的代理服务器。据我所知,我的公司有不同的代理:一些用于“普通”用户,一些用于服务器。服务器使用的代理不需要基本身份验证。使用此代理,它现在可以使用。