capistrano-deploybot 1.0.0 → 1.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 25431135f57c0aee8ff3ee5ef54b004c52091854e085200b7bf89ae48e06c6d0
4
- data.tar.gz: 2e959245f4d1c7efeff6cd7506818c0ad3b98c5238cbf7c3dca78b6894fa0424
3
+ metadata.gz: 1c316494b8c8c8798549de0b9ef00c521f76a8642e2845ef623b70ec6eb4485a
4
+ data.tar.gz: c776e2883344b3fd4d979f24dd23195d0fd05d85cc75cec3575b3986bf88d6f4
5
5
  SHA512:
6
- metadata.gz: ce5932e0b2928274558fa9cb2889d5767b4c7af8bd8bb36d9ca014e91c81aeef7b1fa38b4b41c62df7cb041d66a56649cf3b53991ddaef32b967565b093bfb3f
7
- data.tar.gz: 2d6544c283bf76a93b09d421d19e22bb67f9ed37b2d98319d5d52d193b8f889c1615fa8b3e168944f2588c46422458d2972df9afa5a098bfb8f65fc67744ef71
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("[deploybot] Notified JIRA webhooks with tickets: #{jira_issues.join(', ')}")
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)
@@ -1,3 +1,3 @@
1
1
  module CapistranoDeploybot
2
- VERSION = '1.0.0'.freeze
2
+ VERSION = '1.1.1'.freeze
3
3
  end
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.0.0
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: 2021-09-29 00:00:00.000000000 Z
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.1.2
57
+ rubygems_version: 3.3.7
58
58
  signing_key:
59
59
  specification_version: 4
60
60
  summary: Capistrano deploy integration for slack