Jenkins从构建参数计读取文件(zip)

时间:2015-11-24 23:51:23

标签: jenkins

[jenkins新手]我试图从输入中读取文件(参数化构建)。并将其用于wget并下载到服务器/从服务器上。

示例:当我们单击Build with parameter时,它应该询问托管在服务器文件格式(http://xxx/xxx/xxx/xx.zip)上的zip文件位置,并且在构建步骤中我需要这样的东西:ssh xxxxx [host ]:'cd / temp / abc;来自参数'

的wget文件

如何配置?

1 个答案:

答案 0 :(得分:0)

这是一个非常基本的问题。

使用String参数创建作业:

enter image description here

接下来,使用添加"执行shell"建立这样的步骤:

enter image description here

如果要在特定计算机上下载文件,只需在此计算机上启动Jenkins从属代理并在此从属服务器上执行作业(而不是在主服务器上运行作业)。

使用文件URL启动您的构建:

enter image description here

Started by user anonymous
[EnvInject] - Loading node environment variables.
Building on master in workspace /var/lib/jenkins/jobs/Test wget with parameter/workspace
[workspace] $ /bin/bash /tmp/hudson3280603023156720832.sh
--2015-11-25 09:47:32--  http://http.debian.net/debian/pool/main/p/p7zip/p7zip_9.20.1~dfsg.1.orig.tar.gz
Resolving http.debian.net... 5.153.231.35, 128.31.0.66, 176.9.184.93, ...
Connecting to http.debian.net|5.153.231.35|:80... connected.
HTTP request sent, awaiting response... 301 Moved Permanently
Location: http://debian.univ-lorraine.fr/debian/pool/main/p/p7zip/p7zip_9.20.1~dfsg.1.orig.tar.gz [following]
--2015-11-25 09:47:32--  http://debian.univ-lorraine.fr/debian/pool/main/p/p7zip/p7zip_9.20.1~dfsg.1.orig.tar.gz
Resolving debian.univ-lorraine.fr... 193.54.21.4
Connecting to debian.univ-lorraine.fr|193.54.21.4|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 4215388 (4.0M) [application/x-gzip]
Saving to: “/tmp/test.zip”

     0K .......... .......... .......... .......... ..........  1% 1.28M 3s
    50K .......... .......... .......... .......... ..........  2% 2.46M 2s
   100K .......... .......... .......... .......... ..........  3% 2.63M 2s
   150K .......... .......... .......... .......... ..........  4% 10.7M 2s
   200K .......... .......... .......... .......... ..........  6% 2.71M 2s