问题
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
回答1:
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
回答2:
jenkins/packagecloud plugin author here --
Sorry, you ran into these issues! The plugin should only "see" files that match the fingerprinting pattern, so just changing that should've been enough (unless theres a bug).
来源:https://stackoverflow.com/questions/42384378/jenkins-packagecloud-upload-missing-artifact-fingerprint-no-such-file-or-d