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

Allow cloning job trees when creating job via gitlab web hook

    XMLWordPrintable

    Details

    • Similar Issues:

      Description

      Currently, the hook copies the job as is and just alters git urls.

      I wish I could modify the job in accordance with the branch (e.g. via Job DSL plugin or JobCopy plugin).

      For instance: I use MultiJob plugin to create a build pipeline. MultiJob requires names of the child jobs be in literal. It does not allow to specify "build-${branch}" in the definition of phase job.
      So I would like to be able to clone those child jobs with new names and wire the whole thing.

      A workaround I see is to use parameterized with "branch" jobs for each build phase, however that messes up the statistics. For instance, "compile the project job" builds different branches at different times, so it is bad for any kind of statistics.

        Attachments

          Issue Links

            Activity

            Hide
            vladimirsitnikov Vladimir Sitnikov added a comment -

            Finally I ended up with the following setup:
            1) "seed job" calls "jobcopy plugin" to create jobs as required and schedules the proper job for execution
            2) gitlab-hook triggers only "seed job" no matter which branch is triggered

            In that setup, gitlab-hook still does not work out-of-the-box since it tries to trigger all the jobs (see JENKINS-29317).

            Show
            vladimirsitnikov Vladimir Sitnikov added a comment - Finally I ended up with the following setup: 1) "seed job" calls "jobcopy plugin" to create jobs as required and schedules the proper job for execution 2) gitlab-hook triggers only "seed job" no matter which branch is triggered In that setup, gitlab-hook still does not work out-of-the-box since it tries to trigger all the jobs (see JENKINS-29317 ).
            Hide
            javiplx Javier Palacios added a comment -

            If I understand right, you would like that when a project is created for a new branch, not "clone" only the main job, but all the multijob pack. As I said in the related issue, have no knowledge on multijob so, could you attach the config.xml for a pack? I'll try to add it to acceptance tests to see the behaviour.

            Show
            javiplx Javier Palacios added a comment - If I understand right, you would like that when a project is created for a new branch, not "clone" only the main job, but all the multijob pack . As I said in the related issue, have no knowledge on multijob so, could you attach the config.xml for a pack? I'll try to add it to acceptance tests to see the behaviour.
            Hide
            vladimirsitnikov Vladimir Sitnikov added a comment -

            Finally, I gave up with Job Copy, job cloning, etc, so this issue can probably be closed.
            Job cloning has too much constraints.

            I ended up with using Job DSL for programmatic job creation. The case is explained here: https://issues.jenkins-ci.org/browse/JENKINS-29317?focusedCommentId=245505&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-245505

            Show
            vladimirsitnikov Vladimir Sitnikov added a comment - Finally, I gave up with Job Copy, job cloning, etc, so this issue can probably be closed. Job cloning has too much constraints. I ended up with using Job DSL for programmatic job creation. The case is explained here: https://issues.jenkins-ci.org/browse/JENKINS-29317?focusedCommentId=245505&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-245505

              People

              Assignee:
              javiplx Javier Palacios
              Reporter:
              vladimirsitnikov Vladimir Sitnikov
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: