#968  Publish Artifacts step nothing happens
Closed
alan opened 1 year ago

这个 'Publish Artifacts step' 是不是只能用于java项目,我们的项目是rust的,把这个步骤放后面好像什么事都没发生,也没有找到文档说明这个步骤是怎么工作的。

Robin Shen commented 1 year ago

可以用于所有项目。将 workspace 里面的文件拷贝到服务器上,以便以后访问。这里有个简单例子: https://code.onedev.io/projects/162/files/main/pages/transfer-artifacts-between-jobs.md

alan commented 1 year ago

image.png 我弄了两个job测试,job1 publish is successful了, 然后job2里调用 excecute command 来ls了一下当前目录,什么也没有。 这个打包的文件去了哪里?在Pipeline的artifacts里也没看到。

Robin Shen commented 1 year ago

把你的测试 build spec 的源文件贴上来看下

alan commented 1 year ago

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: '@project_name@.zip' 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
alan commented 1 year ago

image_2.png

Robin Shen commented 1 year ago

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

alan commented 1 year ago

image_3.png

alan commented 1 year ago

image_4.png

Robin Shen commented 1 year ago

检查下 @project_name@.zip 这个文件是否在目录 target/publish 中存在

alan commented 1 year ago

image_5.png 没有的

Robin Shen commented 1 year ago

没有文件被publish,那么后续的job也取不到任何文件啊。这不是正常的吗

alan commented 1 year ago

问题是我执行了publish的step啊,为啥没有文件publish呢?

alan commented 1 year ago

所以,这个publish step是干什么的,什么也没有发生

Robin Shen commented 1 year ago

将指定的文件永久保存到构建结果里 (Artifacts 标签页),以便后续下载(用户通过网页下载,或者其他任务通过依赖获取进一步处理)

alan commented 1 year ago

对啊,我就是想要这个,但是我的标签页里没有,而且我执行publish 成功了

Robin Shen commented 1 year ago

这个步骤的定义是发布所有match 指定 pattern的文件,所以即使没有文件被 match,这个步骤也认为是成功的。

alan commented 1 year ago

知道了,是publish step的Artifacts 设置错误了,我以为这里是指输出物的打包名,结果是过滤From path里的文件啊 改了之后OK了,多谢

Robin Shen changed state to 'Closed' 1 year ago
Previous Value Current Value
Open
Closed
issue 1 of 1
Type
Question
Priority
Normal
Assignee
Issue Votes (0)
Watchers (3)
Reference
onedev/server#968
Please wait...
Page is in error, reload to recover