Git Source Code Management Oddity

25 views
Skip to first unread message

eric....@gmail.com

unread,
May 19, 2022, 10:42:29 AM5/19/22
to Jenkins Users
OK, I've been having some major issues with Git source code management in Jenkins.  So I have several repositories I pull from to do builds.  I use my same credentials to pull from each.  If the pull succeeds, I push a tag at it.  I was noticing certain tags were failing saying it already existed even though it didn't exist.  Well, it didn't exist in THAT repository.  But it did exist in one of the other repositories.  I tested by creating these tags in git command line and pushing them and it worked fine.  Anyone have a clue what could be happening here?  The jenkins task goes to my repository's url with my credentials selecting from the branch I tell it.  It's set to clean before check out.  It does all of this fine.  It has a Git Publisher post build step to push my tag only if the checkout succeeds with the box checked to create new tag.  This works UNLESS that same tags exists in any of the projects I run this checkout task against.  Can anyone think of a reason for this odd behavior?  Thanks!!!

Mark Waite

unread,
May 19, 2022, 10:56:30 AM5/19/22
to Jenkins Users
On Thursday, May 19, 2022 at 8:42:29 AM UTC-6 Eric Fetzer wrote:
OK, I've been having some major issues with Git source code management in Jenkins.  So I have several repositories I pull from to do builds.  I use my same credentials to pull from each.  If the pull succeeds, I push a tag at it.  I was noticing certain tags were failing saying it already existed even though it didn't exist.  Well, it didn't exist in THAT repository.  But it did exist in one of the other repositories.  I tested by creating these tags in git command line and pushing them and it worked fine.  Anyone have a clue what could be happening here?  The jenkins task goes to my repository's url with my credentials selecting from the branch I tell it.  It's set to clean before check out.  It does all of this fine.  It has a Git Publisher post build step to push my tag only if the checkout succeeds with the box checked to create new tag.  This works UNLESS that same tags exists in any of the projects I run this checkout task against.  Can anyone think of a reason for this odd behavior?  Thanks!!!

I don't know if the git publisher in the git plugin is able to handle checkout from multiple repositories.  It may not be that sophisticated.

You may need to switch to use the "with credentials" feature that was added in Google Summer of Code 2021 to allow you to perform the push of the tag yourself rather than using the git publisher.  Docs on the "with credentials" feature are available at https://plugins.jenkins.io/git/#plugin-content-credential-binding (Pipeline) and https://plugins.jenkins.io/git/#plugin-content-git-bindings (freestyle) 

Mark Waite

eric....@gmail.com

unread,
May 23, 2022, 12:08:54 PM5/23/22
to Jenkins Users
It handles checkout from multiple repositories and pushes tags to each.  The only issue is that it seems to see tags in other repositories when it should only see the tags in the repository in question.  If the tag exists in ANY of the repositories I build for, this will be the error:

using credential e9cc840b-9e32-416c-94e7-7b23c1afbd5e 
 > git tag -l 2.3.0.1.1 
# timeout=10 ERROR: Step ‘Git Publisher’ failed: Tag 2.3.0.1.1 already exists and Create Tag is specified, so failing.

Any clue how I would trouble shoot such a thing?

Thanks,
Eric

eric....@gmail.com

unread,
May 23, 2022, 1:57:28 PM5/23/22
to Jenkins Users
Also note that I AM using the "with credentials" from the plugin.

On Thursday, May 19, 2022 at 8:56:30 AM UTC-6 Mark Waite wrote:

Mark Waite

unread,
May 24, 2022, 11:47:42 PM5/24/22
to Jenkins Users
On Monday, May 23, 2022 at 11:57:28 AM UTC-6 Eric wrote:
Also note that I AM using the "with credentials" from the plugin.


I don't understand that statement.

If you're using the `withCredentials` wrapper in a Pipeline, then you don't need to use the thing that the git plugin calls the "Git Publisher post build step".  Perform the push of the plugin from a shell, batch, or powershell step inside a `withCredentials` wrapper.  Much easier to manage a `withCredentials` wrapper with shell commands than to wrestle with the `Git publisher post build step`.

Mark Waite
 
Reply all
Reply to author
Forward
0 new messages