capistrano-deploybot 1.0.0 → 1.1.1
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/lib/capistrano-deploybot/capistrano.rb +13 -4
- data/lib/capistrano-deploybot/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1c316494b8c8c8798549de0b9ef00c521f76a8642e2845ef623b70ec6eb4485a
|
4
|
+
data.tar.gz: c776e2883344b3fd4d979f24dd23195d0fd05d85cc75cec3575b3986bf88d6f4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4cc31b6a29f976e62738dcaba5b487bff18d242c5d5101b2a0c7a8f38bca96e1e85a2aa20573e3d38f08a79a44f1cc250e0c38eb73f3203ff282682f0966f27d
|
7
|
+
data.tar.gz: 97ae53c66e9612886895c453de2e304215e7baa571af3033b7f0f927ded3ea56d74f5fdfe7ecbffbbedd3049fb796f449e23811e19dd402ed992895af1e5de86
|
@@ -7,6 +7,7 @@ module CapistranoDeploybot
|
|
7
7
|
class Capistrano
|
8
8
|
DEFAULT_OPTIONS = {
|
9
9
|
username: :autodeploy,
|
10
|
+
jira_url: nil,
|
10
11
|
environments: {
|
11
12
|
staging: {
|
12
13
|
slack_webhooks: [],
|
@@ -15,7 +16,7 @@ module CapistranoDeploybot
|
|
15
16
|
}
|
16
17
|
}
|
17
18
|
|
18
|
-
JIRA_TICKET_ID_REGEXP = /[A-Z]{2,}-\d
|
19
|
+
JIRA_TICKET_ID_REGEXP = /([A-Z]{2,}-\d+)/
|
19
20
|
|
20
21
|
def initialize(env)
|
21
22
|
@env = env
|
@@ -60,15 +61,21 @@ module CapistranoDeploybot
|
|
60
61
|
jira_issues = extract_jira_ids_from_commits(current_revision, previous_revision)
|
61
62
|
return if jira_issues.empty?
|
62
63
|
|
64
|
+
release_tag = ENV['CI_COMMIT_TAG']
|
65
|
+
|
63
66
|
payload = {
|
64
|
-
issues: jira_issues
|
67
|
+
issues: jira_issues,
|
68
|
+
data: { releaseVersion: release_tag }
|
65
69
|
}
|
66
70
|
|
67
71
|
webhooks.each do |webhook|
|
68
72
|
post_to_webhook(webhook, payload)
|
69
73
|
end
|
74
|
+
|
75
|
+
message = "[deploybot] Notified JIRA webhooks with tickets: #{jira_issues.join(', ')}"
|
76
|
+
message << " and release: #{release_tag}" if release_tag
|
70
77
|
|
71
|
-
@env.info(
|
78
|
+
@env.info(message)
|
72
79
|
end
|
73
80
|
|
74
81
|
def deploy_target(rails_env, application_name)
|
@@ -81,7 +88,9 @@ module CapistranoDeploybot
|
|
81
88
|
end
|
82
89
|
|
83
90
|
def payload_text(current_revision, previous_revision, deploy_target)
|
84
|
-
"Deployed to #{deploy_target}:\n" + `git shortlog #{previous_revision}..#{current_revision}`
|
91
|
+
message = "Deployed to #{deploy_target}:\n" + `git shortlog #{previous_revision}..#{current_revision}`
|
92
|
+
message = message.split("\n").map { |s| s.gsub(JIRA_TICKET_ID_REGEXP, '[\1]' + "(#{URI(@opts[:jira_url]).to_s.chomp('/')}/browse/" + '\1' + ')') }.join("\n") if @opts[:jira_url]
|
93
|
+
message
|
85
94
|
end
|
86
95
|
|
87
96
|
def post_to_webhook(url, payload)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: capistrano-deploybot
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kamil Baćkowski
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-10-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: capistrano
|
@@ -54,7 +54,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
54
54
|
- !ruby/object:Gem::Version
|
55
55
|
version: '0'
|
56
56
|
requirements: []
|
57
|
-
rubygems_version: 3.
|
57
|
+
rubygems_version: 3.3.7
|
58
58
|
signing_key:
|
59
59
|
specification_version: 4
|
60
60
|
summary: Capistrano deploy integration for slack
|