dual_burner 0.3.1 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.ruby-version +1 -1
- data/CODE_OF_CONDUCT.md +49 -0
- data/LICENSE.txt +21 -0
- data/README.md +14 -7
- data/circle.yml +0 -3
- data/dual_burner.gemspec +4 -3
- data/exe/dual_burner +1 -0
- data/lib/dual_burner/base_command.rb +3 -2
- data/lib/dual_burner/commands/deployer.rb +35 -2
- data/lib/dual_burner/runner.rb +3 -1
- data/lib/dual_burner/version.rb +1 -1
- metadata +19 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9a4f4e3667ff50c1d51eeea5c61d7528299f4039
|
4
|
+
data.tar.gz: 0f43660fd6fc53398f8c69c284296426d0112d1b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a3f8678547cfe7da8ee3dfd9dbd87b41a359ba85e22e53e3c257f92af6f3b5f3d4e33d03be131be4e96f12720446d2dd8773099f619e0a2a69605b28cb154087
|
7
|
+
data.tar.gz: bf96153bf676b0e735d96f05b4a31b594336898bfa72c55761e157c747d836de3bc51d15cf898dd087223ea30e8886540e6571f61f27eb01025f0f4f60f53a21
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.3.
|
1
|
+
2.3.1
|
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,49 @@
|
|
1
|
+
# Contributor Code of Conduct
|
2
|
+
|
3
|
+
As contributors and maintainers of this project, and in the interest of
|
4
|
+
fostering an open and welcoming community, we pledge to respect all people who
|
5
|
+
contribute through reporting issues, posting feature requests, updating
|
6
|
+
documentation, submitting pull requests or patches, and other activities.
|
7
|
+
|
8
|
+
We are committed to making participation in this project a harassment-free
|
9
|
+
experience for everyone, regardless of level of experience, gender, gender
|
10
|
+
identity and expression, sexual orientation, disability, personal appearance,
|
11
|
+
body size, race, ethnicity, age, religion, or nationality.
|
12
|
+
|
13
|
+
Examples of unacceptable behavior by participants include:
|
14
|
+
|
15
|
+
* The use of sexualized language or imagery
|
16
|
+
* Personal attacks
|
17
|
+
* Trolling or insulting/derogatory comments
|
18
|
+
* Public or private harassment
|
19
|
+
* Publishing other's private information, such as physical or electronic
|
20
|
+
addresses, without explicit permission
|
21
|
+
* Other unethical or unprofessional conduct
|
22
|
+
|
23
|
+
Project maintainers have the right and responsibility to remove, edit, or
|
24
|
+
reject comments, commits, code, wiki edits, issues, and other contributions
|
25
|
+
that are not aligned to this Code of Conduct, or to ban temporarily or
|
26
|
+
permanently any contributor for other behaviors that they deem inappropriate,
|
27
|
+
threatening, offensive, or harmful.
|
28
|
+
|
29
|
+
By adopting this Code of Conduct, project maintainers commit themselves to
|
30
|
+
fairly and consistently applying these principles to every aspect of managing
|
31
|
+
this project. Project maintainers who do not follow or enforce the Code of
|
32
|
+
Conduct may be permanently removed from the project team.
|
33
|
+
|
34
|
+
This code of conduct applies both within project spaces and in public spaces
|
35
|
+
when an individual is representing the project or its community.
|
36
|
+
|
37
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
38
|
+
reported by contacting a project maintainer at engineering@blueapron.com. All
|
39
|
+
complaints will be reviewed and investigated and will result in a response that
|
40
|
+
is deemed necessary and appropriate to the circumstances. Maintainers are
|
41
|
+
obligated to maintain confidentiality with regard to the reporter of an
|
42
|
+
incident.
|
43
|
+
|
44
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
|
45
|
+
version 1.3.0, available at
|
46
|
+
[http://contributor-covenant.org/version/1/3/0/][version]
|
47
|
+
|
48
|
+
[homepage]: http://contributor-covenant.org
|
49
|
+
[version]: http://contributor-covenant.org/version/1/3/0/
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
MIT License
|
2
|
+
|
3
|
+
Copyright (c) 2016 Blue Apron, inc.
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
data/README.md
CHANGED
@@ -38,22 +38,28 @@ The YML file manages the environment and clustering information.
|
|
38
38
|
|
39
39
|
```
|
40
40
|
staging:
|
41
|
-
- remote_url: 'git@heroku.com:
|
41
|
+
- remote_url: 'git@heroku.com:example-alpha.git'
|
42
42
|
name: 'Alpha'
|
43
43
|
color: 'blue'
|
44
|
-
|
44
|
+
version_url: 'https://alpha.example.com/version'
|
45
|
+
- remote_url: 'git@heroku.com:example-bravo.git'
|
45
46
|
name: 'Bravo'
|
46
47
|
color: 'green'
|
48
|
+
version_url: 'https://bravo.example.com/version'
|
49
|
+
|
47
50
|
production:
|
48
|
-
- remote_url: 'git@heroku.com:
|
51
|
+
- remote_url: 'git@heroku.com:example-api.git
|
49
52
|
name: 'API'
|
50
53
|
color: 'blue'
|
51
|
-
|
54
|
+
version_url: 'https://api.example.com/version'
|
55
|
+
- remote_url: 'git@heroku.com:example-admin.git'
|
52
56
|
name: 'Admin'
|
53
57
|
color: 'green'
|
54
|
-
|
58
|
+
version_url: 'https://admin.example.com/version'
|
59
|
+
- remote_url: 'git@heroku.com:example-www.git'
|
55
60
|
name: 'WWW'
|
56
61
|
color: 'yellow'
|
62
|
+
version_url: 'https://www.example.com/version'
|
57
63
|
```
|
58
64
|
|
59
65
|
These are the possible configurations for your application.
|
@@ -64,6 +70,7 @@ These are the possible configurations for your application.
|
|
64
70
|
| name | yes | The presentation name for the app. |
|
65
71
|
| color | yes | The presentation color for display. |
|
66
72
|
| heroku_app_name | no | The heroku app name. Needed only for Heroku related commands i.e. `dual_burner config_set`. |
|
73
|
+
| version_url | no | An endpoint providing the current app version. Used to notify when a deployment is live. |
|
67
74
|
|
68
75
|
## Git Commands
|
69
76
|
|
@@ -73,9 +80,9 @@ Use the `dual_burner deploy` executable to deploy your projects.
|
|
73
80
|
|
74
81
|
Below are some examples.
|
75
82
|
|
76
|
-
#### Deploy of Master to Staging
|
83
|
+
#### Deploy of Master to Staging with a live status notification
|
77
84
|
|
78
|
-
`dual_burner deploy -e staging -g master`
|
85
|
+
`dual_burner deploy -e staging -g master -n`
|
79
86
|
|
80
87
|
#### Deploy of Master to Staging with Force
|
81
88
|
|
data/circle.yml
CHANGED
data/dual_burner.gemspec
CHANGED
@@ -10,7 +10,7 @@ Gem::Specification.new do |spec|
|
|
10
10
|
spec.email = ['engineering@blueapron.com']
|
11
11
|
|
12
12
|
spec.summary = %q{Blue Apron Dual Burner}
|
13
|
-
spec.description = %q{A
|
13
|
+
spec.description = %q{A simple Ruby utility to push to many Heroku applications.}
|
14
14
|
spec.homepage = 'https://github.com/blueapron/dual_burner'
|
15
15
|
|
16
16
|
# Note: Files must be registered with git for things to package properly....
|
@@ -19,8 +19,9 @@ Gem::Specification.new do |spec|
|
|
19
19
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
20
20
|
spec.require_paths = ['lib']
|
21
21
|
|
22
|
-
spec.add_dependency 'colorize', '~> 0.7'
|
23
|
-
spec.add_dependency 'thor', '~> 0.19'
|
22
|
+
spec.add_dependency 'colorize', '~> 0.7'
|
23
|
+
spec.add_dependency 'thor', '~> 0.19'
|
24
|
+
spec.add_dependency 'terminal-notifier', '~> 1.7'
|
24
25
|
|
25
26
|
spec.add_development_dependency 'bundler', '>= 1.9.5', '< 2.0'
|
26
27
|
spec.add_development_dependency 'rake', '~> 10.0'
|
data/exe/dual_burner
CHANGED
@@ -54,7 +54,7 @@ module DualBurner
|
|
54
54
|
end
|
55
55
|
|
56
56
|
def app_struct
|
57
|
-
Struct.new(:remote_url, :name, :color, :heroku_app_name)
|
57
|
+
Struct.new(:remote_url, :name, :color, :heroku_app_name, :version_url)
|
58
58
|
end
|
59
59
|
|
60
60
|
#
|
@@ -64,7 +64,8 @@ module DualBurner
|
|
64
64
|
options.fetch('remote_url'),
|
65
65
|
options.fetch('name'),
|
66
66
|
options.fetch('color', nil),
|
67
|
-
options.fetch('heroku_app_name', nil)
|
67
|
+
options.fetch('heroku_app_name', nil),
|
68
|
+
options.fetch('version_url', nil)
|
68
69
|
)
|
69
70
|
end
|
70
71
|
|
@@ -1,7 +1,12 @@
|
|
1
1
|
module DualBurner
|
2
2
|
module Commands
|
3
3
|
class Deployer < DualBurner::BaseCommand
|
4
|
-
def deploy(git_reference: 'master')
|
4
|
+
def deploy(git_reference: 'master', notify: false)
|
5
|
+
# Require version_url
|
6
|
+
if notify && apps.any? { |app| app.version_url.nil? }
|
7
|
+
raise 'version_url must be defined to notify!'
|
8
|
+
end
|
9
|
+
|
5
10
|
# Need to handle the explicit passing of nil too....
|
6
11
|
if git_reference.nil? || git_reference.strip.empty?
|
7
12
|
git_reference = 'master'
|
@@ -23,15 +28,43 @@ module DualBurner
|
|
23
28
|
build_deploy_command(app: app, git_reference: git_reference)
|
24
29
|
end
|
25
30
|
|
26
|
-
verify_results_exit_0(results, context: 'deploys')
|
31
|
+
verify_results_exit_0(results, context: 'deploys').tap do |success|
|
32
|
+
if success && notify
|
33
|
+
wait_for_deployment(git_reference)
|
34
|
+
end
|
35
|
+
end
|
27
36
|
end
|
28
37
|
|
38
|
+
private
|
39
|
+
|
29
40
|
def build_deploy_command(app:, git_reference:)
|
30
41
|
remote = app.remote_url
|
31
42
|
raise DualBurner::RemoteNotFoundException if remote.nil? || remote.strip.empty?
|
32
43
|
"git push #{remote} #{git_reference}"
|
33
44
|
end
|
34
45
|
|
46
|
+
def wait_for_deployment(git_reference)
|
47
|
+
deployed_sha = `git log #{git_reference} -n 1 --pretty=format:'%H'`
|
48
|
+
|
49
|
+
while current_app_versions.any? { |sha| sha != deployed_sha }
|
50
|
+
sleep 2
|
51
|
+
end
|
52
|
+
|
53
|
+
TerminalNotifier.notify(
|
54
|
+
"Latest version (#{git_reference}) is now live!",
|
55
|
+
title: "#{env} deploy",
|
56
|
+
sound: 'alarm'
|
57
|
+
)
|
58
|
+
end
|
59
|
+
|
60
|
+
def current_app_versions
|
61
|
+
results = execute_command_with_threads do |app|
|
62
|
+
"curl -s #{app.version_url} -w \"\n\""
|
63
|
+
end
|
64
|
+
|
65
|
+
results.map { |result| result.lines.first.strip }
|
66
|
+
end
|
67
|
+
|
35
68
|
##
|
36
69
|
# Make sure the user knows what he/she is doing!
|
37
70
|
def challenge_user!(git_reference:)
|
data/lib/dual_burner/runner.rb
CHANGED
@@ -7,6 +7,7 @@ module DualBurner
|
|
7
7
|
GIT_DESC = 'The git reference to deploy.'.freeze unless defined?(GIT_DESC)
|
8
8
|
HEROKU_KEY_DESC = 'The key to set on the Heroku app.'.freeze unless defined?(HEROKU_KEY_DESC)
|
9
9
|
INTERACTIVE_DESC = 'Enable or disable interactive mode'.freeze unless defined?(INTERACTIVE_DESC)
|
10
|
+
NOTIFY_DESC = 'Verify and notify me when this deploy is live.'.freeze unless defined?(NOTIFY_DESC)
|
10
11
|
|
11
12
|
desc 'last_release', 'Finds the HEAD git revision for all applications in cluster <ENV>.'
|
12
13
|
method_option :env, aliases: '-e', type: :string, required: true, desc: ENV_DESC
|
@@ -23,6 +24,7 @@ module DualBurner
|
|
23
24
|
method_option :config, aliases: '-c', type: :string, optional: true, desc: CONFIG_DESC
|
24
25
|
method_option :git_reference, aliases: '-g', default: 'master', type: :string, optional: true, desc: GIT_DESC
|
25
26
|
method_option :interactive, default: true, type: :boolean, optional: true, desc: INTERACTIVE_DESC
|
27
|
+
method_option :notify, aliases: '-n', default: false, lazy_default: true, type: :boolean, optional: true, desc: NOTIFY_DESC
|
26
28
|
def deploy
|
27
29
|
::DualBurner::Commands::Deployer.new(
|
28
30
|
env: options.fetch('env'),
|
@@ -30,7 +32,7 @@ module DualBurner
|
|
30
32
|
deploy_file: options['config'],
|
31
33
|
interactive: options['interactive']
|
32
34
|
)
|
33
|
-
).deploy(git_reference: options['git_reference'])
|
35
|
+
).deploy(git_reference: options['git_reference'], notify: options['notify'])
|
34
36
|
end
|
35
37
|
|
36
38
|
desc 'config_set', 'Set <KEY> to <VALUE> for all Heroku appslocations in cluster <ENV>.'
|
data/lib/dual_burner/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dual_burner
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Blue Apron Engineering
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-10-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: colorize
|
@@ -38,6 +38,20 @@ dependencies:
|
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0.19'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: terminal-notifier
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '1.7'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '1.7'
|
41
55
|
- !ruby/object:Gem::Dependency
|
42
56
|
name: bundler
|
43
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -128,7 +142,7 @@ dependencies:
|
|
128
142
|
- - ">="
|
129
143
|
- !ruby/object:Gem::Version
|
130
144
|
version: '0'
|
131
|
-
description: A
|
145
|
+
description: A simple Ruby utility to push to many Heroku applications.
|
132
146
|
email:
|
133
147
|
- engineering@blueapron.com
|
134
148
|
executables:
|
@@ -141,7 +155,9 @@ files:
|
|
141
155
|
- ".rubocop.yml"
|
142
156
|
- ".ruby-version"
|
143
157
|
- CHANGELOG.md
|
158
|
+
- CODE_OF_CONDUCT.md
|
144
159
|
- Gemfile
|
160
|
+
- LICENSE.txt
|
145
161
|
- README.md
|
146
162
|
- Rakefile
|
147
163
|
- bin/console
|