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

Fix overriding notes bug and add tests #3

Merged
merged 9 commits into from Apr 11, 2012
Merged

Conversation

tucker250
Copy link
Contributor

@bfulton - First pass at a fix for losing git note history, and a refac to make it possible to unit test the plugin. The core change to fix the bug was to make the git note addition work like this:

  1. git fetch -f origin refs/notes/jenkins:refs/notes/jenkins
  2. prev_note = git notes --ref=jenkins show HEAD
  3. git notes --ref=jenkins add -f -m "{:data => value, previous_note => $prev}" HEAD
  4. git push origin refs/notes/jenkins

Since a race is possible here if two workers are adding a note to the same commit, if step 4 fails then we restart from step one. Note that the push in step 4 is not forced, and the pull in step 1 is. GitNotesPublisher will retry up to 3 times before giving up.

One open question is what "giving up on a git note" should entail. Should the build fail?

Tucker Sylvestro and others added 8 commits April 10, 2012 22:29
* add rspec
* update README to mention testing
* simplify build, launcher, listener passing w/ BuildContext
* simplify logging and execing with Builder mixin
* add ConcurrentModificationError
* move constants to Constants
* switch to exception throwing instead of returning false
* fix two {:raise => true} issues
* change retry loop to begin-rescue-retry
* move note generation to own class
* couple renames and brought tests up to changes
…-git-notes-plugin into fix_overriding_notes_bug

Conflicts:
	models/git_note.rb
	models/git_notes_publisher.rb
	spec/models/git_notes_publisher_spec.rb
	spec/spec_helper.rb
@@ -0,0 +1,24 @@
require 'singleton'
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this a singleton?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And why separate it out from the Builder?

@bfulton
Copy link
Contributor

bfulton commented Apr 11, 2012

@tucker250: Addressed concerns in latest commit. Merging.

bfulton added a commit that referenced this pull request Apr 11, 2012
Fix overriding notes bug and add tests
@bfulton bfulton merged commit 52fad53 into master Apr 11, 2012
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

2 participants