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

Artifactory dsl code is not loading target repository in the configuration

      Artifactory configuration with dsl as follows. Target repository is empty but config.xml has the value 'libs-snaphost-local'. I attached the screenshot with it. This configuration is for .net

      artifactoryGenericConfigurator {
      details {
      artifactoryName('http://<ip>:<port>/artifactory')
      artifactoryUrl('http://<ip>:<port>/artifactory')
      deployReleaseRepository

      { keyFromText('libs-snapshot-local') keyFromSelect('') dynamicMode(false) }

      }
      deployPattern('*.zip')
      }

      Above configuration is failing with following error.

      18:10:05 Time Elapsed 00:00:10.80
      18:10:05 For pattern: *.zip 1 artifacts were found
      18:10:06 ERROR: Target repository cannot be empty
      18:10:06 java.lang.IllegalArgumentException: Target repository cannot be empty

          [JENKINS-36303] Artifactory dsl code is not loading target repository in the configuration

          Praveen A added a comment - - edited

          No eyalbe, It didn't help either.

          I actually tried these combinations first time itself but never worked out.

          Please let me know what config-as-code is working for you at your environment.

          Thanks,
          Praveen

          Praveen A added a comment - - edited No eyalbe , It didn't help either. I actually tried these combinations first time itself but never worked out. Please let me know what config-as-code is working for you at your environment. Thanks, Praveen

          Akshat Mehta added a comment - - edited

          HI eyalb,

           

          I am encountering the same problem while trying to automate the job creation process.

          Target repository field is empty after trying multiple times.

          below is the code I am using.

           

          Any solutions how that value can be populated, or any other way to integrate DSL with artifactory that solves the problem.

          I could not find any help on google and ended up with this same issue discussed here.

          I am using the latest version of DSL plugin .

           

           

           

          configure { project ->
          project / buildWrappers << 'org.jfrog.hudson.generic.ArtifactoryGenericConfigurator' {
          details {

          artifactoryUrl('abc')
          artifactoryName('abc')

          deployReleaseRepository

          {

          keyFromText('node-plugin-release-local') keyFromSelect('') dynamicMode(true)

           

          {color:#ff0000}}

          }
          deployPattern('.zip ')
          matrixParams('')
          deployBuildInfo(true)
          includeEnvVars(true)
          envVarsPatterns {
          includePatterns('')
          excludePatterns('password,secret,key')
          }
          discardOldBuilds(true)
          discardBuildArtifacts(true)

          }

          Akshat Mehta added a comment - - edited HI eyalb ,   I am encountering the same problem while trying to automate the job creation process. Target repository field is empty after trying multiple times. below is the code I am using.   Any solutions how that value can be populated, or any other way to integrate DSL with artifactory that solves the problem. I could not find any help on google and ended up with this same issue discussed here. I am using the latest version of DSL plugin .       configure { project -> project / buildWrappers << 'org.jfrog.hudson.generic.ArtifactoryGenericConfigurator' { details { artifactoryUrl('abc') artifactoryName('abc') deployReleaseRepository { keyFromText('node-plugin-release-local') keyFromSelect('') dynamicMode(true)   {color:#ff0000}} } deployPattern('.zip ') matrixParams('') deployBuildInfo(true) includeEnvVars(true) envVarsPatterns { includePatterns('') excludePatterns(' password , secret , key ') } discardOldBuilds(true) discardBuildArtifacts(true) }

          Akshat Mehta added a comment -

          Akshat Mehta added a comment - @praveen priyeshnn praveen0528

          Akshat Mehta added a comment -

          Someone pls help if you guys got the solution of this

          Akshat Mehta added a comment - Someone pls help if you guys got the solution of this

          Praveen A added a comment -

          No akshatmehta I didn't get the solution. I left it after the last comment from me. Artifactory repositories refresh is being done manually in my environment.

          Praveen A added a comment - No akshatmehta I didn't get the solution. I left it after the last comment from me. Artifactory repositories refresh is being done manually in my environment.

          Akshat Mehta added a comment -

          Hi,

          Can someone help me on this.

          Akshat Mehta added a comment - Hi, Can someone help me on this.

          Eyal Ben Moshe added a comment - - edited

          The following configurations works for me:

           

          freeStyleJob('seedJobMaven') \{
           wrappers \{
           artifactoryGenericConfigurator \{
           details \{
           artifactoryName('MH-Artifactory')
           artifactoryUrl('https://artifactory.dal.myhrtg.net/artifactory')
           deployReleaseRepository \{
           keyFromText('')
           keyFromSelect('my-repo-local')
           dynamicMode(false)
           }
           deploySnapshotRepository \{
           keyFromText('')
           keyFromSelect('my-repo-local')
           dynamicMode(false)
           }
           resolveReleaseRepository \{
           keyFromText('')
           keyFromSelect('my-repo-virtual')
           dynamicMode(false)
           }
           resolveSnapshotRepository \{
           keyFromText('')
           keyFromSelect('my-repo-virtual')
           dynamicMode(false)
           }
           userPluginKey(null)
           userPluginParams(null)
           }
           resolverDetails(null)
           deployerCredentialsConfig \{
           credentialsId(null)
           username(null)
           password(null)
           overridingCredentials(false)
           }
           resolverCredentialsConfig \{
           credentialsId(null)
           username(null)
           password(null)
           overridingCredentials(false)
           }
           deployBuildInfo(true)
           artifactoryCombinationFilter('')
           envVarsPatterns\{
           includePatterns('*')
           excludePatterns('')
           }
           discardBuildArtifacts(false)
           discardOldBuilds(false)
           customBuildName(null)
           overrideBuildName(false)
           deployPattern('*.tgz')
           resolvePattern('')
           matrixParams(null)
           useSpecs(false)
           uploadSpec \{
           spec(null)
           filePath(null)
           }
           downloadSpec \{
           spec(null)
           filePath(null)
           }
           includeEnvVars(true)
           multiConfProject(false)
           asyncBuildRetention(false)
           }
           }
          }
          
          

          Eyal Ben Moshe added a comment - - edited The following configurations works for me:   freeStyleJob( 'seedJobMaven' ) \{ wrappers \{ artifactoryGenericConfigurator \{ details \{ artifactoryName( 'MH-Artifactory' ) artifactoryUrl( 'https: //artifactory.dal.myhrtg.net/artifactory' ) deployReleaseRepository \{ keyFromText('') keyFromSelect( 'my-repo-local' ) dynamicMode( false ) } deploySnapshotRepository \{ keyFromText('') keyFromSelect( 'my-repo-local' ) dynamicMode( false ) } resolveReleaseRepository \{ keyFromText('') keyFromSelect( 'my-repo-virtual' ) dynamicMode( false ) } resolveSnapshotRepository \{ keyFromText('') keyFromSelect( 'my-repo-virtual' ) dynamicMode( false ) } userPluginKey( null ) userPluginParams( null ) } resolverDetails( null ) deployerCredentialsConfig \{ credentialsId( null ) username( null ) password( null ) overridingCredentials( false ) } resolverCredentialsConfig \{ credentialsId( null ) username( null ) password( null ) overridingCredentials( false ) } deployBuildInfo( true ) artifactoryCombinationFilter('') envVarsPatterns\{ includePatterns( '*' ) excludePatterns('') } discardBuildArtifacts( false ) discardOldBuilds( false ) customBuildName( null ) overrideBuildName( false ) deployPattern( '*.tgz' ) resolvePattern('') matrixParams( null ) useSpecs( false ) uploadSpec \{ spec( null ) filePath( null ) } downloadSpec \{ spec( null ) filePath( null ) } includeEnvVars( true ) multiConfProject( false ) asyncBuildRetention( false ) } } }

          Akshat Mehta added a comment -

          Target repository is still empty after using the above code. 

           

          This part of code is not working

           

          deployReleaseRepository {
          keyFromText('')
          keyFromSelect('my-repo-local')
          dynamicMode(false)
          }

           

          Akshat Mehta added a comment - Target repository is still empty after using the above code.    This part of code is not working   deployReleaseRepository { keyFromText('') keyFromSelect('my-repo-local') dynamicMode(false) }  

          Akshat Mehta added a comment -

          I want this to be present inside target directory space- 'dt-$JOB_NAME/$BUILD_ID'

          for that i am using

          deployReleaseRepository

          { keyFromText('dt-$JOB_NAME/$BUILD_ID') keyFromSelect('') dynamicMode(true) }

          But the field is empty after running dsl script and getting new job.

          Akshat Mehta added a comment - I want this to be present inside target directory space- 'dt-$JOB_NAME/$BUILD_ID' for that i am using deployReleaseRepository { keyFromText('dt-$JOB_NAME/$BUILD_ID') keyFromSelect('') dynamicMode(true) } But the field is empty after running dsl script and getting new job.

          See this answer on Stack Overflow about configuring the Artifactory plugin with Job DSL: https://stackoverflow.com/a/48486303/1271460

          Daniel Spilker added a comment - See this answer on Stack Overflow about configuring the Artifactory plugin with Job DSL: https://stackoverflow.com/a/48486303/1271460

            daspilker Daniel Spilker
            praveen0528 Praveen A
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: