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

Jenkins ImportPlugin - Error '/' unsafe character

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Minor Minor
    • job-import-plugin
    • None
    • Jenkins 2.255
      job-import plugin 3.4
      Oracle Linux Server release 7.5

      I am able to import a job if it is located at the root of jenkins 

      src:   (/opt/jenkins/workspace/job)

      But if I try to import a job located in a folder             

      src:   (/opt/jenkins/workspace/directory/job)

      I get the following error:

      Failure: ‘/’ is an unsafe character

       

      There are no / s in the name of the directory or file

      I have attached the relevant Jenkins.log output

       

          [JENKINS-64121] Jenkins ImportPlugin - Error '/' unsafe character

          Ben Herfurth added a comment -

          Same here.

          My directory has / in the name because it is not in the jenkins root.

          The request passes it like:
          "com/job/deployment/job/my-app/": false,
           
           

          Ben Herfurth added a comment - Same here. My directory has / in the name because it is not in the jenkins root. The request passes it like: "com/job/deployment/job/my-app/": false,    

          Mykhailo Zolotarenko added a comment - - edited

          We also see this issue when trying import job, not from the root directory

          e.g.

          If we choose from the list jobs:

          dir-1/ dir-2/job_name https://jenkins/job/dir_1/job/dir_2/job/job_name/]

          and click on import - we have the following issue:

          Remote Jenkins Job Import Status
          Name Status
          job_name FAILED - ‘/’ is an unsafe character

          Jenkins 2.249.3
          job-import plugin 3.4

          Mykhailo Zolotarenko added a comment - - edited We also see this issue when trying import job, not from the root directory e.g. If we choose from the list jobs: dir-1/ dir- 2/job_name https://jenkins/job/dir_1/job/dir_2/job/job_name/] and click on import - we have the following issue: Remote Jenkins Job Import Status Name Status job_name FAILED - ‘/’ is an unsafe character Jenkins 2.249.3 job-import plugin 3.4

          Todd Vogl added a comment -

          Temp Work Around:

          Move your job to the Root of Jenkins  /opt/jenkins/workspace

          Then I've been able to import it to another instance

          Todd Vogl added a comment - Temp Work Around: Move your job to the Root of Jenkins  /opt/jenkins/workspace Then I've been able to import it to another instance

          Alexander added a comment -

          Alexander added a comment - I think I have found the cause of the issue; https://github.com/jenkinsci/jenkins/commit/f176292eb4a41c007a97b86ff767ccb36707c1e6  It added an additional check to the name. Should be fixed here: https://github.com/jenkinsci/job-import-plugin/blob/2578ed330d35328f9bdeca219f7b98beefe68a71/src/main/java/org/jenkins/ci/plugins/jobimport/JobImportAction.java#L222  

          Todd Vogl added a comment -

          avdkolk,

           

          Will this be released soon as a Plugin update or is there another way to update my plugin?

           

          Thanks,

           

          Todd

          Todd Vogl added a comment - avdkolk ,   Will this be released soon as a Plugin update or is there another way to update my plugin?   Thanks,   Todd

          Alexander added a comment -

          a07855 sorry I'm not the maintainer nor have I got a working dev/test-environment for it.

          Alexander added a comment - a07855  sorry I'm not the maintainer nor have I got a working dev/test-environment for it.

          Ian Williams added a comment -

          I have posted am alternate workaround to StackOverflow:
          Job Import Plugin doesn’t import folder

          Ian Williams added a comment - I have posted am alternate workaround to StackOverflow: Job Import Plugin doesn’t import folder

          Todd Vogl added a comment - - edited

          ianw This worked great!  Thank you very much!!!!

           

          https://stackoverflow.com/a/68799939/598141

          Todd Vogl added a comment - - edited ianw  This worked great!  Thank you very much!!!!   https://stackoverflow.com/a/68799939/598141

          I've created a pr to fix this issue, https://github.com/jenkinsci/job-import-plugin/pull/31

          Christer Grönblad added a comment - I've created a pr to fix this issue, https://github.com/jenkinsci/job-import-plugin/pull/31

          Ian Williams added a comment -

          obegron, thx for the fix! I posted some Q on the PR.

          escoem is the maintainer, so hopefully he can review and cut a release if it all works; I know this fix would make many lives easier.

          Ian Williams added a comment - obegron , thx for the fix! I posted some Q on the PR. escoem is the maintainer, so hopefully he can review and cut a release if it all works; I know this fix would make many lives easier.

          Hi Team,

          I am also facing the same issue, some one please le tme know the fix link.

          Issue :-

          If I try to import a job located in a folder             

          src:   (/opt/jenkins/workspace/directory/job)

          I get the following error:

          Failure: ‘/’ is an unsafe character

          Devendar Gangapuram added a comment - Hi Team, I am also facing the same issue, some one please le tme know the fix link. Issue :- If I try to import a job located in a folder              src:   (/opt/jenkins/workspace/directory/job) I get the following error: Failure: ‘/’ is an unsafe character

          Ian Williams added a comment -

          dgangapuram, workaround here, until a new release is cut.

          Ian Williams added a comment - dgangapuram , workaround here , until a new release is cut.

          Devendar Gangapuram added a comment - - edited

          Hi ianw,

          Thank you so much, I have tried this work around but no luck. Still it imports "Empty" folders even though prefixed the folder with "job" folder. Please have a look on following screens for  more clarity. 

           

           

           

           

           

          Thanks,

          Dev G.

           

           

           

          Devendar Gangapuram added a comment - - edited Hi ianw , Thank you so much, I have tried this work around but no luck. Still it imports "Empty" folders even though prefixed the folder with "job" folder. Please have a look on following screens for  more clarity.            Thanks, Dev G.      

          Please respond me where I am doing wrong.

           

          Thank you

          Devendar Gangapuram added a comment - Please respond me where I am doing wrong.   Thank you

          Devendar Gangapuram added a comment - - edited

          This workaround ( https://stackoverflow.com/questions/68774658/job-import-plugin-doesn-t-import-folder/68799939#68799939  ) didn't work for me.

          We have Job import 5.0 version installed. 

          Please some one help me to get this worked. 

           

           

           

          Thanks in advandce,

          Dev G

          Devendar Gangapuram added a comment - - edited This workaround ( https://stackoverflow.com/questions/68774658/job-import-plugin-doesn-t-import-folder/68799939#68799939   ) didn't work for me. We have Job import 5.0 version installed.  Please some one help me to get this worked.        Thanks in advandce, Dev G

            Unassigned Unassigned
            a07855 Todd Vogl
            Votes:
            4 Vote for this issue
            Watchers:
            8 Start watching this issue

              Created:
              Updated: