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

Mulibranch pipeline job and mercurialSCMSource traits request

    XMLWordPrintable

    Details

    • Similar Issues:

      Description

      Without passing trait (behaviour) installation for multibranch pipeline using mercurial there's no chance to run jobs (probably due to hg-cache requirement or something like this).

      I discovered

      mercurialInstallationSCMSourceTrait

      in jenkins job reference manual but this node I can not apply to the following configuration:

      multibranchPipelineJob('ci-per-branch'){
          displayName('CI')
          description('Continuous Integration Tests')
          triggers {
              periodic(10)
          }
      
          branchSources {
      
              branchSource {
                  source {
                      mercurialSCMSource {
                          id "ci-per-branch-id"
                          credentialsId "access-bot-id"
                          source "https://repolocation/"
                          // here should be installation option to make it work
                      }
                  }
              }
          }
      
          orphanedItemStrategy {
              discardOldItems {
                  numToKeep(0)
                  daysToKeep(0)
              }
          }
      }
      

      Unfortunately I have not found how to configure it by another ways.

        Attachments

          Issue Links

            Activity

            nickolasfox Nickolas Fox created issue -
            nickolasfox Nickolas Fox made changes -
            Field Original Value New Value
            Description Without passing trait (behaviour) installation for multibranch pipeline using mercurial there's no chance to run jobs (probably due to hg-cache requirement or something like this).

            I discovered {code}mercurialInstallationSCMSourceTrait{code} in jenkins job reference manual but this node I can not apply to the following configuration:
            {code}
            multibranchPipelineJob('ci-per-branch'){
                displayName('CI')
                description('Continuous Integration Tests')
                triggers {
                    periodic(10)
                }

                branchSources {

                    branchSource {
                        source {
                            mercurialSCMSource {
                                id "ci-per-branch-id"
                                credentialsId "bsw-bm-bot"
                                source "https://hg.iponweb.net/bidswitch/ui-ci/"
                                // here should be installation option to make it work
                            }
                        }
                    }
                }

                orphanedItemStrategy {
                    discardOldItems {
                        numToKeep(0)
                        daysToKeep(0)
                    }
                }
            }
            {code}

            Unfortunately I have not find how to configure it by another ways.
            Without passing trait (behaviour) installation for multibranch pipeline using mercurial there's no chance to run jobs (probably due to hg-cache requirement or something like this).

            I discovered {code}mercurialInstallationSCMSourceTrait{code} in jenkins job reference manual but this node I can not apply to the following configuration:
            {code}
            multibranchPipelineJob('ci-per-branch'){
                displayName('CI')
                description('Continuous Integration Tests')
                triggers {
                    periodic(10)
                }

                branchSources {

                    branchSource {
                        source {
                            mercurialSCMSource {
                                id "ci-per-branch-id"
                                credentialsId "access-bot-id"
                                source "https://repolocation/"
                                // here should be installation option to make it work
                            }
                        }
                    }
                }

                orphanedItemStrategy {
                    discardOldItems {
                        numToKeep(0)
                        daysToKeep(0)
                    }
                }
            }
            {code}

            Unfortunately I have not find how to configure it by another ways.
            daspilker Daniel Spilker made changes -
            Component/s mercurial-plugin [ 15502 ]
            Hide
            daspilker Daniel Spilker added a comment -

            There was a similar issue with the GitHub branch source, see https://github.com/jenkinsci/github-branch-source-plugin/commit/745dfbfe4f8002b085386e8da8a9416a964472d2. That fix has to be applied to the Mercurial plugin as well. I will prepare a PR.

            Show
            daspilker Daniel Spilker added a comment - There was a similar issue with the GitHub branch source, see https://github.com/jenkinsci/github-branch-source-plugin/commit/745dfbfe4f8002b085386e8da8a9416a964472d2 . That fix has to be applied to the Mercurial plugin as well. I will prepare a PR.
            daspilker Daniel Spilker made changes -
            Link This issue relates to JENKINS-26535 [ JENKINS-26535 ]
            nickolasfox Nickolas Fox made changes -
            Description Without passing trait (behaviour) installation for multibranch pipeline using mercurial there's no chance to run jobs (probably due to hg-cache requirement or something like this).

            I discovered {code}mercurialInstallationSCMSourceTrait{code} in jenkins job reference manual but this node I can not apply to the following configuration:
            {code}
            multibranchPipelineJob('ci-per-branch'){
                displayName('CI')
                description('Continuous Integration Tests')
                triggers {
                    periodic(10)
                }

                branchSources {

                    branchSource {
                        source {
                            mercurialSCMSource {
                                id "ci-per-branch-id"
                                credentialsId "access-bot-id"
                                source "https://repolocation/"
                                // here should be installation option to make it work
                            }
                        }
                    }
                }

                orphanedItemStrategy {
                    discardOldItems {
                        numToKeep(0)
                        daysToKeep(0)
                    }
                }
            }
            {code}

            Unfortunately I have not find how to configure it by another ways.
            Without passing trait (behaviour) installation for multibranch pipeline using mercurial there's no chance to run jobs (probably due to hg-cache requirement or something like this).

            I discovered {code}mercurialInstallationSCMSourceTrait{code} in jenkins job reference manual but this node I can not apply to the following configuration:
            {code}
            multibranchPipelineJob('ci-per-branch'){
                displayName('CI')
                description('Continuous Integration Tests')
                triggers {
                    periodic(10)
                }

                branchSources {

                    branchSource {
                        source {
                            mercurialSCMSource {
                                id "ci-per-branch-id"
                                credentialsId "access-bot-id"
                                source "https://repolocation/"
                                // here should be installation option to make it work
                            }
                        }
                    }
                }

                orphanedItemStrategy {
                    discardOldItems {
                        numToKeep(0)
                        daysToKeep(0)
                    }
                }
            }
            {code}

            Unfortunately I have not found how to configure it by another ways.
            Hide
            daspilker Daniel Spilker added a comment -
            Show
            daspilker Daniel Spilker added a comment - PR with a workaround for JENKINS-26535 : https://github.com/jenkinsci/mercurial-plugin/pull/118
            daspilker Daniel Spilker made changes -
            Assignee Daniel Spilker [ daspilker ] Jesse Glick [ jglick ]
            Hide
            daspilker Daniel Spilker added a comment - - edited

            Nickolas Fox you can also use a Configure Block to add the missing config:

            multibranchPipelineJob('example-mbp') {
              branchSources {
                branchSource {
                  source {
                    mercurialSCMSource {
                      id('ci-per-branch-id')
                      credentialsId('access-bot-id')
                      source('https://repolocation/')
                    }
                  }
                }
              }
              configure { project ->
                project / sources / data / 'jenkins.branch.BranchSource' / source / traits << 'hudson.plugins.mercurial.traits.MercurialInstallationSCMSourceTrait' {
                  installation('mercurial-4.6')
                }
              }
            }
            
            Show
            daspilker Daniel Spilker added a comment - - edited Nickolas Fox you can also use a Configure Block to add the missing config: multibranchPipelineJob( 'example-mbp' ) { branchSources { branchSource { source { mercurialSCMSource { id( 'ci-per-branch-id' ) credentialsId( 'access-bot-id' ) source( 'https: //repolocation/' ) } } } } configure { project -> project / sources / data / 'jenkins.branch.BranchSource' / source / traits << 'hudson.plugins.mercurial.traits.MercurialInstallationSCMSourceTrait' { installation( 'mercurial-4.6' ) } } }
            Hide
            nickolasfox Nickolas Fox added a comment -

            Daniel Spilker thank you, yes I know about configure way to setup project in my case I've replaced whole branchSources block with configure use.

            Show
            nickolasfox Nickolas Fox added a comment - Daniel Spilker thank you, yes I know about configure way to setup project in my case I've replaced whole branchSources block with configure use.
            jglick Jesse Glick made changes -
            Resolution Fixed [ 1 ]
            Status Open [ 1 ] Resolved [ 5 ]
            daspilker Daniel Spilker made changes -
            Status Resolved [ 5 ] Closed [ 6 ]

              People

              Assignee:
              jglick Jesse Glick
              Reporter:
              nickolasfox Nickolas Fox
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: