gantree 0.6.4 → 0.6.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/gantree/cli.rb +2 -0
- data/lib/gantree/deploy.rb +4 -6
- data/lib/gantree/deploy_version.rb +5 -1
- data/lib/gantree/release_notes.rb +15 -8
- data/lib/gantree/version.rb +1 -1
- data/lib/gantree/wiki.rb +1 -1
- data/spec/lib/gantree/1_release_notes_spec.rb +4 -4
- data/spec/lib/gantree/wiki_spec.rb +2 -2
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fab5339982cb3099c8b0a393375b0700907f751a
|
4
|
+
data.tar.gz: d689ccf77086f35f6bea4cc3a7da1b69535029b8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 72ff98c01a21d02a83960a6dbc5d492f1c0b745fdacb3ecdc4c4339237151c1847657c43d44b020c2989d1cc7f57fa847953d50b9c109937dfcf58d15ff03580
|
7
|
+
data.tar.gz: e0ea01beb2ef7c3dbd302daf41e3253b54c25802a335afe0d55740fb2cbc5b94bd6160b4a96185ff3b417ce26086d8567cf78a85a4d2ca827f159e138df73fd0
|
data/lib/gantree/cli.rb
CHANGED
@@ -18,6 +18,7 @@ module Gantree
|
|
18
18
|
option :autodetect_app_role, :desc => "use naming convention to determin role (true|false)", :type => :boolean, :default => true
|
19
19
|
option :eb_bucket, :desc => "bucket to store elastic beanstalk versions"
|
20
20
|
option :auth, :desc => "dockerhub authentation, example: bucket/key"
|
21
|
+
option :release_notes_staging, :type => :boolean, :default => false, :desc => "force release notes generation for staging deploys"
|
21
22
|
def deploy name
|
22
23
|
opts = merge_defaults(options)
|
23
24
|
Gantree::Base.check_for_updates(opts)
|
@@ -100,6 +101,7 @@ module Gantree
|
|
100
101
|
option :hush, :desc => "quite puts messages", :default => true
|
101
102
|
option :eb_bucket, :desc => "bucket to store elastic beanstalk versions"
|
102
103
|
option :auth, :desc => "dockerhub authentation, example: bucket/key"
|
104
|
+
option :release_notes_staging, :type => :boolean, :default => false, :desc => "force release notes generation for staging deploys"
|
103
105
|
def ship server
|
104
106
|
opts = merge_defaults(options)
|
105
107
|
Gantree::Base.check_for_updates(opts)
|
data/lib/gantree/deploy.rb
CHANGED
@@ -64,7 +64,7 @@ module Gantree
|
|
64
64
|
return if @options[:dry_run]
|
65
65
|
version = DeployVersion.new(@options, envs[0])
|
66
66
|
@packaged_version = version.run
|
67
|
-
puts @packaged_version
|
67
|
+
puts "packaged_version: #{@packaged_version}"
|
68
68
|
upload_to_s3
|
69
69
|
create_eb_version
|
70
70
|
update_application(envs)
|
@@ -79,8 +79,9 @@ module Gantree
|
|
79
79
|
Librato::Metrics.annotate :deploys, "deploys",:source => "#{@app}", :start_time => Time.now.to_i
|
80
80
|
puts "Librato metric submitted"
|
81
81
|
end
|
82
|
-
|
83
|
-
|
82
|
+
env = @envs.find {|e| e =~ /-app/ }
|
83
|
+
if env && @options[:release_notes_wiki] && (prod_deploy? || @options[:release_notes_staging])
|
84
|
+
ReleaseNotes.new(@options[:release_notes_wiki], env, @packaged_version).create
|
84
85
|
`git tag #{tag}`
|
85
86
|
`git push --tags`
|
86
87
|
end
|
@@ -150,9 +151,6 @@ module Gantree
|
|
150
151
|
def prod_deploy?
|
151
152
|
@envs.first.split("-").first == "prod"
|
152
153
|
end
|
153
|
-
def new_hash
|
154
|
-
@packaged_version.split("-")[2]
|
155
|
-
end
|
156
154
|
end
|
157
155
|
end
|
158
156
|
|
@@ -49,9 +49,13 @@ module Gantree
|
|
49
49
|
image
|
50
50
|
end
|
51
51
|
|
52
|
+
def version_tag
|
53
|
+
@options[:tag] || tag
|
54
|
+
end
|
55
|
+
|
52
56
|
def create_version_files
|
53
57
|
clean_up
|
54
|
-
version = "#{
|
58
|
+
version = "#{version_tag}-#{Time.now.strftime("%m-%d-%Y-%H-%M-%S")}"
|
55
59
|
puts "version: #{version}"
|
56
60
|
set_auth if @options[:auth]
|
57
61
|
set_image_path if @options[:image_path]
|
@@ -4,11 +4,15 @@ module Gantree
|
|
4
4
|
class ReleaseNotes
|
5
5
|
attr_reader :current_sha
|
6
6
|
attr_writer :beanstalk
|
7
|
-
def initialize
|
7
|
+
def initialize(wiki, env_name, packaged_version)
|
8
8
|
@env_name = env_name
|
9
9
|
@wiki = wiki
|
10
10
|
@org = wiki.split("/")[0..-2].join("/")
|
11
|
-
@
|
11
|
+
@packaged_version = packaged_version
|
12
|
+
end
|
13
|
+
|
14
|
+
def current_sha
|
15
|
+
@packaged_version.split("-")[2]
|
12
16
|
end
|
13
17
|
|
14
18
|
def beanstalk
|
@@ -35,8 +39,8 @@ module Gantree
|
|
35
39
|
name.include?("-") ? name.split("-")[1] : name # TODO: business logic
|
36
40
|
end
|
37
41
|
|
38
|
-
def
|
39
|
-
|
42
|
+
def pacific_time
|
43
|
+
Time.now.strftime '%Y-%m-%d %a %I:%M%p PDT'
|
40
44
|
end
|
41
45
|
|
42
46
|
def commits
|
@@ -58,8 +62,12 @@ module Gantree
|
|
58
62
|
@commits = commits.uniq.sort
|
59
63
|
end
|
60
64
|
|
65
|
+
def commits_list
|
66
|
+
commits.collect{|x| "* #{x}" }.join("\n")
|
67
|
+
end
|
68
|
+
|
61
69
|
def git_log
|
62
|
-
execute("git log --no-merges --pretty=format:'%B COMMIT_SEPARATOR' #{
|
70
|
+
execute("git log --no-merges --pretty=format:'%B COMMIT_SEPARATOR' #{previous_sha}..#{current_sha}").strip
|
63
71
|
end
|
64
72
|
|
65
73
|
def execute(cmd)
|
@@ -69,9 +77,8 @@ module Gantree
|
|
69
77
|
def notes
|
70
78
|
compare = "#{previous_sha}...#{current_sha}"
|
71
79
|
notes = <<-EOL
|
72
|
-
|
73
|
-
|
74
|
-
#{commits.collect{|x| "* #{x}" }.join("\n")}
|
80
|
+
#{@env_name} #{pacific_time} [#{compare}](#{@org}/#{app_name}/compare/#{compare}) by #{ENV['USER']} (#{@packaged_version})
|
81
|
+
#{commits_list}
|
75
82
|
EOL
|
76
83
|
end
|
77
84
|
|
data/lib/gantree/version.rb
CHANGED
data/lib/gantree/wiki.rb
CHANGED
@@ -4,8 +4,8 @@ describe Gantree::ReleaseNotes do
|
|
4
4
|
before(:all) do
|
5
5
|
@wiki = "https://github.com/br/dev.wiki.git"
|
6
6
|
@env_name = "stag-rails-app-s1"
|
7
|
-
@
|
8
|
-
@rn = Gantree::ReleaseNotes.new(@wiki, @env_name, @
|
7
|
+
@packaged_version = "br-master-d961c96-06-17-2015-23-33-25.zip"
|
8
|
+
@rn = Gantree::ReleaseNotes.new(@wiki, @env_name, @packaged_version)
|
9
9
|
@rn.beanstalk = Aws::ElasticBeanstalk::Client.new(stub_responses: true)
|
10
10
|
end
|
11
11
|
|
@@ -27,7 +27,7 @@ describe Gantree::ReleaseNotes do
|
|
27
27
|
end
|
28
28
|
|
29
29
|
it "can retrieve the current sha" do
|
30
|
-
expect(@rn.current_sha).to eq
|
30
|
+
expect(@rn.current_sha).to eq "d961c96"
|
31
31
|
end
|
32
32
|
|
33
33
|
it "should generate notes" do
|
@@ -36,7 +36,7 @@ describe Gantree::ReleaseNotes do
|
|
36
36
|
notes = @rn.notes
|
37
37
|
puts notes if ENV['DEBUG']
|
38
38
|
expect(notes).to include(@env_name)
|
39
|
-
expect(notes).to include(@rn.
|
39
|
+
expect(notes).to include(@rn.pacific_time)
|
40
40
|
expect(notes).to include("compare")
|
41
41
|
expect(notes).to include("test up controller")
|
42
42
|
end
|
@@ -28,11 +28,11 @@ describe Gantree::Wiki do
|
|
28
28
|
FileUtils.rm_f(@wiki.file_path)
|
29
29
|
@wiki.add_to_top
|
30
30
|
notes = IO.read(@wiki.file_path)
|
31
|
-
expect(notes).to eq "#{@notes}\n
|
31
|
+
expect(notes).to eq "#{@notes}\n"
|
32
32
|
|
33
33
|
@wiki.add_to_top
|
34
34
|
notes = IO.read(@wiki.file_path)
|
35
|
-
expect(notes).to eq "#{@notes}\n
|
35
|
+
expect(notes).to eq "#{@notes}\n#{@notes}\n"
|
36
36
|
end
|
37
37
|
|
38
38
|
it "should push" do
|