deployment_pipeline 0.0.0 → 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile CHANGED
@@ -1,6 +1,6 @@
1
1
  source :rubygems
2
2
  gem "thor","0.14.6"
3
- gem "pg"
3
+ #gem "pg"
4
4
  gem "active_support"
5
5
  gem "i18n"
6
6
  gem "chronic"
data/README.md CHANGED
@@ -1,4 +1,3 @@
1
-
2
1
  Deployment Pipeline (Let's make Continuous Deployment painless)
3
2
  -------------------
4
3
 
@@ -9,14 +8,14 @@ a feature is released. Deployment Pipeline is here to help you manage these rel
9
8
 
10
9
 
11
10
  ### Ideal Scenario:
12
-
11
+
13
12
  1. Your Product Managers write feature/bug stories and prioritize them anytime during the day.
14
13
  2. Your engineering team believes in Continuous Integration and all engineers commit to Master branch (or Trunk) several times a day.
15
14
  3. If the build (CI) is green, that tag from Master Branch might get pushed to QA environment for stories to be delivered.
16
15
  4. Once all stories are accepted, (QA) Staging Tag is deployed to production, Happy Ending of the day!
17
16
 
18
17
  ### Practical Scenario:
19
- 1. You have 5 Product Managers who requests feature/bug stories and prioritize them anytime during the day.
18
+ 1. You have 5 Product Managers who request feature/bug stories and prioritize them anytime during the day.
20
19
  2. You have 10 engineers working on 5 stories and commits to Master branch (or Trunk) several times a day.
21
20
  3. Build is green only 60% of time during the day.
22
21
  4. By the time build is green there are commits to 4 finished & intermediate commits to an 1 un-finished story.
@@ -29,7 +28,7 @@ a feature is released. Deployment Pipeline is here to help you manage these rel
29
28
  - ==Day Rolls Over==
30
29
  11. 3 new stories requested by Product Managers.
31
30
  12. An engineer finishes 2 of new stories quickly whose commits goes to master. 3rd new story might take long to finish, but gets its commits pushed to master.
32
- 13. Build is green and a tag on master is pushed to QA environment.
31
+ 13. Build is green and a tag on master is pushed to QA environment.
33
32
  14. 2 new stories are delivered and accepted.
34
33
  15. ...
35
34
  16. Which staging tag on master would you deploy to production? At any given time there are commits from un-finished/un-delivered stories.
@@ -54,10 +53,10 @@ a feature is released. Deployment Pipeline is here to help you manage these rel
54
53
  6. Deploy release branch to production
55
54
  7. Automate this entire process
56
55
 
57
- ### Deployment Pipline @ Work :
56
+ ### Deployment Pipeline @ Work :
58
57
  ####Getting Started:
59
58
  <pre><code>
60
- developers-machine:~/workspace/repository (master)$ <b>pipeline help</b>
59
+ developers-machine:~/workspace/repository (master)$ <b>pipeline help</b>
61
60
  Tasks:
62
61
  pipeline help [TASK] # Describe available tasks or one specific task
63
62
  pipeline release_plan # Prepares a release plan
@@ -73,18 +72,113 @@ Options:
73
72
 
74
73
  ####Find Suitable Commit for All-Accepted Marker:
75
74
  <pre><code>
76
- developers-machine:~/workspace/repository (master)$ <b>pipeline help</b>
77
- Tasks:
78
- pipeline help [TASK] # Describe available tasks or one specific task
79
- pipeline release_plan # Prepares a release plan
80
- pipeline setup # Setup Deployment Pipeline Tool
81
- pipeline status # lists all stories with their status
82
- pipeline suitable_release # Suggests a release commit to be picked and also includes a release plan
75
+ developers-machine:~/workspace/repository (master)$ <b>pipeline suitable_release --last-release-commit="c0512b2cebf86e96baa1fe783ba4c01b55b40000"</b>
76
+ Analysing... c0512b2cebf86e96baa1fe783ba4c01b55b40000
77
+ Commit is untagged hence considered
78
+ Analysing... aaa756c1c79829aa6680df66dda62f0a59c336a1
79
+ Stories accepted for aaa756c1c79829aa6680df66dda62f0a59c336a1, hence considered
80
+ Analysing... 7b9cf2863e35add6663a7e964440b4f75befe572
81
+ Stories accepted for 7b9cf2863e35add6663a7e964440b4f75befe572, hence considered
82
+ Analysing... eb94f53ac8969fee134fe6677f7a6bf457b155c5
83
+ Stories accepted for eb94f53ac8969fee134fe6677f7a6bf457b155c5, hence considered
84
+ Analysing... 44d1324d0899cba238a3a53d470f655fcf4b64e2
85
+ Stories accepted for 44d1324d0899cba238a3a53d470f655fcf4b64e2, hence considered
86
+ Analysing... ef9d1a6a1e8bac5112c6ff491c97c083769bd553
87
+ Stories accepted for ef9d1a6a1e8bac5112c6ff491c97c083769bd553, hence considered
88
+ Analysing... ee0112cad3f58b362281c786a197d27148b13f12
89
+ Stories accepted for ee0112cad3f58b362281c786a197d27148b13f12, hence considered
90
+ Analysing... 331cdaca1cfd3672d901ca56218cef9330540241
91
+ Commit is untagged hence considered
92
+ Analysing... a2380cf7f3ad3ab660927bac6177073b123b002e
93
+ Commit is untagged hence considered
94
+ Analysing... b1c281030100d40f46057b5b8463ee7d16952b29
95
+ Commit is untagged hence considered
96
+ Analysing... e65d84b68ff038a96769bd9b10c1cb3997f625bb
97
+ Commit is untagged hence considered
98
+ Analysing... 20c4a74ffd298f0d9bf60679b23823fc32d4ec26
99
+ Unsuitable commit because story status is not accepted
100
+ <b>Commit that can be pickup up for release is: e65d84b68ff038a96769bd9b10c1cb3997f625bb</b>
83
101
 
84
- Options:
85
- [--config=CONFIG] # A ruby file that defines relevant constants & configs. accepts ENV $PIPELINE_CONFIG
86
- # Default: /Users/dev_home/.pipeline_config
87
102
  </code></pre>
88
103
 
104
+ ####Find status of stories between given commits on a branch:
105
+
106
+ <pre><code>
107
+ developers-machine:~/workspace/repository (master)$ <b>pipeline status --commit-range="3191320e8d7c5a402d17a560b12677b44344b300..9471d8794a28cc3a6888fa3a42c03edb4f4458812" --html </b>
108
+ Fetching...: 100% |============================================| Time: 0:00:11
109
+ STATUS:
110
+ </code></pre>
111
+ <quote>
112
+ >OUTPUT:
113
+ > finished:
114
+ >
115
+ * (bug) [Users unable to reset their password](http://www.pivotaltracker.com/story/show/1) requested by **Rajnikanth** owned by Tom Cruise
116
+ * (bug) [Banner ad spacing issue](http://www.pivotaltracker.com/story/show/2) requested by **Bill G** owned by Jacky Chan
117
+
118
+ >accepted:
119
+ >
120
+ * (chore) [Reduce memory foot print](http://www.pivotaltracker.com/story/show/3) requested by **Big B** owned by Tony
121
+ * (feature) [Users can foresee their future](http://www.pivotaltracker.com/story/show/4) requested by **Rajnikanth** owned by Tom Cruise
122
+
123
+ > Following commits have not been tagged, (**why?**)
124
+ >
125
+ * 3191320e8d7c5a402d17a560b12677b44d11b3d1 Super crazy commit by **Tom**
126
+ * 49297c0b1e28cc63d0117c62b08420a4465b6b8f lazy to add tag by **Dick**
127
+ * 401a997f402666a148a8e54582b6feedfb7a9148 Fixed Build by **Harry**
128
+ </quote>
129
+
130
+
131
+ ####Find suitable release plan (find out exact stuff that will be seen on production):
132
+
133
+ <pre><code>
134
+ developers-machine:~/workspace/repository (master)$ <b>pipeline release_plan --last-release-commit="3191320e8d7c5a402g17a561b12777b44344b3d5" --target-release-commit="9471d8794a28cc3a6888fa3a42c03eab4f445823" --html </b>
135
+ Fetching...: 100% |============================================| Time: 0:00:22
136
+
137
+ </code></pre>
138
+ <quote>
139
+ >OUTPUT:
140
+ > Release can be locked at commit 9471d8794a28cc3a6888fa3a42c03edb4f4458a6
141
+
142
+ > Stories being released are:
143
+ >
144
+ * (chore) [Reduce memory foot print](http://www.pivotaltracker.com/story/show/3) requested by **Big B** owned by Tony
145
+ * (feature) [Users can foresee their future](http://www.pivotaltracker.com/story/show/4) requested by requested by **Rajnikanth** owned by Tom Cruise
146
+
147
+
148
+ > Commits that needs to be cherry-picked as they are part of above stories:
149
+ >
150
+ * 401a997f402666a148a8e54582b6feedfb7a9149 [#1234] Related to memory by **Harry**
151
+
152
+ </quote>
153
+
154
+
155
+ ####Installation:
156
+ <pre><code>
157
+ developers-machine:~/workspace/repository (master)$ <b>gem install deployment_pipeline</b>
158
+ developers-machine:~/workspace/repository (master)$ <b>pipeline setup</b>
159
+ Let's setup Deployment Pipeline
160
+ Pivotal Tracker Token: <i>2d2b1f708d2b1f708cd2b1f708c</i>
161
+ Pivotal Tracker Project Ids (comma separated): <i>1234,5678,9876</i>
162
+ Setup complete! (Configuration updated in <b>~/.pipeline_config</b>)
163
+ Thanks for choosing Deployment Pipeline
164
+
165
+ </code></pre>
166
+
167
+ ####Inspiration
168
+
169
+ * [Continuous Delivery](http://en.wikipedia.org/wiki/Continuous_delivery)
170
+ * [Git Story](https://github.com/visibletrap/git_story) Project from [visibletrap](https://github.com/visibletrap) & [acroca](https://github.com/acroca)
171
+ * [Jenkin's](http://jenkins-ci.org/) Build Pipeline Project
172
+
173
+
89
174
  <sub>\[**1**\]: Team which is motivated for [release-often philosophy](http://radar.oreilly.com/2009/03/continuous-deployment-5-eas.html) so much that it releases to production multiple times a day. It uses DVCS like **[Git](http://git-scm.com)** and agile story tracker like **[PIVOTAL TRACKER](http://www.pivotaltracker.com)**. It has adopted TDD & **[Continious Integration](http://en.wikipedia.org/wiki/Continuous_integration)** as way of life. Every engineer [commits to master all the time](http://martinfowler.com/bliki/FeatureBranch.html#PromiscuousIntegrationVsContinuousIntegration).
175
+ </sub>
176
+
177
+ ---------------------------------------------------------------
178
+ <sub>
179
+ #####Copyright (c) 2012 Abhishek Parolkar [abhishek[at]parolkar[dot]com)
180
+
181
+ ######Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
182
+ ######The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
183
+ ######THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
90
184
  </sub>
data/bin/pipeline CHANGED
@@ -2,30 +2,45 @@
2
2
 
3
3
  require File.dirname(__FILE__) + '/../lib/pipeline'
4
4
 
5
+
5
6
  class PipelineCmd < Thor
6
7
  class_option :config, :type => :string,
7
8
  :desc => "A ruby file that defines relevant constants & configs. accepts ENV $PIPELINE_CONFIG",
8
9
  :default => ENV["PIPELINE_CONFIG"] || "#{ENV['HOME']}/.pipeline_config"
9
- def initialize(args=[], options={}, config={})
10
- super
11
- load(self.options[:config])
12
- end
13
10
 
14
11
  desc "setup", "Setup Deployment Pipeline Tool"
15
12
  method_option :force, :type => :boolean, :default => false, :desc => "Force operation"
16
13
  def setup
17
- #stub
18
- puts "Setup complete!"
14
+ say("Let's setup Deployment Pipeline")
15
+ p_token = ask("Pivotal Tracker Token:")
16
+ project_ids= ask("Pivotal Tracker Project Ids (comma separated):")
17
+
18
+ unless File.exists?(options[:config])
19
+ FileUtils.cp "#{File.dirname(__FILE__) + '/../sample.pipeline_config'}", options[:config]
20
+ end
21
+
22
+ pivotal_config_sample =<<MSG
23
+ PIVOTAL_TRACKER_TOKEN = "your_cryptic_pivotal_token"
24
+ PIVOTAL_TRACKER_PROJECT_IDS = ["proj_id1","proj_id2"]
25
+ MSG
26
+ config_file = File.open(options[:config],"r")
27
+ config_string = config_file.read
28
+ fp =File.open(options[:config],"w")
29
+ fp.write(config_string.gsub(pivotal_config_sample,"PIVOTAL_TRACKER_TOKEN = \"#{p_token}\" \nPIVOTAL_TRACKER_PROJECT_IDS = #{project_ids.split(',').inspect}"))
30
+ fp.close
31
+
32
+ puts "Setup complete! (Configuration updated in #{options[:config]})"
33
+ puts "Thanks for choosing Deployment Pipeline"
19
34
  end
20
35
 
21
36
 
22
37
  desc "status", "lists all stories with their status"
23
38
  method_option :repository_path, :default => "#{Dir.pwd}", :desc => "Git repository path"
24
39
  method_option :branch, :default => "master", :desc => "Git branch to consider"
25
- method_option :commit_range, :type => :string, :desc => "Range of commits, eg.\"last_release_tag1..HEAD\""
40
+ method_option :commit_range, :type => :string, :desc => "Range of commits, eg.\"from_commit_sha..to_commit_sha\""
26
41
  method_option :html, :type => :boolean, :default => false, :desc => "pretty html output"
27
42
  def status
28
-
43
+ load(self.options[:config])
29
44
  c_range = options[:commit_range]
30
45
  c_range = c_range.split("..")
31
46
 
@@ -75,6 +90,7 @@ class PipelineCmd < Thor
75
90
  method_option :branch, :default => "master", :desc => "Git branch to consider"
76
91
  method_option :last_release_commit, :type => :string, :desc => "Commit id (SHA) of previous release "
77
92
  def suitable_release
93
+ load(self.options[:config])
78
94
  last_release_commit = options[:last_release_commit]
79
95
  code_repo = CodeRepository.new(options[:repository_path],last_release_commit)
80
96
  tracker = PivotalTracker.new
@@ -123,6 +139,7 @@ class PipelineCmd < Thor
123
139
  method_option :target_release_commit, :type => :string, :desc => "Commit id (SHA) of intended release "
124
140
  method_option :html, :type => :boolean, :default => false, :desc => "pretty html output"
125
141
  def release_plan
142
+ load(self.options[:config])
126
143
  last_release_commit = options[:last_release_commit]
127
144
  target_release_commit = options[:target_release_commit]
128
145
  code_repo = CodeRepository.new(options[:repository_path],last_release_commit)
@@ -196,7 +213,4 @@ class PipelineCmd < Thor
196
213
 
197
214
  end
198
215
 
199
-
200
-
201
-
202
216
  PipelineCmd.start
@@ -5,7 +5,7 @@ Gem::Specification.new do |gem|
5
5
  gem.description = "Deployment Pipeline makes Continuous Deployment super easy."
6
6
  gem.homepage = "https://github.com/parolkar/deployment_pipeline"
7
7
  gem.summary = gem.description
8
- gem.version = "0.0.0"
8
+ gem.version = "0.0.1"
9
9
  gem.authors = ["Abhishek Parolkar"]
10
10
  gem.email = "abhishek@parolkar.com"
11
11
  gem.has_rdoc = false
@@ -18,5 +18,6 @@ Gem::Specification.new do |gem|
18
18
  gem.add_dependency "rdiscount"
19
19
  gem.add_dependency "progressbar","0.11.0"
20
20
  gem.add_dependency "hpricot"
21
+ gem.add_dependency "active_support"
21
22
  end
22
23
 
@@ -19,7 +19,8 @@ class CodeRepository
19
19
 
20
20
  return [] if commit_list.empty?
21
21
  author_names = []
22
- @commits.each do |c|
22
+ commit_list.each do |oid|
23
+ c = @repo.lookup(oid)
23
24
  next unless @commits.map(&:oid).include?(c.oid)
24
25
  author = c.author
25
26
  names = author[:name]
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: deployment_pipeline
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.0
4
+ version: 0.0.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-07-01 00:00:00.000000000 Z
12
+ date: 2012-07-06 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rugged
@@ -91,6 +91,22 @@ dependencies:
91
91
  - - ! '>='
92
92
  - !ruby/object:Gem::Version
93
93
  version: '0'
94
+ - !ruby/object:Gem::Dependency
95
+ name: active_support
96
+ requirement: !ruby/object:Gem::Requirement
97
+ none: false
98
+ requirements:
99
+ - - ! '>='
100
+ - !ruby/object:Gem::Version
101
+ version: '0'
102
+ type: :runtime
103
+ prerelease: false
104
+ version_requirements: !ruby/object:Gem::Requirement
105
+ none: false
106
+ requirements:
107
+ - - ! '>='
108
+ - !ruby/object:Gem::Version
109
+ version: '0'
94
110
  description: Deployment Pipeline makes Continuous Deployment super easy.
95
111
  email: abhishek@parolkar.com
96
112
  executables: