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

git-plugin does not discover tags

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major Major
    • git-plugin
    • None
    • Jenkins ver. 2.46.3

      We want to build tags automatically when they appear in the repository.

      We use GitHub, however github branch source plugin does not support such functionality yet (https://issues.jenkins-ci.org/browse/JENKINS-34395)

      The workaround is to use Multibranch Pipeline and poll the repository every X minutes.

      In the Multibranch Pipeline configuration set:

      Project Repository: <GIT_URL>

      Credentials: <credentials>

      Behaviours:

        Specify ref specs: +refs/tags/:refs/remotes/origin/tags/

       

      In this case no tags are built, the scan log contains following info:

      Started by timer
      [Tue Oct 17 16:03:00 UTC 2017] Starting branch indexing...
       > git rev-parse --is-inside-work-tree # timeout=10
      Setting origin to <GIT_URL>
       > git config remote.origin.url <GIT_URL> # timeout=10
      Fetching origin...
      Fetching upstream changes from origin
       > git --version # timeout=10
      using GIT_ASKPASS to set credentials 
       > git fetch --tags --progress origin +refs/tags/*:refs/remotes/origin/tags/*
      using GIT_ASKPASS to set credentials 
       > git ls-remote <GIT_URL> # timeout=10
       > git rev-parse --is-inside-work-tree # timeout=10
      Setting origin to <GIT_URL>
       > git config remote.origin.url <GIT_URL> # timeout=10
      Fetching & pruning origin...
      Fetching upstream changes from origin
       > git --version # timeout=10
      using GIT_ASKPASS to set credentials 
       > git fetch --tags --progress origin +refs/tags/*:refs/remotes/origin/tags/* --prune
      [Tue Oct 17 16:03:01 UTC 2017] Finished branch indexing. Indexing took 0.67 sec
      Finished: SUCCESS

       

      If we add another configuration parameter to the Multibranch Pipeline: discover branches, the scan log contains:

      Started by user Konstantin Ryakhovskiy
      [Tue Oct 17 16:19:37 UTC 2017] Starting branch indexing...
       > git rev-parse --is-inside-work-tree # timeout=10
      Setting origin to <GIT_URL>
       > git config remote.origin.url <GIT_URL> # timeout=10
      Fetching origin...
      Fetching upstream changes from origin
       > git --version # timeout=10
      using GIT_ASKPASS to set credentials 
       > git fetch --tags --progress origin +refs/tags/*:refs/remotes/origin/tags/*
      using GIT_ASKPASS to set credentials 
       > git ls-remote <GIT_URL> # timeout=10
       > git rev-parse --is-inside-work-tree # timeout=10
      Setting origin to <GIT_URL>
       > git config remote.origin.url <GIT_URL> # timeout=10
      Fetching & pruning origin...
      Fetching upstream changes from origin
       > git --version # timeout=10
      using GIT_ASKPASS to set credentials 
       > git fetch --tags --progress origin +refs/tags/*:refs/remotes/origin/tags/* --prune
      Listing remote references...
       > git config --get remote.origin.url # timeout=10
      using GIT_ASKPASS to set credentials 
       > git ls-remote -h <GIT_URL> # timeout=10
      Checking branches...
        ... //here are some branches at refs/heads/, but no tags
      [Tue Oct 17 16:19:38 UTC 2017] Finished branch indexing. Indexing took 0.61 sec
      Finished: SUCCESS

       

      There is no option "Discover Tags"

            stephenconnolly Stephen Connolly
            kr Konstantin Ryakhovskiy
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: