IIUC, you are missing the body of the withCredentials step, so something like the below should work
... stage ('Upload war to Artifactory') { withCredentials([usernamePassword(credentialsId: 'artifactory', usernameVariable: 'user', passwordVariable: 'password')]) { sh "sudo curl -u $user:$password -T $warPath 'https://artifactory.xxxxxx.com:443/artifactory/form/$warFile'" } } ... Besides of that, the Snippet Generator (https://jenkins.io/doc/book/pipeline/getting-started/#snippet-generator) might help you too Cheers -- You received this message because you are subscribed to the Google Groups "Jenkins Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-users+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/e5b20f73-1211-4fb0-bcbf-1a432685dc25%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.