Upload file to JFrog from Jenkinsfile

4.5k Views Asked by At

I am currently trying to upload a file to my artifactory (JFrog), I have the following code:

script{
def server = Artifactory.server 'jfrog1'
def uploadSpec = """{
    "files": [
        {
            "pattern": "hola.txt",
            "target": "libs-release-local/"
        }
    ]
}"""
server.upload(uploadSpec)

}

However the file does not reach my artifactory and Jenkins does not give an error.

Help and Thanks.

1

There are 1 best solutions below

4
On BEST ANSWER

Can You find file hola.txt directly in workspace? If not try use **/*

server = Artifactory.server 'Artifactory'
def uploadSpec = """{
    "files": [
    {
    "pattern": "**/target/*.war",
    "target": "releases/${APP_REPO}/${version.trim()}/"
    }
    ]}"""
server.upload(uploadSpec)

Above example work correctly.