I have a Github Organisation Folder project on Jenkins with a number of repositories, is there a way to get the name of the current repository from where we did the build Job?
1 Answer
Are you aware that this plugin is deprecated, at this point in time (for about a year now)? If need be, read this blog post
In both cases, you should be able to access the repo url via:
// scm instanceof GitSCM
gitUrl = scm.getUserRemoteConfigs()[0]?.getUrl()
// Altenatively
girUrl = env.'GIT_URL'
So you could parse this url to access the repo name per-se, for instance.
-
1"The functionality of this plugin has been migrated to the GitHub Branch Source plugin." The GitHub Organization folders still exist, they just moved to a different plugin. So the question is a valid one. Mar 27, 2019 at 2:53
-
True, and in both cases you can get the scm url from the environment and the scm object itself Mar 27, 2019 at 16:41