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

Artifactory dsl code is not loading target repository in the configuration

    XMLWordPrintable

Details

    Description

      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

      Attachments

        Activity

          akshatmehta Akshat Mehta added a comment -

          Hi,

          Can someone help me on this.

          akshatmehta Akshat Mehta added a comment - Hi, Can someone help me on this.
          eyalbe 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)
           }
           }
          }
          
          
          eyalbe 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 ) } } }
          akshatmehta 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)
          }

           

          akshatmehta 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) }  
          akshatmehta 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.

          akshatmehta 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

          daspilker 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

          People

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

            Dates

              Created:
              Updated:
              Resolved: