jenkins 插件Copy Artifacts + Artifacts to copy
问题及遇到的错误:
精简答案:
You are trying to use artifacts without archiving them first.
You are trying to use absolute paths, but they should be relative to $WORKSPACE
and/or "archive location".
完整答案:
You are misunderstanding the concept of "Artifacts" as it relates to Jenkins.
What are Jenkins Artifacts
Artifacts are files that are specifically preserved after the build with the help of Archive the Artifactspost-build action.
When the build runs, it runs within:$WORKSPACE
, which on filesystem usually resides within$JENKINS_HOME/jobs/$JOB_NAME/workspace
Inside there, you can have your SCM checkout folders, temporary build files, final built files, binaries, etc.
The contents of $WORKSPACE
is volatile, you should never rely on it, outside of the build timeframe (and downstream jobs are outside of the build timeframe). The contents of $WORKSPACE
could be different between different master/slave nodes, it could be deleted at any time by admin, or by SCM update/cleanup/checkout.
It's also important to understand that there is only one $WORKSPACE
for the whole Job.
But now pay attention to your Build History, there are several entries in that list, referenced by build number (#) and date timestamp. These are stored under:$JENKINS_HOME/jobs/$JOB_NAME/builds/$BUILD_ID
with $BUILD_ID
being the date-timestamp of the build, like 2014-10-22_11-33-46
The $WORKSPACE
contains the information relevant to current or last (and the problem is: you can never be sure if it's "current" or "last") build;
The builds
folder contains a record of all past (retained) build executions (this is what makes up theBuild History list on your left), per build.
By default, it contains only what Jenkins itself needs: build.xml copy, changelog information, console log. When you go to URL http://$JENKINS_URL/job/$JOB_NAME/[nn]/
where [nn]
is a numeric job build/run number (#), it's reading this information from the builds
folder on the filesystem.
To preserve artifacts of a build (to avoid them being overwritten by the next build, wiped out worskpace, or just to access older builds), you need to Archive the Artifacts (with same post-build action with the same title). When you archive the artifacts, you indicate which files within $WORKSPACE
you want to preserve. When Jenkins does the archiving, it will place those files (keeping paths [relative to $WORKSPACE
] preserved) into:$JENKINS_HOME/jobs/$JOB_NAME/builds/$BUILD_ID/archive/
.
This way, you can have multiple sets of artifacts preserved for previous builds, not just "latest/last" from $WORKSPACE
.
For the sake of completeness, I will mention that Jenkins's "permalinks", such as http://$JENKINS_URL/job/$JOB_NAME/lastSuccessfulBuild
and /lastFailedBuild
, etc are in fact symlinks on the filesystem to one of the preserved builds/$BUILD_ID
folders.
Lastly, you control how many build runs and how many artifacts are retained (can be configured separately) through "Discard old builds" checkmark on job configuration. By default, all are retained, but if you start retaining artifacts, you need to think of hard-disk space capacity.
Solutions to your problem
So with the information above, and looking at your error messages, you should now see that the Copy Artifacts plugin is correctly looking for artifacts under the /archive/
section of a build.
You should also notice that Copy Artifacts plugin does not let you pick "current build" when selecting which build to copy from. It has permalinks (like "last successful" or "last build"), and specific build numbers, all of which translate to preserved builds under $JENKINS_HOME/jobs/$JOB_NAME/builds/$BUILD_ID/archive/
Even "Upstream Build that triggered this job" will link to a specific $BUILD_ID
.
In either of below options
Configuration for Archiving Artifacts is relative to $WORKSPACE
.
Configuration for Copy Artifacts is relative to "archive location", that is $JENKINS_HOME/jobs/$JOB_NAME/builds/$BUILD_ID/archive/
.
Since "Copy Artifacts" is relative to "archive location", and "archive location" is relative to $WORKSPACE
, then for all intensive purposes, the relative paths of both configurations can be same and relative to $WORKSPACE
Option 1
- First Archive the Artifacts with the post-build action, otherwise you have nothing to copy from.
- If you have your files in the root of
$WORKSPACE
, it should be:PROJECTNAME-*/**/*.jar,PROJECTNAME-*/**/*.zip
(Note, not full paths in here)
- If you have your files in the root of
- Then use
Upstream Build that triggered this job
for Copy Artifacts selection.- For Artifacts to copy field use either:
**
or blank to copy all archived artifacts, orPROJECTNAME-*/**/*.jar,PROJECTNAME-*/**/*.zip
(same as the archiving section)
- For Artifacts to copy field use either:
Option 2
If you don't want to archive, you can use $WORKSPACE
directly, with Copy from workspace of latest completed build
, however you must ensure that no second upstream build can run while downstream build is executing, else you risk getting a partial file from a partial build, because as previously explained, $WORKSPACE
is volatile.
- Again, for the Copy Artifacts step, under Artifacts to copy field, use path relative to
$WORKSPACE
, that is:PROJECTNAME-*/**/*.jar,PROJECTNAME-*/**/*.zip
Option 3
If you really want to copy the whole WORKSPACE between different jobs, use either
- Clone Workspace SCM plugin or
- Shared Workspace plugin
更多请参考: http://stackoverflow.com/questions/26525034/jenkis-downstream-job-fails-to-find-upstream-artifacts
jenkins 插件Copy Artifacts + Artifacts to copy的更多相关文章
- jenkins插件使用小结
jenkins官网:https://wiki.jenkins-ci.org/display/JENKINS/Building+a+software+project jenkins插件: 1.AnsiC ...
- 持续集成之Jenkins插件使用(一)- 多个job之间的串并联
转载自:http://qa.blog.163.com/blog/static/190147002201391661510655/ Jenkins除了开源和免费,还有一个最吸引人的功能之一就是支持插件. ...
- 【测试设计】使用jenkins 插件Allure生成漂亮的自动化测试报告
前言 以前做自动化测试的时候一直用的HTMLTestRunner来生成测试报告,后来也尝试过用Python的PyH模块自己构建测试报告,在后来看到了RobotFramework的测试报告,感觉之前用的 ...
- jenkins插件 查看job下次运行时间
文章来自:http://www.ciandcd.com 文中的代码来自可以从github下载: https://github.com/ciandcd jenkins插件next executions( ...
- Jenkins插件及 测试源码
Jenkins 插件: https://updates.jenkins-ci.org/download/plugins/ 小米的一份android源码,测试工具,用于抢红包: https://gith ...
- 文件Copy和文件夹Copy
文件Copy和文件夹Copy using System.Collections.Generic; using System.Linq; using System.Text; using System. ...
- [置顶] operator overloading(操作符重载,运算符重载)运算符重载,浅拷贝(logical copy) ,vs, 深拷贝(physical copy)
operator overloading(操作符重载,运算符重载) 所谓重载就是重新赋予新的意义,之前我们已经学过函数重载,函数重载的要求是函数名相同,函数的参数列表不同(个数或者参数类型).操作符重 ...
- 微软开放技术发布开源 Jenkins 插件以将 Windows Azure Blob 服务用的开作存储库
发布于 2014-02-10 作者 陈 忠岳 持续集成 (CI) 的历史源远流长, 其宗旨在于软件团队在敏捷环境中不断将他们的工作整合为持续构建.管理 CI 进程的工具已存在一段时间.过去几年中 ...
- no copy constructor available or copy constructor is declared 'explicit'
今天新写了一个类.然后对这个类使用STL中的vector,碰到错误: no copy constructor available or copy constructor is declared 'ex ...
随机推荐
- android 学习(1)
第二次发生这种事了,写完啦,手一抖,丢了,这个写完不用博客园了,怪不得用户越来越少 简写 androidstudio安装注意点 1JDK安装需配置环境变量 2安装遇到haxm错误需要进入BIOS打开C ...
- CentOS 6.5 源码编译搭建LNMP(三台独立主机实现)
搭建前准备: 1.三台独立主机 nginx:192.168.1.102 php-fpm:192.168.1.105 mysql:192.168.1.103 2.相关软件的源码包 nginx:nginx ...
- /etc/hosts文件设置不对导致Jboss启动失败
Caused by: javax.management.MBeanRegistrationException: preRegister() failed: [ObjectName='jboss.rem ...
- P1159岳麓山上打水
P1159岳麓山上打水 https://vijos.org/p/1159 dfsID,第一次听说这东西,但是感觉不太靠谱啊. 一开始的时候,想到了排个序后,然后进行dp,如果要输出字典序最小其实还是可 ...
- C#WebClient常见用法
System.Net.WebClient.DownloadFile(Uri address, String fileName) namespace:System.Net 参数: address:The ...
- Spring MVC 文件上传
1.form的enctype=”multipart/form-data” 这个是上传文件必须的 2.applicationContext.xml中 <bean id=”multipartReso ...
- .NET Remoting原理及应用实例:
Remoting:(本文摘自百度百科) 简介: 什么是Remoting,简而言之,我们可以将其看作是一种分布式处理方 式.从微软的产品角度来看,可以说Remoting就是DCOM的一种升 ...
- 《CSS3秘籍》(第三版)-读书笔记(2)
第6章 文本格式化 1. 使用字体 字体font-family: 通用的字体样式: serif字体最适用于冗长的文字信息.这种字体使字母主笔画的结尾处会有一些细小的“足”. sans-serif字体 ...
- PHP 数组函数整理
如果你已经使用了一段时间PHP的话,那么,你应该已经对它的数组比较熟悉了——这种数据结构允许你在单个变量中存储多个值,并且可以把它们作为一个集合进行操作. 经常,开发人员发现在PHP中使用这种数据结构 ...
- wkwebview 和 JS 自用
-(void)webView:(WKWebView *)webView didCommitNavigation:(null_unspecified WKNavigation *)navigation{ ...