Issue
You are using a Pipeline Job and the Artifactory plugin to upload some files in a repository
def uploadSpec = """{ "files": [ { "pattern": "bazinga/*froggy*.zip", "target": "bazinga-repo/froggy-files" } ] }""" server.upload(uploadSpec)
but the upload fails with a 404 error
[Pipeline] artifactoryUpload For pattern: bazinga/*froggy*.zip 1 artifacts were found Deploying artifact: https://artifactory.corp.com:8081/bazinga-repo/froggy-files [Pipeline] } [Pipeline] // node [Pipeline] End of Pipeline java.io.IOException: Failed to deploy file: HTTP response code: 404. HTTP response message: Not Found at org.jfrog.build.extractor.clientConfiguration.client.ArtifactoryBuildInfoClient.throwHttpIOException(ArtifactoryBuildInfoClient.java:704) at org.jfrog.build.extractor.clientConfiguration.client.ArtifactoryBuildInfoClient.uploadFile(ArtifactoryBuildInfoClient.java:584) at org.jfrog.build.extractor.clientConfiguration.client.ArtifactoryBuildInfoClient.deployArtifact(ArtifactoryBuildInfoClient.java:282) at org.jfrog.hudson.generic.GenericArtifactsDeployer$FilesDeployerCallable.deploy(GenericArtifactsDeployer.java:206) at org.jfrog.hudson.generic.GenericArtifactsDeployer$FilesDeployerCallable.invoke(GenericArtifactsDeployer.java:178) at org.jfrog.hudson.generic.GenericArtifactsDeployer$FilesDeployerCallable.invoke(GenericArtifactsDeployer.java:122)
Environment
-
CloudBees Jenkins Enterprise
-
Jenkins
-
Pipeline plugin
Resolution
With using Pipeline and the upload information, you need to add the /
in the end of the target to indicate that the deployment is done to a folder.
In the previous sample you need to replace "target": "bazinga-repo/froggy-files"
by "target": "bazinga-repo/froggy-files/"
.
When there is no /
in the end, the file name is actually being changed to the one that you have specified in the target: bazinga-repo/froggy-files
.
This can also cause issues if you already have a folder with that name.
This article is part of our Knowledge Base and is provided for guidance-based purposes only. The solutions or workarounds described here are not officially supported by CloudBees and may not be applicable in all environments. Use at your own discretion, and test changes in a safe environment before applying them to production systems.