-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[JENKINS-65123] Always sets GIT_URL #1061
Conversation
Thanks for the pull request. I believe this is a good idea, but I don't see how this will resolve the issue that is described in JENKINS-65123. When I ran my checks in that issue, there was no value for |
Maybe I was unclear in the description for JENKINS-65123. The problem is for multibranch PR builds, not for "normal" branch builds. We're using Bitbucket (hence bitbucket-branch-source-plugin), not sure if that has any impact. |
I just verified and the changes in this PR solves JENKINS-65123. GIT_URL is now set for PR builds as well. |
I've updated the PR with tests. As the tests don't just test the GIT_URL variable but other env vars as well, I did not mark them with the JIRA ticket. |
The change makes sense to me. We should always set It doesn't resolve the problem that is visible in the GitHub branch source as shown by my bug report comment. In that case, the I've created two check jobs that confirm the behavior: |
I don't understand the use case that causes you to have multiple repositories defined in the Jenkins job. It is allowed, but I haven't found many cases where it is the desired behavior. Can you explain further why you have multiple repositories in a single checkout definition? Are you unintentionally defining multiple repositories when you only need one? For example these two are the same, though one unnecessarily uses multiple remotes Multiple remotes
Single remote
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've tested interactively and confirmed this behaves as desired. When a single repository is defined in the job, GIT_URL
is defined. When two repositories are defined, GIT_URL
, GIT_URL_1
, and GIT_URL_2
are defined. The values of GIT_URL
and GIT_URL_1
are the same, thus retaining compatibility for previous users.
I believe this is ready to merge.
@MarkEWaite We haven't defined multiple repositories, but what seems to happen is that bitbucket-branch-source-plugin defines two remote configs for PR builds. So for any "ordinary" branch build there is just one remote config, but when we create a PR (from a branch in the same repot) that build job seems to get two remote configs. I'm guessing that this is a (possibly not perfect) behavior of bitbucket-branch-source-plugin, but it doesn't really matter for this PR. The documentation of git-plugin states that GIT_URL is always set, which it currently isn't. This PR fixes that. The behavior with Github that you're seeing is not anything I can comment on. I'm using Bitbucket. Thanks for looking into this and reviewing this PR! |
JENKINS-65123 - GIT_URL is now always set
See https://issues.jenkins-ci.org/browse/JENKINS-65123
Checklist
Types of changes