1

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 1

2

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.

2
  • 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.
    – KymikoLoco
    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
    – Patrice M.
    Mar 27, 2019 at 16:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.