-
可以用于所有项目。将 workspace 里面的文件拷贝到服务器上,以便以后访问。这里有个简单例子: https://code.onedev.io/projects/162/files/main/pages/transfer-artifacts-between-jobs.md
-
我弄了两个job测试,job1 publish is successful了, 然后job2里调用 excecute command 来ls了一下当前目录,什么也没有。
这个打包的文件去了哪里?在Pipeline的artifacts里也没看到。 -
把你的测试 build spec 的源文件贴上来看下
-
version: 18 jobs:
- name: build
jobExecutor: executor1
steps:
- !CheckoutStep name: checkout cloneCredential: !DefaultCredential {} withLfs: false withSubmodules: false condition: ALL_PREVIOUS_STEPS_WERE_SUCCESSFUL
- !CommandStep
name: build
runInContainer: false
interpreter: !DefaultInterpreter
commands:
- cargo build
- ls target/debug
- mkdir target/publish
- cp target/debug/alan target/publish useTTY: false condition: ALL_PREVIOUS_STEPS_WERE_SUCCESSFUL
- !PublishArtifactStep name: publish sourcePath: target/publish artifacts: '@[email protected]' condition: ALL_PREVIOUS_STEPS_WERE_SUCCESSFUL triggers:
- !BranchUpdateTrigger {} retryCondition: never maxRetries: 3 retryDelay: 30 cpuRequirement: 250 memoryRequirement: 256 timeout: 3600
- name: get_publish
jobExecutor: executor1
steps:
- !CommandStep
name: ls
runInContainer: false
interpreter: !DefaultInterpreter
commands:
- ls useTTY: false condition: ALL_PREVIOUS_STEPS_WERE_SUCCESSFUL triggers:
- !DependencyFinishedTrigger {} jobDependencies:
- jobName: build requireSuccessful: true artifacts: '**' retryCondition: never maxRetries: 3 retryDelay: 30 cpuRequirement: 250 memoryRequirement: 256 timeout: 3600
- !CommandStep
name: ls
runInContainer: false
interpreter: !DefaultInterpreter
commands:
- name: build
jobExecutor: executor1
steps:
-

-
我这边试了一切正常。你先看下任务 build 的构建,应该有 artifacts 标签栏显示发布的文件。
-

-

-
检查下 @[email protected] 这个文件是否在目录 target/publish 中存在
-
没有的 -
没有文件被publish,那么后续的job也取不到任何文件啊。这不是正常的吗
-
问题是我执行了publish的step啊,为啥没有文件publish呢?
-
所以,这个publish step是干什么的,什么也没有发生
-
将指定的文件永久保存到构建结果里 (Artifacts 标签页),以便后续下载(用户通过网页下载,或者其他任务通过依赖获取进一步处理)
-
对啊,我就是想要这个,但是我的标签页里没有,而且我执行publish 成功了
-
这个步骤的定义是发布所有match 指定 pattern的文件,所以即使没有文件被 match,这个步骤也认为是成功的。
-
知道了,是publish step的Artifacts 设置错误了,我以为这里是指输出物的打包名,结果是过滤From path里的文件啊 改了之后OK了,多谢
-
Previous Value Current Value Open
Closed
| Type |
Question
|
| Priority |
Normal
|
| Assignee |
这个 'Publish Artifacts step' 是不是只能用于java项目,我们的项目是rust的,把这个步骤放后面好像什么事都没发生,也没有找到文档说明这个步骤是怎么工作的。