mockito / shipkit

Toolkit for shipping it used by Mockito library
http://shipkit.org
MIT License
158 stars 35 forks source link

gitHub.url not used #593

Closed jhoglin closed 6 years ago

jhoglin commented 6 years ago

I am afraid it might be a misunderstanding and misuse from my side, please just Point me in the right direction and Close this issue if so.

But I'm trying to use shipkit against GitHub Enterprise so I have set the settings in shipkit.gradle

gitHub.repository = "jhoglin/helloWorld"
gitHub.url = "https://url.to.gitenterprise.se"
gitHub.apiUrl = "https://url.to.gitenterprise.se/api/v3"

When I execute gradle performRelease

I can see in the output that it uses the api part to fetch things for the release notes:

 Querying GitHub API for all contributors for project
GET https://url.to.gitenterprise.se/api/v3/repos/jhoglin/helloWorld/contributors?access_token=xxxf&per_page=100
GET https://url.to.gitenterprise.se/api/v3/users/jhoglin?access_token=xxx
GET https://url.to.gitenterprise.se/api/v3/repos/jhoglin/helloWorld/commits?access_token=xxx&since=2017-12-13T10:54:44+0100&page=1&per_page=100
Serialized contributors information: build\shipkit\all-contributors.json

But when almost all is done and the push is about to happen, it still tries the github.com url

:gitPush
  'git push' uses GitHub write token
  Executing:
    git push https://dummy:[SECRET]@github.com/jhoglin/helloWorld.git v0.0.25 feature/build-PRs
:gitPush FAILED

I was expecting the push to go to my url set in gitHub.url

On a side note, is it possible to not use access token in the push and just execute a simple git push? We use an authenticated user from Jenkins to contact GitHub so the accesstoken is a bit unnessecary in our use-case, internally using a GitHub Enterprise.

jhoglin commented 6 years ago

I see now after digging around in the code that this method must be the culprit:

https://github.com/mockito/shipkit/blob/44b931f648eef85e26b7f2e15449e45ba60952fa/subprojects/shipkit/src/main/groovy/org/shipkit/internal/gradle/git/GitHubUrlBuilder.java#L25

Both ways through that method assumes its github.com we talk to.

jhoglin commented 6 years ago

I think it will be good practice to fix/implement this my self. So I’ll try that and will be back with a PR soon, (hopefully)

mockitoguy commented 6 years ago

Thank you very much for reporting and submitting the PR! I left feedback but I'm really looking forward to merging.

epeee commented 6 years ago

This one is fixed now, thx @jhoglin!