escobar 0.3.4 → 0.3.6
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/.rubocop.yml +3 -0
- data/lib/escobar.rb +1 -0
- data/lib/escobar/heroku/app.rb +5 -1
- data/lib/escobar/heroku/build.rb +23 -8
- data/lib/escobar/heroku/build_request.rb +9 -5
- data/lib/escobar/heroku/pipeline.rb +14 -4
- data/lib/escobar/heroku/release.rb +63 -0
- data/lib/escobar/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 057a7451fec509ee272972a0f81078d0dac7e41f
|
4
|
+
data.tar.gz: fc19310666d77b537f139e99581e133fb8b2a3ce
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 11917124e4d40f75eeaf5a98b196df275d18f77961ea32228d8356f814f32294c57fbbbb75eb83d320b8140f375cca09d52be3cc297eedc3c86bc4d37a6db7de
|
7
|
+
data.tar.gz: d08521ed38d5f06fee160b1c10cec67ad5251f1026520af313b4e0f456d205ef758913d5fbd6f9ebe6bdf8ada6f3b0a7720d6ca8b5c8b90e0cc519a4cf561a73
|
data/.rubocop.yml
CHANGED
data/lib/escobar.rb
CHANGED
data/lib/escobar/heroku/app.rb
CHANGED
@@ -20,6 +20,10 @@ module Escobar
|
|
20
20
|
"https://dashboard.heroku.com/apps/#{name}"
|
21
21
|
end
|
22
22
|
|
23
|
+
def cache_key
|
24
|
+
"escobar-app-#{id}"
|
25
|
+
end
|
26
|
+
|
23
27
|
# Accepts either google authenticator or yubikey second_factor formatting
|
24
28
|
def preauth(second_factor)
|
25
29
|
!client.heroku.put("/apps/#{id}/pre-authorizations", second_factor).any?
|
@@ -31,7 +35,7 @@ module Escobar
|
|
31
35
|
end
|
32
36
|
|
33
37
|
def build_request_for(pipeline)
|
34
|
-
Escobar::Heroku::BuildRequest.new(pipeline,
|
38
|
+
Escobar::Heroku::BuildRequest.new(pipeline, id)
|
35
39
|
end
|
36
40
|
end
|
37
41
|
end
|
data/lib/escobar/heroku/build.rb
CHANGED
@@ -2,17 +2,16 @@ module Escobar
|
|
2
2
|
module Heroku
|
3
3
|
# Class representing a heroku build
|
4
4
|
class Build
|
5
|
-
attr_reader :app_id, :
|
5
|
+
attr_reader :app_id, :client, :id
|
6
6
|
|
7
7
|
attr_accessor :command_id
|
8
8
|
attr_accessor :github_url
|
9
9
|
attr_accessor :pipeline_name
|
10
10
|
attr_accessor :sha
|
11
11
|
|
12
|
-
def initialize(client,
|
12
|
+
def initialize(client, app_id, id)
|
13
13
|
@id = id
|
14
|
-
@app_id =
|
15
|
-
@app_name = app.name
|
14
|
+
@app_id = app_id
|
16
15
|
@client = client
|
17
16
|
end
|
18
17
|
|
@@ -20,8 +19,24 @@ module Escobar
|
|
20
19
|
@info ||= client.heroku.get("/apps/#{app_id}/builds/#{id}")
|
21
20
|
end
|
22
21
|
|
22
|
+
def status
|
23
|
+
info["status"]
|
24
|
+
end
|
25
|
+
|
26
|
+
def releasing?
|
27
|
+
status == "succeeded" && !release_id.nil?
|
28
|
+
end
|
29
|
+
|
30
|
+
def release_id
|
31
|
+
info["release"]["id"]
|
32
|
+
end
|
33
|
+
|
34
|
+
def app
|
35
|
+
@app ||= Escobar::Heroku::App.new(client, app_id)
|
36
|
+
end
|
37
|
+
|
23
38
|
def dashboard_build_output_url
|
24
|
-
"https://dashboard.heroku.com/apps/#{
|
39
|
+
"https://dashboard.heroku.com/apps/#{app.name}/activity/builds/#{id}"
|
25
40
|
end
|
26
41
|
|
27
42
|
def repository_regex
|
@@ -29,16 +44,16 @@ module Escobar
|
|
29
44
|
end
|
30
45
|
|
31
46
|
def repository
|
32
|
-
github_url.match(repository_regex)[1]
|
47
|
+
github_url && github_url.match(repository_regex)[1]
|
33
48
|
end
|
34
49
|
|
35
50
|
def to_job_json
|
36
51
|
{
|
37
52
|
sha: sha,
|
38
|
-
|
53
|
+
pipeline_name: pipeline_name,
|
39
54
|
repo: repository,
|
40
55
|
app_id: app_id,
|
41
|
-
app_name:
|
56
|
+
app_name: app.name,
|
42
57
|
build_id: id,
|
43
58
|
command_id: command_id,
|
44
59
|
target_url: dashboard_build_output_url,
|
@@ -17,21 +17,25 @@ module Escobar
|
|
17
17
|
end
|
18
18
|
end
|
19
19
|
|
20
|
-
attr_reader :
|
20
|
+
attr_reader :app_id, :github_deployment_url, :pipeline, :sha
|
21
21
|
|
22
22
|
attr_accessor :environment, :ref, :forced, :custom_payload
|
23
23
|
|
24
|
-
def initialize(pipeline,
|
25
|
-
@
|
24
|
+
def initialize(pipeline, app_id)
|
25
|
+
@app_id = app_id
|
26
26
|
@pipeline = pipeline
|
27
27
|
end
|
28
28
|
|
29
|
+
def app
|
30
|
+
@app ||= Escobar::Heroku::App.new(pipeline.client, app_id)
|
31
|
+
end
|
32
|
+
|
29
33
|
def error_for(message)
|
30
34
|
Error.new_from_build_request(self, message)
|
31
35
|
end
|
32
36
|
|
33
37
|
def cache_key
|
34
|
-
|
38
|
+
app.cache_key
|
35
39
|
end
|
36
40
|
|
37
41
|
def create(task, environment, ref, forced, custom_payload)
|
@@ -62,7 +66,7 @@ module Escobar
|
|
62
66
|
|
63
67
|
def process_heroku_build(build)
|
64
68
|
heroku_build = Escobar::Heroku::Build.new(
|
65
|
-
|
69
|
+
pipeline.client, app_id, build["id"]
|
66
70
|
)
|
67
71
|
|
68
72
|
create_github_pending_deployment_status(heroku_build)
|
@@ -84,15 +84,25 @@ module Escobar
|
|
84
84
|
end
|
85
85
|
|
86
86
|
def reap_build(app_id, build_id)
|
87
|
-
|
88
|
-
case
|
87
|
+
build = Escobar::Heroku::Build.new(client, app_id, build_id)
|
88
|
+
case build.status
|
89
89
|
when "succeeded", "failed"
|
90
|
-
|
90
|
+
build
|
91
|
+
end
|
92
|
+
end
|
93
|
+
|
94
|
+
def reap_release(app_id, build_id, release_id)
|
95
|
+
release = Escobar::Heroku::Release.new(
|
96
|
+
client, app_id, build_id, release_id
|
97
|
+
)
|
98
|
+
case release.status
|
99
|
+
when "succeeded", "failed"
|
100
|
+
release
|
91
101
|
end
|
92
102
|
end
|
93
103
|
|
94
104
|
def default_heroku_application(environment)
|
95
|
-
app = environments[environment] && environments[environment].
|
105
|
+
app = environments[environment] && environments[environment].first
|
96
106
|
unless app
|
97
107
|
raise ArgumentError, "No '#{environment}' environment for #{name}."
|
98
108
|
end
|
@@ -0,0 +1,63 @@
|
|
1
|
+
module Escobar
|
2
|
+
module Heroku
|
3
|
+
# Class representing a heroku release
|
4
|
+
class Release
|
5
|
+
attr_reader :app_id, :app_name, :build_id, :client, :id
|
6
|
+
|
7
|
+
attr_accessor :command_id
|
8
|
+
attr_accessor :github_url
|
9
|
+
attr_accessor :pipeline_name
|
10
|
+
attr_accessor :sha
|
11
|
+
|
12
|
+
def initialize(client, app_id, build_id, id)
|
13
|
+
@id = id
|
14
|
+
@app_id = app_id
|
15
|
+
@build_id = build_id
|
16
|
+
@client = client
|
17
|
+
end
|
18
|
+
|
19
|
+
def info
|
20
|
+
@info ||= client.heroku.get("/apps/#{app_id}/releases/#{id}")
|
21
|
+
end
|
22
|
+
|
23
|
+
def app
|
24
|
+
@app ||= Escobar::Heroku::App.new(client, app_id)
|
25
|
+
end
|
26
|
+
|
27
|
+
def build
|
28
|
+
@build ||= Escobar::Heroku::Build.new(client, app.id, build_id)
|
29
|
+
end
|
30
|
+
|
31
|
+
def dashboard_build_output_url
|
32
|
+
"https://dashboard.heroku.com/apps/#{app.name}/activity/builds/#{id}"
|
33
|
+
end
|
34
|
+
|
35
|
+
def repository
|
36
|
+
github_url && github_url.match(repository_regex)[1]
|
37
|
+
end
|
38
|
+
|
39
|
+
def repository_regex
|
40
|
+
%r{https:\/\/api\.github\.com\/repos\/([-_\.0-9a-z]+\/[-_\.0-9a-z]+)}
|
41
|
+
end
|
42
|
+
|
43
|
+
def status
|
44
|
+
info["status"]
|
45
|
+
end
|
46
|
+
|
47
|
+
def to_job_json
|
48
|
+
{
|
49
|
+
sha: sha,
|
50
|
+
name: pipeline_name,
|
51
|
+
repo: repository,
|
52
|
+
app_id: app_id,
|
53
|
+
app_name: app_name,
|
54
|
+
build_id: build_id,
|
55
|
+
release_id: id,
|
56
|
+
command_id: command_id,
|
57
|
+
target_url: dashboard_build_output_url,
|
58
|
+
deployment_url: github_url
|
59
|
+
}
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
data/lib/escobar/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: escobar
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Corey Donohoe
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-01-
|
11
|
+
date: 2017-01-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
@@ -182,6 +182,7 @@ files:
|
|
182
182
|
- lib/escobar/heroku/client.rb
|
183
183
|
- lib/escobar/heroku/coupling.rb
|
184
184
|
- lib/escobar/heroku/pipeline.rb
|
185
|
+
- lib/escobar/heroku/release.rb
|
185
186
|
- lib/escobar/version.rb
|
186
187
|
homepage: https://github.com/atmos/escobar
|
187
188
|
licenses:
|