2
votes

I need my Jenkins build to fail in case zero artifacts are uploaded into the artifactory.

I have included failNoOp into my upload spec but it seems it's not working in my Jenkinsfile. Here is my code:

def server = Artifactory.newServer url: env.ArtifactoryServerTEST, credentialsId:'ArtifactoryUATServerKey'
server.bypassProxy = true                   
def uploadSpec = """{
    "files": [
        {
            "pattern": "final_artifacts/*.gz",
            "target": "test/"
        }
    ]
}"""

server.upload spec: uploadSpec, failNoOp: true

This needs to fail my build if none of the artifacts are uploaded into the artifactory, but it is giving me this error:

java.lang.IllegalArgumentException: Only the following arguments are allowed, [spec, buildInfo]

I'm using Artifactory OSS Version 6.2.0. anyone can help me on this?

1
The failNoOp argument was introduced on jenkins-artifactory-plugin v3.0.0. What is your plugin's version? - yahavi
Unfortunately i'am using version 2.16.2. thanks for the comment. I will check after updating the plugin and confirm. - hlesnt395
Thanks for your comment. it fixed my problem after upgrading the plugin. - hlesnt395

1 Answers

3
votes

As @yahavi mentioned, I could fix this problem by upgrade the artifactory plugin. I updated to the latest, so as at now current latest version is 3.3.2.