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

Add SVN Support to workflow-remote-loader

XMLWordPrintable

      We have to load remote ressources in our pipeline from SVN, so i patched the workflow-remote-loader-plugin. It would be nice if this gets somehow integrated into upstream

        public Object fromSVN(String libPath, String repoUrl = DEFAULT_REPO_URL,  
          String credentialsId = null, labelExpression = '') {
            Object res;
            withSVN(repoUrl, credentialsId, labelExpression) {
              res = load(libPath)
            }
            return res
          }
        
        public <V> V withSVN(String repoUrl = DEFAULT_REPO_URL,  
              String credentialsId = null, labelExpression = '', Closure<V> body) {
          Map<String, Object> loaded = new TreeMap<String, Object>()
          node(labelExpression) {
            withTimestamper {
              script.dir(TMP_FOLDER) {
                // Flush the directory
                script.deleteDir()
      
                // Checkout
                script.echo "Checking out ${repoUrl}"
                script.checkout changelog: false, poll: false, scm: [$class: 'SubversionSCM',  locations: [[credentialsId: credentialsId, local: '.', remote: repoUrl]], workspaceUpdater: [$class: 'UpdateUpdater']]
      
                
                // Invoke body in the folder
                body();
      
                // Flush the directory again
                script.deleteDir()
              }
            }
          }
        }
      

            Unassigned Unassigned
            thomas_kalmar Thomas Kalmár
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: