如何通过URL访问Jenkins在lastSuccessfulBuild中创建的工件? [英] How can I access artifacts created by Jenkins in the lastSuccessfulBuild through a URL?

查看:532
本文介绍了如何通过URL访问Jenkins在lastSuccessfulBuild中创建的工件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Jenkins管道构建Android应用程序.

I'm building an Android application using Jenkins pipeline.

构建成功完成后,它将创建一个.apk文件.

When a build finishes successfully, it creates an .apk file.

我希望质量检查小组的成员能够下载该文件并在将其上传到Google商店之前测试该应用程序,因此我希望这些用户(可以访问Jenkins服务器)可以通过Jenkins服务器上的URL,如在此问题中显示的那样,但由于某种原因,我用于尝试下载工件的消息不断给我404错误.

I want members of the QA team to be able to download this file and test the application before uploading it Google store and so I want these users (which have access to the Jenkins server) to be able to access the artifact through a URL on the Jenkins server as shown in this SO question but for some reason the URL I'm using to try and download the artifact keeps giving me 404 error.

这些是我尝试访问但无济于事的链接:

These are the links I'm trying to access but to no avail:

https://company-ci-server.company.net/job/Itai_repos/job/Product-Android/job/develop/lastSuccessfulBuild/build/outputs/apk/Company-production-release.apk

https://company-ci-server.company.net/job/Itai_repos/job/Product-Android/job/develop/lastSuccessfulBuild/artifact/product-production-release.apk

该作业被配置为多分支,这意味着Jenkins正在GitHub中监视项目,索引所有分支,并且每当提交发生时,一项作业就开始了...这就是为什么链接如此之长以防万一您想知道的原因. ..

The job is configured as multi-branch which means that Jenkins is watching the project in GitHub, indexes all the branches and whenever a commit happens a job is starting... that is why the link is so long incase you wondered...

那么我在做什么错了?为什么我不能通过URL访问工件?

So what am I doing wrong? Why can't I access the artifacts through a URL?

推荐答案

如果有人感兴趣,因为我自己在编写管道,而且我没有使用GUI来配置我的工作,那么我就缺少了管道中的实际归档,这是相关的丢失代码:

If it interests anyone, because I'm writing the pipeline myself and I'm not using the GUI to configure my job then I was missing the part of the actual archiving in the pipeline, here's the relevant missing code:

step([$class: 'ArtifactArchiver', artifacts: '**/build/outputs/apk/*.apk', fingerprint: false])

此步骤告诉Jenkins在给定路径中查找apk文件. 然后,詹金斯(Jenkins)发布了apk,您可以通过URL进行访问:

This step tells Jenkins to look for apk files in the given path. Then Jenkins publishes the apk and you can access it through URL:

https://ci-server.company.net/job/Itai_repos/job/Products-Android/job/develop/<BUILD_NUMBER>/artifact/

谢谢

这篇关于如何通过URL访问Jenkins在lastSuccessfulBuild中创建的工件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆