Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-47156

rtMaven.deployer.deployArtifacts has not effect in deployments

      Environment

      • Jenkins ver. 2.60.1 (see about.md for full details)
      • Artifactory Version 5.2.0

      Issue

      Using this Jenkinsfile use-case: https://github.com/JFrogDev/project-examples/blob/b1470a12863df239ae059f1683158b1555da3a5e/jenkins-pipeline-examples/maven-example/Jenkinsfile and adding exclusions causes and publishing buildinfo as follows 

      node {
      def server = Artifactory.newServer url: 'http://localhost:8081/artifactory/', username: 'admin', password: 'password'
      def rtMaven = Artifactory.newMavenBuild()
      def buildInfo
      
      stage ('Clone') {
      git url: 'https://github.com/jfrogdev/project-examples.git'
      }
      
      stage ('Artifactory configuration') {
      rtMaven.tool = 'm3' // Tool name from Jenkins configuration
      rtMaven.deployer releaseRepo: 'libs-release-local', snapshotRepo: 'libs-snapshot-local', server: server
      rtMaven.resolver releaseRepo: 'libs-release', snapshotRepo: 'libs-snapshot', server: server
      rtMaven.deployer.artifactDeploymentPatterns.addExclude("*.jar, *.pom")
      buildInfo = Artifactory.newBuildInfo()
      }
      
      stage ('Install') {
      rtMaven.run pom: 'maven-example/pom.xml', goals: 'install', buildInfo: buildInfo
      }
      
      stage ('Deploy') {
      echo ">>> BUILD NUMBER >>>" + env.BUILD_NUMBER
      rtMaven.deployer.deployArtifacts = false
      rtMaven.deployer.deployArtifacts buildInfo
      }
      
      stage ('Publish build info') {
      server.publishBuildInfo buildInfo
      }
      }
      

      It is observed that the flag does not work according to what is explained in https://www.jfrog.com/confluence/display/RTF/Working+With+Pipeline+Jobs+in+Jenkins ... "you want to disable artifacts deployment to Artifactory"

       rtMaven.deployer.deployArtifacts = false

      .. because the deployment is happening to artifactory as can be seen in the following console output

       

      [Pipeline] echo >>> BUILD NUMBER >>>30 [Pipeline] deployArtifacts Artifactory Deployer: Skipping the deployment of 'org/jfrog/test/multi2/3.7-SNAPSHOT/multi2-3.7-SNAPSHOT.jar' due to the defined include-exclude patterns. Artifactory Deployer: Skipping the deployment of 'org/jfrog/test/multi2/3.7-SNAPSHOT/multi2-3.7-SNAPSHOT.pom' due to the defined include-exclude patterns. Artifactory Deployer: Skipping the deployment of 'org/jfrog/test/multi1/3.7-SNAPSHOT/multi1-3.7-SNAPSHOT-tests.jar' due to the defined include-exclude patterns. Artifactory Deployer: Skipping the deployment of 'org/jfrog/test/multi1/3.7-SNAPSHOT/multi1-3.7-SNAPSHOT-sources.jar' due to the defined include-exclude patterns. Artifactory Deployer: Skipping the deployment of 'org/jfrog/test/multi1/3.7-SNAPSHOT/multi1-3.7-SNAPSHOT.jar' due to the defined include-exclude patterns. Artifactory Deployer: Skipping the deployment of 'org/jfrog/test/multi1/3.7-SNAPSHOT/multi1-3.7-SNAPSHOT.pom' due to the defined include-exclude patterns. Artifactory Deployer: Skipping the deployment of 'org/jfrog/test/multi/3.7-SNAPSHOT/multi-3.7-SNAPSHOT.pom' due to the defined include-exclude patterns. Artifactory Deployer: Skipping the deployment of 'org/jfrog/test/multi3/3.7-SNAPSHOT/multi3-3.7-SNAPSHOT.pom' due to the defined include-exclude patterns. Deploying artifact:
      http://localhost:8081/artifactory/libs-snapshot-local/org/jfrog/test/multi3/3.7-SNAPSHOT/multi3-3.7-SNAPSHOT.war
      Deploying artifact:
      http://localhost:8081/artifactory/libs-snapshot-local/org/jfrog/test/multi3/3.7-SNAPSHOT/multi3-3.7-SNAPSHOT.war
      [Pipeline] } [Pipeline] // stage [Pipeline] stage [Pipeline] { (Publish build info) [Pipeline] publishBuildInfo Deploying build info to:
      http://localhost:8081/artifactory/api/build
      Deploying build descriptor to:
      http://localhost:8081/artifactory/api/build
      Build successfully deployed. Browse it in Artifactory under
      http://localhost:8081/artifactory/webapp/builds/ZD-52801_maven/30
      

       

      as well as in the Artifactory Server

       
       

       

       

       

          [JENKINS-47156] rtMaven.deployer.deployArtifacts has not effect in deployments

          carlosrodlop,

          In order to prevent artifacts to be deployed to Artifactory you need to add the following code line before you run the build.

          rtMaven.deployer.deployArtifacts = false
          

          In your case the second line in 'Deploy' stage should be inside 'Artifactory configuration' stage.

          Roman Gurevitch added a comment - carlosrodlop , In order to prevent artifacts to be deployed to Artifactory you need to add the following code line before you run the build. rtMaven.deployer.deployArtifacts = false In your case the second line in ' Deploy ' stage should be inside ' Artifactory configuration ' stage.

            eyalbe Eyal Ben Moshe
            carlosrodlop Carlos Rodríguez López
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: