node { stage('checkout') { git url: 'https://github.com//project-examples.git' sh 'git pack-refs --all' } stage('package') { sh 'zip -rq webhook-test-1.0.0-develop.1.zip README' } stage('publish') { publish() } } def String getUploadSpec() { def uploadSpec = """{ "files": [ { "pattern": "./*.zip", "target": "generic-local/TDP/webhook-test/1.0.0-develop.1/" } ] }""" return uploadSpec } def publish() { def server = Artifactory.server "jfrglocalart" def buildInfo = getBuildInfo() uploadSpec(getUploadSpec(), server, buildInfo) publishBuildInfo(server, buildInfo) return buildInfo } def getArtifactoryServer(String artifactoryBaseUrl, String artifactoryUser, String artifactoryPassword) { def server = Artifactory.newServer url: "https://${artifactoryBaseUrl}/artifactory", username: artifactoryUser, password: artifactoryPassword return server } def getBuildInfo() { return Artifactory.newBuildInfo() } def uploadSpec(String spec, server, buildInfo) { server.upload spec: spec, buildInfo: buildInfo } def publishBuildInfo(server, buildInfo) { server.publishBuildInfo buildInfo }