Skip to content
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

Force GoCD to build every commit (WIP) #76

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

juhasipo
Copy link
Collaborator

@juhasipo juhasipo commented Oct 9, 2016

I've been working on a fix for a major issue with Gerrit plugin. At this phase I wanted know what other people are thinking about this feature since it is a workaround to a problem that I think should be solved in GoCD itself. This feature is still WIP. It has been tested in production but it still needs couple of finishing touches:

  • Commits should be built in chronological order. Now the order is still pseudo-random order of the hash map.
  • Better instructions and labels (and add tooltips?)

At the moment GoCD merges commits if it sees that there are multiple related incoming commits. This causes GoCD to skip building and testing some of the commits pushed to Gerrit. This makes the Gerrit plugin quite useless because most of the time developers push more than one commit/change to Gerrit for review so many of of these changes won't ever get the pass/failed status from GoCD.

This fix isn't really an ideal way to fix the issue but it should work well enough. The fix changes the plugin behavior so that it doesn't give any new commits to GoCD until the pipeline has completed all the stages. This is checked via the pipeline status and history APIs.

In order to do this, the SCM material has to know the name of the pipeline that is building the changes so that the plugin can search pipeline activity for the correct pipeline. The pipeline name is given in the SCM material settings and it is not part of the identity so that there can be multiple related SCM materials in different pipelines.

This PR is built on top of the white/blacklist feature's setting changes so that PR should be merged first.

@ashwanthkumar
Copy link
Owner

There're too many changes to view in this PR. May be we should merge the other one first so we know the exact changes that's needed for this. I have never used Gerrit before so I'm not familiar with the workflow, but my only request would be to make this an opt-in feature (may be at a material / plugin level) than to have it enabled by default for all plugins.

This is great work! 👍

@juhasipo
Copy link
Collaborator Author

@ashwanthkumar Yes, since it is based on the white/blaklist PR it makes hard to see exactly what was changed. The relevant changes start from commit 78aa0af. I'll make this PR cleaner hopefully later this week once I get some time merge the other white/blacklist PR.

@ashwanthkumar
Copy link
Owner

Sure @juhasipo - Thanks!

This basically works by holding back commits until GoCD can
schedule them. This assumes that GoCD starts scheduling the given
commits right after the plugin gives them to the server. This
will prevent the case where GoCD is building one commit whichs
takes long time to build. Meanwhile other commits would be given
to GoCD and it would merge these commits. That would result some
of the commits to be skipped.

This is useful when using tools like Gerrit which should make
GoCD to build every change set and report the result back to Gerrit.
Without this feature GoCD will skip some changeset if the changeset
are related to each other.

This feature requires access to Go's pipeline API so that it can
check if the pipeline can be scheduled.

This will also require the pipeline to have only one stage. Otherwise
GoCD (tested on versions 16.2, 16.6) may require manual triggering of
the second stage even when pipeline isn't configured to behave like
this.
Only Gerrit uses plugin level settings for now.
Don't allow to start a build if there is something still building.
@TomUdr
Copy link

TomUdr commented Jan 26, 2018

Hi, this work is awesome and quite critical. Can I ask about the current status? I see there are some conficts. Is there plan to solve them and release this?
Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants