heroku_tool 0.9.2 → 0.9.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +8 -0
- data/lib/heroku_tool/commander.rb +25 -6
- data/lib/heroku_tool/tasks/heroku.thor +3 -3
- data/lib/heroku_tool/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 5aff0c40aebac826f0c564531114ce61762c7e1fed7ad87b281160c7b27bccd0
|
|
4
|
+
data.tar.gz: b8ff4953f2f385b49f7a25a8f276bdce0e5221f34db9a5207b3f60fb3ebe1c63
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 7275494d3fbd74ac696cd30394b8a7969594c6c77e2ad9aac787a1562247956a3b28de99940a6f085da2b55d99337a3a207c66b441710c0f50c2328d92055783
|
|
7
|
+
data.tar.gz: 8a49007bd74cd1b5cedf559e3d7ad0afaae2765eef98d9c25b2003e04afedb7c422052f168d2fc6e3fb4ec090beb28583fc05719c785703230a18764b9d2f9fe
|
data/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
require "open3"
|
|
4
|
+
require "shellwords"
|
|
4
5
|
|
|
5
6
|
module HerokuTool
|
|
6
7
|
class Commander
|
|
@@ -14,13 +15,21 @@ module HerokuTool
|
|
|
14
15
|
@configuration = configuration
|
|
15
16
|
end
|
|
16
17
|
|
|
18
|
+
# The deploy ref is resolved to a commit once, before anything else happens, and that commit is what gets
|
|
19
|
+
# described, pushed and recorded: checking out another branch (or fetching) while the deploy is running
|
|
20
|
+
# doesn't change what is deployed or how it is reported.
|
|
21
|
+
#
|
|
22
|
+
# @return [String, false] the revision (commit sha) that was deployed, or false if the deploy failed
|
|
17
23
|
def deploy(deploy_ref, with_maintenance:)
|
|
18
|
-
|
|
24
|
+
revision = resolve_revision(deploy_ref)
|
|
25
|
+
return false unless revision
|
|
26
|
+
|
|
27
|
+
deploy_ref_description = deploy_ref_describe(revision)
|
|
19
28
|
puts "Deploy #{deploy_ref_description} to #{target} with migrate=#{target.migrate_in_release_phase ? "(during release phase)" : migrate_outside_of_release_phase?} with_maintenance=#{with_maintenance} "
|
|
20
29
|
|
|
21
|
-
output_to_be_deployed(
|
|
30
|
+
output_to_be_deployed(revision)
|
|
22
31
|
configuration.before_deploying(self, target, deploy_ref_description)
|
|
23
|
-
successful_push = puts_and_system "git push -f #{target.git_remote} #{
|
|
32
|
+
successful_push = puts_and_system "git push -f #{target.git_remote} #{revision}:#{target.heroku_target_ref}"
|
|
24
33
|
|
|
25
34
|
return false unless successful_push
|
|
26
35
|
|
|
@@ -32,12 +41,22 @@ module HerokuTool
|
|
|
32
41
|
app_revision_env_var = configuration.app_revision_env_var
|
|
33
42
|
if app_revision_env_var && app_revision_env_var != "HEROKU_SLUG_COMMIT"
|
|
34
43
|
# HEROKU_SLUG_COMMIT is automatically set by https://devcenter.heroku.com/articles/dyno-metadata
|
|
35
|
-
puts_and_system
|
|
44
|
+
puts_and_system "heroku config:set #{app_revision_env_var}=#{Shellwords.escape(deploy_ref_description)} -a #{target.heroku_app}"
|
|
36
45
|
end
|
|
37
46
|
|
|
38
47
|
maintenance_off if with_maintenance
|
|
39
48
|
configuration.after_deploying(self, target, deploy_ref_description)
|
|
40
|
-
|
|
49
|
+
revision
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
# @return [String, nil] the sha of the commit that deploy_ref (or the target's deploy_ref) points at right now
|
|
53
|
+
def resolve_revision(deploy_ref = nil)
|
|
54
|
+
deploy_ref ||= target.deploy_ref
|
|
55
|
+
revision = `git rev-parse --verify --quiet #{deploy_ref}^{commit}`.strip
|
|
56
|
+
return revision unless revision.empty?
|
|
57
|
+
|
|
58
|
+
puts "❌ Can't resolve '#{deploy_ref}' to a commit"
|
|
59
|
+
nil
|
|
41
60
|
end
|
|
42
61
|
|
|
43
62
|
def maintenance_on
|
|
@@ -55,7 +74,7 @@ module HerokuTool
|
|
|
55
74
|
end
|
|
56
75
|
|
|
57
76
|
def deploy_ref_describe(deploy_ref = nil)
|
|
58
|
-
`git describe #{deploy_ref || target.deploy_ref}`.strip
|
|
77
|
+
`git describe --always #{deploy_ref || target.deploy_ref}`.strip
|
|
59
78
|
end
|
|
60
79
|
|
|
61
80
|
def output_to_be_deployed(since_deploy_ref = nil)
|
|
@@ -135,9 +135,9 @@ class Heroku < Thor
|
|
|
135
135
|
check_deploy_ref(deploy_ref)
|
|
136
136
|
with_maintenance = options[:maintenance].nil? && migrate_outside_of_release_phase? || options[:maintenance] || false
|
|
137
137
|
deploy_ref ||= target.deploy_ref
|
|
138
|
-
|
|
139
|
-
if
|
|
140
|
-
deploy_tracking(target_name,
|
|
138
|
+
deployed_revision = commander.deploy(deploy_ref, with_maintenance: with_maintenance)
|
|
139
|
+
if deployed_revision
|
|
140
|
+
deploy_tracking(target_name, deployed_revision)
|
|
141
141
|
else
|
|
142
142
|
exit(-1)
|
|
143
143
|
end
|
data/lib/heroku_tool/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: heroku_tool
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.9.
|
|
4
|
+
version: 0.9.3
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Tim Diggins
|
|
@@ -173,7 +173,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
173
173
|
- !ruby/object:Gem::Version
|
|
174
174
|
version: '0'
|
|
175
175
|
requirements: []
|
|
176
|
-
rubygems_version:
|
|
176
|
+
rubygems_version: 3.6.9
|
|
177
177
|
specification_version: 4
|
|
178
178
|
summary: Tool for configurable one-shot deployment and db managment with heroku and
|
|
179
179
|
rails
|