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

Expect library sources in custom subdirectory

    XMLWordPrintable

    Details

    • Similar Issues:

      Description

      Hi.

      The current design of the shared library plugin doesn't play well with monolithic repositories. It forces a specific directory structure on the top level of the repository used for the library, which makes it very hard when a team want to keep all their sources (including the ones used by Jenkins) versioned in a single repository (following the monorepo paradigm).

      Our workflow might be a little strange, because we are a single team that uses a single Jenkins instance/cluster, but I am sure there are others who have the same setup.

      Basically, what we wanted to have is a single multi-branch Pipeline and a single global library, the multi-branch Pipeline delegates work to (because global libraries can use @Grab for example). In such a "simple" scenario, it makes sense to use a single repository for both the Jenkinsfile and the shared library.

      The way we have it set up is that the multi-branch Pipeline executes a simple Jenkinsfile that only determines what branch (or ref) it is running, then uses the `library` step to load the shared library with the same branch (or ref) and calls it, delegating all work to the shared library.

      This system, at least for us, is great, because when we work on, review and test out pull requests, every change can be done as part of a single pull request to a single repository.

      Anyway, I've actually gone ahead and implemented the possibility of specifying a custom directory from which to check out the library's sources. We've been using it for some time and I'd like to see if it could be merged upstream, so we could drop our fork of this great plugin.

      Here's the PR: https://github.com/jenkinsci/workflow-cps-global-lib-plugin/pull/40

        Attachments

          Issue Links

            Activity

            petr_motejlek Petr Motejlek created issue -
            petr_motejlek Petr Motejlek made changes -
            Field Original Value New Value
            Description Hi.

            The current design of the shared library plugin doesn't play well with monolithic repositories. It forces a specific directory structure on the top level of the repository used for the library, which makes it very hard when a team want to keep all their sources (including the ones used by Jenkins) versioned in a single repository (following the monorepo paradigm).

            Our workflow might be a little strange, because we are a single team that uses a single Jenkins instance/cluster, but I am sure there are others who have the same setup.

            Basically, what we wanted to have is a single multi-branch Pipeline and a single global library, the multi-branch Pipeline delegates work to (because global libraries can use @Grab for example). In such a "simple" scenario, it makes sense to use a single repository for both the Jenkinsfile and the shared library.

            The way we have it set up is that the multi-branch Pipeline executes a simple Jenkinsfile that only determines what branch (or ref) it is running, then uses the `library` step to load the shared library with the same branch (or ref) and calls it, delegating all work to the shared library.

            This system, at least for us, is great, because when we work on, review and test out pull requests, every change can be done as part of a single pull request to a single repository.

            Anyway, I've actually gone ahead and implemented the possibility of specifying a custom directory from which to check out the library's sources. We've been using it for some time and I'd like to see if it could be merged upstream, so we could drop our fork of this great plugin.
            Hi.

            The current design of the shared library plugin doesn't play well with monolithic repositories. It forces a specific directory structure on the top level of the repository used for the library, which makes it very hard when a team want to keep all their sources (including the ones used by Jenkins) versioned in a single repository (following the monorepo paradigm).

            Our workflow might be a little strange, because we are a single team that uses a single Jenkins instance/cluster, but I am sure there are others who have the same setup.

            Basically, what we wanted to have is a single multi-branch Pipeline and a single global library, the multi-branch Pipeline delegates work to (because global libraries can use @Grab for example). In such a "simple" scenario, it makes sense to use a single repository for both the Jenkinsfile and the shared library.

            The way we have it set up is that the multi-branch Pipeline executes a simple Jenkinsfile that only determines what branch (or ref) it is running, then uses the `library` step to load the shared library with the same branch (or ref) and calls it, delegating all work to the shared library.

            This system, at least for us, is great, because when we work on, review and test out pull requests, every change can be done as part of a single pull request to a single repository.

            Anyway, I've actually gone ahead and implemented the possibility of specifying a custom directory from which to check out the library's sources. We've been using it for some time and I'd like to see if it could be merged upstream, so we could drop our fork of this great plugin.

            Here's the PR: https://github.com/jenkinsci/workflow-cps-global-lib-plugin/pull/40
            jglick Jesse Glick made changes -
            Status Open [ 1 ] In Progress [ 3 ]
            jglick Jesse Glick made changes -
            Status In Progress [ 3 ] In Review [ 10005 ]
            jglick Jesse Glick made changes -
            Link This issue relates to JENKINS-44481 [ JENKINS-44481 ]
            petr_motejlek Petr Motejlek made changes -
            Resolution Won't Fix [ 2 ]
            Status In Review [ 10005 ] Closed [ 6 ]
            dnusbaum Devin Nusbaum made changes -
            Link This issue relates to JENKINS-38609 [ JENKINS-38609 ]

              People

              Assignee:
              Unassigned Unassigned
              Reporter:
              petr_motejlek Petr Motejlek
              Votes:
              5 Vote for this issue
              Watchers:
              13 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: