问题描述
使用:
Jenkins: 2.7.2
PackageCloud插件: 1.11
在packagecloud.io网站中创建了一个新的试用帐户,创建了一个新的私有存储库(URL仅用于: https: //packagecloud.io/arunsangal/deb_stuff ).
根据文档,我在 packagecloud.io 新域下创建了一个新的Jenkins凭据.然后,在Jenkins packagecloud.io域凭证中,我创建了一个新用户( arunsangal ),并提供了密码值(即,我从packagecloud.io网站获得的生成的API令牌),并根据该插件的文档.
接下来,我创建了一个Jenkins作业,该作业成功创建了一个.deb软件包文件.这是我要上传到packagecloud.io私有存储库中的私有存储库的文件: https://packagecloud.io/arunsangal/deb_stuff
在工作中,我看到.deb文件已成功生成.在构建后操作中,我使用指纹选项来查找/指纹化我的.deb文件(即Glob模式: deb-builder/ .deb *).
在Jenkins作业的build#页面上,它成功显示出对于给定的build#,当我单击 See Fingerprints 链接时(Jenkins作业的左侧区域),该文件具有有效的.deb文件.
但是将同一工件推送到packagecloud的构建后操作/步骤不起作用.由于某种原因,它试图在Jenkins作业的工作空间的根目录中找到文件(即使我在指纹识别步骤中提到.deb文件位于"deb-builder"文件夹下).
获取此错误消息:
06:03:36 Recording fingerprints
06:03:37 2017-02-22T06:03:37.789+0000 [org.jenkinsci.plugins.packagecloud.ArtifactPublisher] Verbose Logging Enabled
06:03:37 2017-02-22T06:03:37.790+0000 [org.jenkinsci.plugins.packagecloud.ArtifactPublisher] Build Status: SUCCESS
06:03:37 2017-02-22T06:03:37.794+0000 [org.jenkinsci.plugins.packagecloud.ArtifactPublisher] Job configured with: { repo: deb_stuff, distro: 20, username: arunsangal }
06:03:37 2017-02-22T06:03:37.795+0000 [org.jenkinsci.plugins.packagecloud.ArtifactPublisher] Fingerprinting: found 1 fingerprints
06:03:37 2017-02-22T06:03:37.799+0000 [org.jenkinsci.plugins.packagecloud.ArtifactPublisher] Finding valid Packages (findValidPackages)
06:03:37 2017-02-22T06:03:37.800+0000 [org.jenkinsci.plugins.packagecloud.ArtifactPublisher] Processing: wfcli_5.0.10-22_amd64.deb
06:03:37 ERROR: Step ‘Push to packagecloud.io’ aborted due to exception:
06:03:37 java.io.FileNotFoundException: /var/lib/jenkins/workspace/Dummy_create_wfcli_deb_package/wfcli_5.0.10-22_amd64.deb (No such file or directory)
06:03:37 at java.io.FileInputStream.open(Native Method)
06:03:37 at java.io.FileInputStream.<init>(FileInputStream.java:146)
06:03:37 at hudson.FilePath.read(FilePath.java:1779)
06:03:37 at org.jenkinsci.plugins.packagecloud.ArtifactPublisher.findValidPackages(ArtifactPublisher.java:303)
06:03:37 at org.jenkinsci.plugins.packagecloud.ArtifactPublisher.perform(ArtifactPublisher.java:211)
06:03:37 at hudson.tasks.BuildStepMonitor$3.perform(BuildStepMonitor.java:45)
06:03:37 at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:779)
06:03:37 at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:720)
06:03:37 at hudson.model.Build$BuildExecution.post2(Build.java:185)
06:03:37 at hudson.model.AbstractBuild$AbstractBuildExecution.post(AbstractBuild.java:665)
06:03:37 at hudson.model.Run.execute(Run.java:1766)
06:03:37 at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
06:03:37 at hudson.model.ResourceController.execute(ResourceController.java:98)
06:03:37 at hudson.model.Executor.run(Executor.java:410)
似乎插件的构建后步骤没有寻找正确的位置(或能够找到正确的路径)来查找成功完成指纹识别步骤的包装/工件(根据上述std输出). /p>
在Github中: https://github.com/jenkinsci/packagecloud-plugin ,似乎有关文件是: packagecloud- plugin/src/main/java/org/jenkinsci/plugins/packagecloud/ArtifactPublisher.java
根据上述输出,packagecloud的构建后步骤尝试在以下位置找到.deb文件:/var/lib/jenkins/workspace/Dummy_create_wfcli_deb_package/wfcli_5.0.10-22_amd64.deb
位置尽管该文件实际上存在于:/var/lib/jenkins/workspace/Dummy_create_wfcli_deb_package/deb-builder/wfcli_5.0.10-22_amd64.deb
到目前为止,此Jenkins PackageCloud插件期望仅从Jenkins作业的工作空间/根目录位置中选取文件.
因此,在我的情况下,在给定的deb-builder
文件夹中创建了软件包之后,我必须执行以下操作,将所有* .deb文件从deb-builder复制到JOB的WORKSPACE位置:
cp deb-builder/*.deb ..
接下来,在指纹识别中,我将模式更改为*.deb
(而不是deb-builder/*.deb
)
此后,构建后操作Push To pacakgecloud.io
操作按预期方式工作.
也可以在此处查看相关问题(在解决此问题后我看到了):
Using:
Jenkins: 2.7.2
PackageCloud Plugin: 1.11
Created a new trial account in packagecloud.io site, created a new private repository (URL just fyr: https://packagecloud.io/arunsangal/deb_stuff).
As per the docs, I created a new Jenkins credential under packagecloud.io new domain. Then, in Jenkins packagecloud.io domain credential, I created a new user (arunsangal) and provided the password value (i.e. the generated API token which I got packagecloud.io site) and configured it as per the documentation on this plugin.
Next, I created a Jenkins job, which is creating a .deb package file successfully. This is the file, that I want to upload to a private repository in packagecloud.io private repository here: https://packagecloud.io/arunsangal/deb_stuff
Inside the job, I see my .deb file is generated successfully.In the post-build action, I'm using fingerprinting option to find/fingerprint my .deb file (i.e. Glob pattern: deb-builder/.deb*).
On the Jenkins job's build# page, it's successfully showing that for a given build#, it has valid .deb file when I click See Fingerprints link (left hand side area of the Jenkins job).
But the post-build action/step for pushing the same artifact to packagecloud is NOT working. For some reason, it's trying to find the file in the root of the workspace of my Jenkins job (even though I have mentioned in the fingerprinting step that the .deb file is under "deb-builder" folder).
Getting this error message:
06:03:36 Recording fingerprints
06:03:37 2017-02-22T06:03:37.789+0000 [org.jenkinsci.plugins.packagecloud.ArtifactPublisher] Verbose Logging Enabled
06:03:37 2017-02-22T06:03:37.790+0000 [org.jenkinsci.plugins.packagecloud.ArtifactPublisher] Build Status: SUCCESS
06:03:37 2017-02-22T06:03:37.794+0000 [org.jenkinsci.plugins.packagecloud.ArtifactPublisher] Job configured with: { repo: deb_stuff, distro: 20, username: arunsangal }
06:03:37 2017-02-22T06:03:37.795+0000 [org.jenkinsci.plugins.packagecloud.ArtifactPublisher] Fingerprinting: found 1 fingerprints
06:03:37 2017-02-22T06:03:37.799+0000 [org.jenkinsci.plugins.packagecloud.ArtifactPublisher] Finding valid Packages (findValidPackages)
06:03:37 2017-02-22T06:03:37.800+0000 [org.jenkinsci.plugins.packagecloud.ArtifactPublisher] Processing: wfcli_5.0.10-22_amd64.deb
06:03:37 ERROR: Step ‘Push to packagecloud.io’ aborted due to exception:
06:03:37 java.io.FileNotFoundException: /var/lib/jenkins/workspace/Dummy_create_wfcli_deb_package/wfcli_5.0.10-22_amd64.deb (No such file or directory)
06:03:37 at java.io.FileInputStream.open(Native Method)
06:03:37 at java.io.FileInputStream.<init>(FileInputStream.java:146)
06:03:37 at hudson.FilePath.read(FilePath.java:1779)
06:03:37 at org.jenkinsci.plugins.packagecloud.ArtifactPublisher.findValidPackages(ArtifactPublisher.java:303)
06:03:37 at org.jenkinsci.plugins.packagecloud.ArtifactPublisher.perform(ArtifactPublisher.java:211)
06:03:37 at hudson.tasks.BuildStepMonitor$3.perform(BuildStepMonitor.java:45)
06:03:37 at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:779)
06:03:37 at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:720)
06:03:37 at hudson.model.Build$BuildExecution.post2(Build.java:185)
06:03:37 at hudson.model.AbstractBuild$AbstractBuildExecution.post(AbstractBuild.java:665)
06:03:37 at hudson.model.Run.execute(Run.java:1766)
06:03:37 at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
06:03:37 at hudson.model.ResourceController.execute(ResourceController.java:98)
06:03:37 at hudson.model.Executor.run(Executor.java:410)
It seems like, the plugin post-build step is not looking at the correct location (or able to find the correct path) for finding the package/artifact which fingerprinting step successfully found (per the above mentioned std output).
In Github: https://github.com/jenkinsci/packagecloud-plugin, it seems like the concerned file is: packagecloud-plugin/src/main/java/org/jenkinsci/plugins/packagecloud/ArtifactPublisher.java
As per the above output, packagecloud post-build step is trying to find the .deb file at: /var/lib/jenkins/workspace/Dummy_create_wfcli_deb_package/wfcli_5.0.10-22_amd64.deb
location though the file is actually present at: /var/lib/jenkins/workspace/Dummy_create_wfcli_deb_package/deb-builder/wfcli_5.0.10-22_amd64.deb
As of now, this Jenkins PackageCloud plugin is expecting the files to be picked ONLY from the Jenkins job's workspace / root location.
So after the package(s) were created in a given deb-builder
folder in my case, I had to copy all those *.deb files from deb-builder to the JOB's WORKSPACE location by doing the following:
cp deb-builder/*.deb ..
Next, in the fingerprinting, I changed the pattern to *.deb
(instead of deb-builder/*.deb
)
After this, the post build action Push To pacakgecloud.io
action worked as expected.
Also see related issue (that I saw after the resolution of this post) here: Jenkins packagecloud plugin - upload of a package ex .deb failed if it already exist
这篇关于Jenkins PackageCloud上传-缺少工件-指纹-没有此类文件或目录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!