shipyrd 0.2.11 → 0.2.14
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/README.md +13 -13
- data/lib/shipyrd/client.rb +25 -14
- data/lib/shipyrd/configuration.rb +59 -0
- data/lib/shipyrd/version.rb +1 -1
- data/lib/shipyrd.rb +14 -0
- data/shipyrd.gemspec +2 -2
- metadata +4 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: f51f6d4663e34e128254858cacb0c275bcf74e9f86b3b1d38bf4281cc75c327f
|
|
4
|
+
data.tar.gz: 4be800ad91fd2f15ee6b826eacf2dda9e31f3c3660fa86020e6de3903005b5c5
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: b805ab9d7a8391f7a8884e79c199321b89bb42d7fc097601e5a683ba710e3d09d0ca387a977bbdfd250f1150c4d229e7dc823f6201ff882c48c3762ecb5c18e2
|
|
7
|
+
data.tar.gz: 2b6b6e8ad39023ed1c344f6f953312ccd767b66a31a5d9e738a286102426301c61fd9d4db05623a366720c0c6cb03fc139a915fa789387c380e40df140e73247
|
data/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
This is a simple helper gem to connect your Kamal hooks(pre-build, pre-build, pre-deploy, post-deploy) to Shipyrd.
|
|
4
4
|
|
|
5
|
-
[Shipyrd](https://shipyrd.io) is
|
|
5
|
+
[Shipyrd](https://shipyrd.io) is the deployment dashboard for your team.
|
|
6
6
|
|
|
7
7
|
## Installation
|
|
8
8
|
|
|
@@ -38,18 +38,18 @@ shipyrd pre-connect
|
|
|
38
38
|
|
|
39
39
|
## Recording a deploy
|
|
40
40
|
|
|
41
|
-
This gem currently sends the following deploy details to record a deploy.
|
|
42
|
-
|
|
43
|
-
* `ENV["KAMAL_COMMAND"]`,
|
|
44
|
-
* `ENV["KAMAL_DESTINATION"]`,
|
|
45
|
-
* `ENV["KAMAL_HOSTS"`,
|
|
46
|
-
* `ENV["KAMAL_PERFORMER"]` - `gh config get -h github.com username` is preferred if set.
|
|
47
|
-
* `ENV["KAMAL_RECORDED_AT"]`,
|
|
48
|
-
* `ENV["KAMAL_ROLE"]`,
|
|
49
|
-
* `ENV["KAMAL_RUNTIME"]`,
|
|
50
|
-
* `ENV["KAMAL_SERVICE_VERSION"]`,
|
|
51
|
-
* `ENV["KAMAL_SUBCOMMAND"]`,
|
|
52
|
-
* `ENV["KAMAL_VERSION"]`,
|
|
41
|
+
This gem currently sends the following deploy details to record a deploy. Each deploy variable can be set with either a `SHIPYRD_` or `KAMAL_` prefix — `SHIPYRD_` takes precedence. The `KAMAL_` variants are set automatically by Kamal when the [hooks are called](https://kamal-deploy.org/docs/hooks/hooks-overview/).
|
|
42
|
+
|
|
43
|
+
* `ENV["SHIPYRD_COMMAND"]` / `ENV["KAMAL_COMMAND"]`,
|
|
44
|
+
* `ENV["SHIPYRD_DESTINATION"]` / `ENV["KAMAL_DESTINATION"]`,
|
|
45
|
+
* `ENV["SHIPYRD_HOSTS"]` / `ENV["KAMAL_HOSTS"]`,
|
|
46
|
+
* `ENV["SHIPYRD_PERFORMER"]` / `ENV["KAMAL_PERFORMER"]` - `gh config get -h github.com username` is preferred if set.
|
|
47
|
+
* `ENV["SHIPYRD_RECORDED_AT"]` / `ENV["KAMAL_RECORDED_AT"]`,
|
|
48
|
+
* `ENV["SHIPYRD_ROLE"]` / `ENV["KAMAL_ROLE"]`,
|
|
49
|
+
* `ENV["SHIPYRD_RUNTIME"]` / `ENV["KAMAL_RUNTIME"]`,
|
|
50
|
+
* `ENV["SHIPYRD_SERVICE_VERSION"]` / `ENV["KAMAL_SERVICE_VERSION"]`,
|
|
51
|
+
* `ENV["SHIPYRD_SUBCOMMAND"]` / `ENV["KAMAL_SUBCOMMAND"]`,
|
|
52
|
+
* `ENV["SHIPYRD_VERSION"]` / `ENV["KAMAL_VERSION"]`,
|
|
53
53
|
* `ENV["SHIPYRD_API_KEY"]`,
|
|
54
54
|
* `ENV["SHIPYRD_HOST"]`,
|
|
55
55
|
* Commit message - The first 90 characters of your commit message `git show -s --format=%s`.
|
data/lib/shipyrd/client.rb
CHANGED
|
@@ -13,13 +13,23 @@ class Shipyrd::Client
|
|
|
13
13
|
KAMAL_SUBCOMMAND
|
|
14
14
|
KAMAL_VERSION
|
|
15
15
|
SHIPYRD_API_KEY
|
|
16
|
+
SHIPYRD_COMMAND
|
|
16
17
|
SHIPYRD_COMMIT_MESSAGE
|
|
18
|
+
SHIPYRD_DESTINATION
|
|
17
19
|
SHIPYRD_HOST
|
|
18
|
-
|
|
20
|
+
SHIPYRD_HOSTS
|
|
21
|
+
SHIPYRD_PERFORMER
|
|
22
|
+
SHIPYRD_RECORDED_AT
|
|
23
|
+
SHIPYRD_ROLE
|
|
24
|
+
SHIPYRD_RUNTIME
|
|
25
|
+
SHIPYRD_SERVICE_VERSION
|
|
26
|
+
SHIPYRD_SUBCOMMAND
|
|
27
|
+
SHIPYRD_VERSION
|
|
28
|
+
].freeze
|
|
19
29
|
|
|
20
30
|
class DestinationBlocked < StandardError; end
|
|
21
31
|
|
|
22
|
-
def initialize(host:
|
|
32
|
+
def initialize(host: Shipyrd.configuration.host, api_key: Shipyrd.configuration.api_key, **options)
|
|
23
33
|
@host = parse_host(host)
|
|
24
34
|
@api_key = api_key
|
|
25
35
|
@logger = options[:logger] || Shipyrd::Logger.new
|
|
@@ -29,6 +39,7 @@ class Shipyrd::Client
|
|
|
29
39
|
def trigger(event)
|
|
30
40
|
return false unless valid_configuration
|
|
31
41
|
|
|
42
|
+
config = Shipyrd.configuration
|
|
32
43
|
uri = URI("#{host}/deploys.json")
|
|
33
44
|
headers = {
|
|
34
45
|
"Content-Type": "application/json",
|
|
@@ -38,17 +49,17 @@ class Shipyrd::Client
|
|
|
38
49
|
details = {
|
|
39
50
|
deploy: {
|
|
40
51
|
status: event,
|
|
41
|
-
recorded_at:
|
|
52
|
+
recorded_at: config.recorded_at,
|
|
42
53
|
performer: performer,
|
|
43
|
-
commit_message:
|
|
44
|
-
version:
|
|
45
|
-
service_version:
|
|
46
|
-
hosts:
|
|
47
|
-
command:
|
|
48
|
-
subcommand:
|
|
49
|
-
role:
|
|
50
|
-
destination:
|
|
51
|
-
runtime:
|
|
54
|
+
commit_message: config.commit_message || commit_message,
|
|
55
|
+
version: config.version,
|
|
56
|
+
service_version: config.service_version,
|
|
57
|
+
hosts: config.hosts,
|
|
58
|
+
command: config.command,
|
|
59
|
+
subcommand: config.subcommand,
|
|
60
|
+
role: config.role,
|
|
61
|
+
destination: config.destination,
|
|
62
|
+
runtime: config.runtime
|
|
52
63
|
}
|
|
53
64
|
}
|
|
54
65
|
|
|
@@ -86,7 +97,7 @@ class Shipyrd::Client
|
|
|
86
97
|
end
|
|
87
98
|
|
|
88
99
|
def performer
|
|
89
|
-
github_username.empty? ?
|
|
100
|
+
github_username.empty? ? Shipyrd.configuration.performer : "https://github.com/#{github_username}"
|
|
90
101
|
end
|
|
91
102
|
|
|
92
103
|
def github_username
|
|
@@ -96,7 +107,7 @@ class Shipyrd::Client
|
|
|
96
107
|
end
|
|
97
108
|
|
|
98
109
|
def commit_message
|
|
99
|
-
message = `git show -s --format=%s`.chomp
|
|
110
|
+
message = `git show -s --format=%s --no-show-signature`.chomp
|
|
100
111
|
|
|
101
112
|
if message.length >= 90
|
|
102
113
|
"#{message[0..90]}..."
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
class Shipyrd::Configuration
|
|
4
|
+
attr_writer :host, :api_key, :commit_message,
|
|
5
|
+
:recorded_at, :performer, :version, :service_version,
|
|
6
|
+
:hosts, :command, :subcommand, :role, :destination, :runtime
|
|
7
|
+
|
|
8
|
+
def host
|
|
9
|
+
@host || ENV["SHIPYRD_HOST"]
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
def api_key
|
|
13
|
+
@api_key || ENV["SHIPYRD_API_KEY"]
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def commit_message
|
|
17
|
+
@commit_message || ENV["SHIPYRD_COMMIT_MESSAGE"]
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
def recorded_at
|
|
21
|
+
@recorded_at || ENV["SHIPYRD_RECORDED_AT"] || ENV["KAMAL_RECORDED_AT"]
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
def performer
|
|
25
|
+
@performer || ENV["SHIPYRD_PERFORMER"] || ENV["KAMAL_PERFORMER"]
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
def version
|
|
29
|
+
@version || ENV["SHIPYRD_VERSION"] || ENV["KAMAL_VERSION"]
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
def service_version
|
|
33
|
+
@service_version || ENV["SHIPYRD_SERVICE_VERSION"] || ENV["KAMAL_SERVICE_VERSION"]
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
def hosts
|
|
37
|
+
@hosts || ENV["SHIPYRD_HOSTS"] || ENV["KAMAL_HOSTS"]
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
def command
|
|
41
|
+
@command || ENV["SHIPYRD_COMMAND"] || ENV["KAMAL_COMMAND"]
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
def subcommand
|
|
45
|
+
@subcommand || ENV["SHIPYRD_SUBCOMMAND"] || ENV["KAMAL_SUBCOMMAND"]
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
def role
|
|
49
|
+
@role || ENV["SHIPYRD_ROLE"] || ENV["KAMAL_ROLE"]
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
def destination
|
|
53
|
+
@destination || ENV["SHIPYRD_DESTINATION"] || ENV["KAMAL_DESTINATION"]
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
def runtime
|
|
57
|
+
@runtime || ENV["SHIPYRD_RUNTIME"] || ENV["KAMAL_RUNTIME"]
|
|
58
|
+
end
|
|
59
|
+
end
|
data/lib/shipyrd/version.rb
CHANGED
data/lib/shipyrd.rb
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
require_relative "shipyrd/version"
|
|
4
|
+
require_relative "shipyrd/configuration"
|
|
4
5
|
require "uri"
|
|
5
6
|
require "net/http"
|
|
6
7
|
require "json"
|
|
@@ -9,4 +10,17 @@ require "shipyrd/client"
|
|
|
9
10
|
require "shipyrd/logger"
|
|
10
11
|
|
|
11
12
|
module Shipyrd
|
|
13
|
+
class << self
|
|
14
|
+
def configure
|
|
15
|
+
yield(configuration)
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
def configuration
|
|
19
|
+
@configuration ||= Shipyrd::Configuration.new
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
def reset_configuration!
|
|
23
|
+
@configuration = nil
|
|
24
|
+
end
|
|
25
|
+
end
|
|
12
26
|
end
|
data/shipyrd.gemspec
CHANGED
|
@@ -8,8 +8,8 @@ Gem::Specification.new do |spec|
|
|
|
8
8
|
spec.authors = ["Nick Hammond"]
|
|
9
9
|
spec.email = ["nick@shipyrd.io"]
|
|
10
10
|
|
|
11
|
-
spec.summary = "The companion gem for Shipyrd, the
|
|
12
|
-
spec.description = "The companion gem for Shipyrd, the
|
|
11
|
+
spec.summary = "The companion gem for Shipyrd, the deployment dashboard for your team"
|
|
12
|
+
spec.description = "The companion gem for Shipyrd, the deployment dashboard for your team"
|
|
13
13
|
spec.homepage = "https://shipyrd.io"
|
|
14
14
|
spec.required_ruby_version = ">= 3.0.7"
|
|
15
15
|
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: shipyrd
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.2.
|
|
4
|
+
version: 0.2.14
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Nick Hammond
|
|
@@ -9,7 +9,7 @@ bindir: bin
|
|
|
9
9
|
cert_chain: []
|
|
10
10
|
date: 1980-01-02 00:00:00.000000000 Z
|
|
11
11
|
dependencies: []
|
|
12
|
-
description: The companion gem for Shipyrd, the
|
|
12
|
+
description: The companion gem for Shipyrd, the deployment dashboard for your team
|
|
13
13
|
email:
|
|
14
14
|
- nick@shipyrd.io
|
|
15
15
|
executables: []
|
|
@@ -25,6 +25,7 @@ files:
|
|
|
25
25
|
- Rakefile
|
|
26
26
|
- lib/shipyrd.rb
|
|
27
27
|
- lib/shipyrd/client.rb
|
|
28
|
+
- lib/shipyrd/configuration.rb
|
|
28
29
|
- lib/shipyrd/logger.rb
|
|
29
30
|
- lib/shipyrd/version.rb
|
|
30
31
|
- shipyrd.gemspec
|
|
@@ -50,5 +51,5 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
50
51
|
requirements: []
|
|
51
52
|
rubygems_version: 3.6.9
|
|
52
53
|
specification_version: 4
|
|
53
|
-
summary: The companion gem for Shipyrd, the
|
|
54
|
+
summary: The companion gem for Shipyrd, the deployment dashboard for your team
|
|
54
55
|
test_files: []
|