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

support directory symlinks

    XMLWordPrintable

    Details

    • Similar Issues:

      Description

      as part of a migration I relocated a lot of files from directory old to directory new 

      in order to retain backwards compatability I added a symlink from directory old to new

      all is fine at the git level and github shows the symlink in its UI.

      However when using `readTrusted` step from a pipeline that is still going via the symlink (old/foo) then the step errors with a file not found.

      the code should traverse symlinks within the repository.

      java.io.FileNotFoundException: old/foo.yaml
      	at org.jenkinsci.plugins.github_branch_source.GitHubSCMFile.content(GitHubSCMFile.java:187)
      	at jenkins.scm.api.SCMFile.contentAsString(SCMFile.java:335)
      	at org.jenkinsci.plugins.workflow.multibranch.ReadTrustedStep$Execution.run(ReadTrustedStep.java:185)
      	at org.jenkinsci.plugins.workflow.multibranch.ReadTrustedStep$Execution.run(ReadTrustedStep.java:82)
      	at org.jenkinsci.plugins.workflow.steps.AbstractSynchronousNonBlockingStepExecution$1$1.call(AbstractSynchronousNonBlockingStepExecution.java:47)
      	at hudson.security.ACL.impersonate(ACL.java:367)
      	at org.jenkinsci.plugins.workflow.steps.AbstractSynchronousNonBlockingStepExecution$1.run(AbstractSynchronousNonBlockingStepExecution.java:44)
      	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
      	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
      	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
      	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
      	at java.lang.Thread.run(Thread.java:748)
      

        Attachments

          Issue Links

            Activity

            teilo James Nord created issue -
            teilo James Nord made changes -
            Field Original Value New Value
            Description as part of a migration I relocated a lot of source files from directory old to directory {{new}} 

            in order to retain backwards compatability I added a symlink from directory {{old}} to {{new}}

            all is fine at the git level and github shows the symlink in its UI.

            However when using `readTrusted` step from a pipeline that is still going via the symlink ({{old/foo}}) then the step errors with a file not found.

            the code should traverse symlinks within the repository.


            {noformat}
            java.io.FileNotFoundException: old/foo.yaml
            at org.jenkinsci.plugins.github_branch_source.GitHubSCMFile.content(GitHubSCMFile.java:187)
            at jenkins.scm.api.SCMFile.contentAsString(SCMFile.java:335)
            at org.jenkinsci.plugins.workflow.multibranch.ReadTrustedStep$Execution.run(ReadTrustedStep.java:185)
            at org.jenkinsci.plugins.workflow.multibranch.ReadTrustedStep$Execution.run(ReadTrustedStep.java:82)
            at org.jenkinsci.plugins.workflow.steps.AbstractSynchronousNonBlockingStepExecution$1$1.call(AbstractSynchronousNonBlockingStepExecution.java:47)
            at hudson.security.ACL.impersonate(ACL.java:367)
            at org.jenkinsci.plugins.workflow.steps.AbstractSynchronousNonBlockingStepExecution$1.run(AbstractSynchronousNonBlockingStepExecution.java:44)
            at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
            at java.util.concurrent.FutureTask.run(FutureTask.java:266)
            at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
            at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
            at java.lang.Thread.run(Thread.java:748)
            {noformat}
            as part of a migration I relocated a lot of files from directory {{old}} to directory {{new}} 

            in order to retain backwards compatability I added a symlink from directory {{old}} to {{new}}

            all is fine at the git level and github shows the symlink in its UI.

            However when using `readTrusted` step from a pipeline that is still going via the symlink ({{old/foo}}) then the step errors with a file not found.

            the code should traverse symlinks within the repository.


            {noformat}
            java.io.FileNotFoundException: old/foo.yaml
            at org.jenkinsci.plugins.github_branch_source.GitHubSCMFile.content(GitHubSCMFile.java:187)
            at jenkins.scm.api.SCMFile.contentAsString(SCMFile.java:335)
            at org.jenkinsci.plugins.workflow.multibranch.ReadTrustedStep$Execution.run(ReadTrustedStep.java:185)
            at org.jenkinsci.plugins.workflow.multibranch.ReadTrustedStep$Execution.run(ReadTrustedStep.java:82)
            at org.jenkinsci.plugins.workflow.steps.AbstractSynchronousNonBlockingStepExecution$1$1.call(AbstractSynchronousNonBlockingStepExecution.java:47)
            at hudson.security.ACL.impersonate(ACL.java:367)
            at org.jenkinsci.plugins.workflow.steps.AbstractSynchronousNonBlockingStepExecution$1.run(AbstractSynchronousNonBlockingStepExecution.java:44)
            at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
            at java.util.concurrent.FutureTask.run(FutureTask.java:266)
            at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
            at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
            at java.lang.Thread.run(Thread.java:748)
            {noformat}
            Hide
            teilo James Nord added a comment -

            NB: as a workaround instead of symlink the directory symlinking each individual file works.

            https://github.com/hub4j/github-api/issues/875

            Show
            teilo James Nord added a comment - NB: as a workaround instead of symlink the directory symlinking each individual file works. https://github.com/hub4j/github-api/issues/875
            teilo James Nord made changes -
            Remote Link This issue links to "github-api#875 (Web Link)" [ 25305 ]
            Hide
            bitwiseman Liam Newman added a comment -

            A significant part of the issue here is the GitHub REST API not making this scenario easy in the case of directory symlinks.
            As noted, file symlinks work without problem. https://github.com/hub4j/github-api/issues/875 discusses possible ways to do directory symlinks, but they involve additional api calls.

            Show
            bitwiseman Liam Newman added a comment - A significant part of the issue here is the GitHub REST API not making this scenario easy in the case of directory symlinks. As noted, file symlinks work without problem. https://github.com/hub4j/github-api/issues/875 discusses possible ways to do directory symlinks, but they involve additional api calls.

              People

              Assignee:
              Unassigned Unassigned
              Reporter:
              teilo James Nord
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Dates

                Created:
                Updated: