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

Allow users to configure SCM hosts that will be ignored

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: In Review (View Workflow)
    • Priority: Minor
    • Resolution: Unresolved
    • Component/s: github-plugin
    • Labels:
      None
    • Similar Issues:

      Description

      When using the GitHub plugin, if your project mixes both GitHub and non-GitHub repos (e.g. your project source is in GitHub but your Pipeline shared libraries are in Bitbucket), your Jenkins logs are polluted with endless warnings:

      WARNING c.c.jenkins.GitHubRepositoryName#create: Could not match URL ...
      

      I have seen this warning hundreds of times in the span of a few minutes on a busy master. Perhaps it would be worth simply logging this at DEBUG level rather than WARNING. Otherwise, I would propose adding a global config option where a user can list non-GitHub repos that are used in their environments, and the plugin will ignore these.

      See https://github.com/jenkinsci/github-plugin/blob/master/src/main/java/com/cloudbees/jenkins/GitHubRepositoryName.java#L86

        Attachments

          Issue Links

            Activity

            Hide
            allan_burdajewicz Allan BURDAJEWICZ added a comment - - edited

            GitHubRepositoryNameContributor$FromSCM#parseAssociatedNames go through all SCMs of an item. In pipeline, you can have multiple SCMs (checkout steps).

            A way to reproduce this:

            • Create a Pipeline Job with Pipeline from SCM pointing to a GitHub repository with a Jenkinsfile that also checkout a repository from another SCM like Bitbucket for example
            pipeline {
                agent any
                triggers {
                    githubPush()
                }
                stages {
                    stage ('Checkout') {
                        steps {
                            checkout scm
                        }
                    }
                    stage ('Checkout Bitbucket') {
                        steps {
                            // Does not matter whether included or not in changelog / poll
                            checkout(
                                changelog: false, 
                                poll: false, 
                                scm: [$class: 'GitSCM', 
                                      branches: [[name: '*/master']], 
                                      userRemoteConfigs: [[
                                          credentialsId: '<bitbucketCredentials>', 
                                          url: '<bitbucketRepo>'
                                      ]]
                                ]
                            )
                        }
                    }
                }
            }
            
            • Build it once
            • Create a Webhook in Github for push event to $JENKINS_URL/github-webhook/
            • Make a change to the code in the GitHub repo

            There are other ways, since GitHubRepositoryNameContributor and GitHubRepositoryName are used in several classes and plugins.

            Show
            allan_burdajewicz Allan BURDAJEWICZ added a comment - - edited GitHubRepositoryNameContributor$FromSCM#parseAssociatedNames go through all SCMs of an item. In pipeline, you can have multiple SCMs ( checkout steps). A way to reproduce this: Create a Pipeline Job with Pipeline from SCM pointing to a GitHub repository with a Jenkinsfile that also checkout a repository from another SCM like Bitbucket for example pipeline { agent any triggers { githubPush() } stages { stage ( 'Checkout' ) { steps { checkout scm } } stage ( 'Checkout Bitbucket' ) { steps { // Does not matter whether included or not in changelog / poll checkout( changelog: false , poll: false , scm: [$class: 'GitSCM' , branches: [[name: '*/master' ]], userRemoteConfigs: [[ credentialsId: '<bitbucketCredentials>' , url: '<bitbucketRepo>' ]] ] ) } } } } Build it once Create a Webhook in Github for push event to $JENKINS_URL/github-webhook/ Make a change to the code in the GitHub repo There are other ways, since GitHubRepositoryNameContributor and GitHubRepositoryName are used in several classes and plugins.
            Show
            allan_burdajewicz Allan BURDAJEWICZ added a comment - Proposed https://github.com/jenkinsci/github-plugin/pull/251

              People

              Assignee:
              allan_burdajewicz Allan BURDAJEWICZ
              Reporter:
              owenmehegan Owen Mehegan
              Votes:
              2 Vote for this issue
              Watchers:
              3 Start watching this issue

                Dates

                Created:
                Updated: