gocd-build-github-pull-requests icon indicating copy to clipboard operation
gocd-build-github-pull-requests copied to clipboard

Plugin fails after removal of master branch

Open paullewisn opened this issue 4 years ago • 4 comments

I branched master to main some time ago and set this as the default branch on our repos, today I deleted the master branch but this has caused an error on our build pipeline:

Interaction with plugin with id 'github.pr' implementing 'scm' extension failed while requesting for 'checkout'. 
Reason: [The plugin sent a response that could not be understood by Go. 
Plugin returned with code '500' and the following response: 
'"Exception (Process exited with an error: 128 (Exit value: 128)) 
Occurred: [git, clone, --branch\u003dmaster, [email protected]:myorg/myrepo.git, /var/lib/go-agent-2/pipelines/build.pr] - null"']

Is there a configuration/env vars I need to update? I have restored master for now.

v1.3.4 GoCD Version: 19.2.0

paullewisn avatar Nov 18 '20 15:11 paullewisn

I am also seeing this response periodically

Interaction with plugin with id 'github.pr' implementing 'scm' extension failed while requesting for 'checkout'. 
Reason: [The plugin sent a response that could not be understood by Go. 
Plugin returned with code '500' and the following response: '"Exception (Process exited with an error: 1 (Exit value: 1)) Occurred: [git, checkout, -f, master] - /var/lib/go-agent-2/pipelines/build.pr"']

paullewisn avatar Nov 18 '20 17:11 paullewisn

This is slowly becoming a blocker for us - since new GitHub repositories have the main as the default branch and not all people (who can create new repos) have an easy way or permission to change the default repo back to master to make their GoCD pipelines work with this plugin.

@ashwanthkumar could we please get an update and some timeframe when you or someone could have a look at this issue?

mirogta avatar May 18 '21 19:05 mirogta

@paullewisn @mirogta I believe the alternative is just to set the Default branch on the Github plugin dialog to main rather than leaving it empty.

It you still get an issue with it trying to checkout main you will probably need to change the case of one of the characters in the Repository Url in Go to get it to sort its self out

croweman avatar Aug 11 '21 09:08 croweman

an update on this for anyone still using this - setting defaultBranch instead of branch under the plugin options in yaml allows specifying main.

https://github.com/ashwanthkumar/gocd-build-github-pull-requests/blob/cc805eaa642b857cd3fc23ec255a925179430b90/src/main/java/in/ashwanthkumar/gocd/github/GitHubPRBuildPlugin.java#L392-L401

      my-PR:
        plugin_configuration:
          id: github.pr
          version: 1
        options:
          url: [email protected]:my-org/my-repo.git
          defaultBranch: main

conbon avatar Nov 28 '23 15:11 conbon