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

groovy job copy to sub-folder not working: ‘/’ is an unsafe character

XMLWordPrintable

       Jenkins.instance.copy is not working anymore since update to 2.249.3

      Following code... 

      def jenkins = Jenkins.instance
      def strTemplateName = 'Folder/_componentTemplate'
      def strNewJobFullName = 'Folder/jobs/01_folder/jobs/jobname'
      def template = jenkins.getItemByFullName(strTemplateName)
      
      // Create new job based on template
      println 'Creating new job: ' + strNewJobFullName;
      def job = jenkins.copy(template,strNewJobPath)
      

       

      ...leads now to the following error:

      hudson.model.Failure: ‘/’ is an unsafe character
         at jenkins.model.Jenkins.checkGoodName(Jenkins.java:4031)
         at hudson.model.ItemGroupMixIn.copy(ItemGroupMixIn.java:238)
         at jenkins.model.Jenkins.copy(Jenkins.java:3995)
         at sun.reflect.GeneratedMethodAccessor1566.invoke(Unknown Source)
         ...

            vjuranek vjuranek
            chrop Christian Opitz
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: