Search code examples
jenkinsbuildjenkins-pluginsartifactory

JFrog Artifactory artifacts uploaded via jenkins dont show up in builds


I use Jenkins to build my project, once that is done I upload the directory with all artifact files or just a single file to JFrog. Pipeline-code example:

def server = Artifactory.server "jfrog1"

sh "touch uploadconfig.json"
writeFile(file: "uploadconfig.json", text: "{ \"files\": [ { \"pattern\": \"./uploadconfig.json\", \"target\": \"test-generic-local/uploadconfig1.json\", \"flat\" : \"true\" }]}")

uploadSpec = readFile 'uploadconfig.json'
uploadInfo = server.upload spec: uploadSpec

When the file is uploaded it has the build.name and build.number property.

But my issue is it will not show up under Artifactory -> Builds.

This is an issue since I want to have the option to download the latest file from this build using:

"files": [
        {
            "pattern": "test-generic-local/uploadconfig*",
            "target": "./",
            "build" : "nameOfMyJenkinsJob/LATEST"
        }
    ]

When I try to run it now without the artifacts being listed under Build I get the following error message:

The build name nameOfMyJenkinsJob could not be found.


Solution

  • I see that you are not publishing the build to Artifactory. Kindly refer to this JFrog wiki on how to publish the build info. Also, I would recommend you referring this Github Jenkins file where in the build publish stage is where the build is pushed.