telia-oss / github-pr-resource

Github pull request resource for Concourse
MIT License
182 stars 3 forks source link

user.name/user.email should be configured globally to work with submodules #289

Open vmallet opened 1 year ago

vmallet commented 1 year ago

The Get part of the resource configures both user.name and user.email in the main repo in case a commit needs to happen while merging/rebasing the PR branch (source). However the configuration isn't propagated down to submodules, and if such a commit is required for one of the submodules, the commit will fail with Git being very unhappy about not having a name and/or email for the user.

Output example ``` 10:21:29 selected worker: concourse-worker-32 10:21:31 Initialized empty Git repository in /tmp/build/get/.git/ 10:21:31 Switched to a new branch 'main' 10:21:33 Submodule 'modules/something' (https://..../something) registered for path 'modules/something' 10:21:33 Cloning into '/tmp/build/get/modules/something'... 10:21:34 Submodule path 'modules/something': checked out '123f0ec9cb46ddb482a480e564563ffb698db3ef' 10:21:35 Updating 57fd81d..c5789e9 10:21:35 Fast-forward 10:21:35 10:21:35 *** Please tell me who you are. 10:21:35 10:21:35 Run 10:21:35 10:21:35 git config --global user.email "you@example.com" 10:21:35 git config --global user.name "Your Name" 10:21:35 10:21:35 to set your account's default identity. 10:21:35 Omit --global to set the identity only in this repository. 10:21:35 10:21:35 fatal: unable to auto-detect email address (got 'root@1e-bd04-2b04-8404-12345606ee41.(none)') 10:21:35 Unable to merge '1283dbe90a633442c1269d564c26c5eb078f3df3' in submodule path 'modules/something' 10:21:35 2023/02/10 18:21:35 get failed: submodule update failed: exit status 2 ```

One way to work around this is to add --global to the user.name/user.email config commands to make them global, which seems reasonable in a dockerized environment.

bgandon commented 3 months ago

Unfortunately, there is no hope that you get any support here (#246 was 2+y ago).

But recent news is that the Cloud Foundry community is now maintaining a fork of this resource at cloudfoundry-community/github-pr-resource.

On our Concourse installation at Gstack, that one is already working fine. The change you're describing is both reasonable and quite trivial. Could you suggest a PR there?

_(the new resource is a drop-in replacement; you only have to switch telia-ossto cfcommunity in in the resource_types: declaration, i.e. specify repository: cfcommunity/github-pr-resource)_