Created
November 9, 2012 18:48
-
-
Save forest/4047458 to your computer and use it in GitHub Desktop.
A script to connect to tracker, look for finished stories, grep the git log, and mark the finished ones as delivered. #jenkins #pivotal-tracker
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# gem 'pivotal-tracker' | |
require 'pivotal-tracker' | |
TRACKER_TOKEN = "..." | |
TRACKER_PROJECT_ID = "..." | |
PivotalTracker::Client.token = TRACKER_TOKEN | |
PivotalTracker::Client.use_ssl = true | |
unpakt_project = PivotalTracker::Project.find(TRACKER_PROJECT_ID) | |
stories = unpakt_project.stories.all(:state => "finished", :story_type => ['bug', 'feature']) | |
staging_deploy_tag = `git tag | grep staging | tail -n1` | |
stories.each do | story | | |
puts "Searching for #{story.id} in local git repo." | |
search_result = `git log --grep #{story.id} #{staging_deploy_tag}` | |
if search_result.length > 0 | |
puts "Found #{story.id}, marking as delivered." | |
story.notes.create(:text => "Delivered by staging deploy script.") | |
story.update({"current_state" => "delivered"}) | |
else | |
puts "Coult not find #{story.id} in git repo." | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This doesn't work when tested on an Ubuntu 14.04 LTS box running TeamCity 8.1.5.
Error was: fatal: Option '--grep' requires a value
Line 19 should read:
search_result =
git log --grep=#{story.id} #{staging_deploy_tag}
Note the '=' after --grep. Presumably required on Ubuntu implementation of grep/git-log.