stash_notifier 1.0.0 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- NDFmOTBjNjZhMGI5MWFkNzUyZWQwZDQyMmVjNTdmY2ZlMjk1ZTFiZg==
4
+ ZDQ5MWE1ZGYxMTgwNjVkZDUzYTFmYzkzZTZmMWIzMWY3ZTc0MDcwYQ==
5
5
  data.tar.gz: !binary |-
6
- NGMwNTNkY2I2YjY3MTA5MWU2NGE1MGM5MGFmOGEyMzZlYTQ4ZjA0YQ==
6
+ OTlhZTZjYTYxYzZiNGE1ZTc5MjkwNjcyMTQwODdmM2UzOTg1MGJlMg==
7
7
  !binary "U0hBNTEy":
8
8
  metadata.gz: !binary |-
9
- N2YzYzQwNWUxOTczZTdhZTZmOWQxMzlmY2FjMjMyMWVjOTVmMmNlOWEyNTY2
10
- NTFiZGU3ODBlOTgzMjA2NTFiMjhjMzczMjJmMjZlYzZkMGYxOGMyNzU1Njg2
11
- MDUwMDE5Y2U0MTVhM2I2MmQ2MmEzMjFiZWJiYzhhZmNmZDliOTM=
9
+ NTgxOGE5NGQxYjcxODQwNzFjOTUxZWYzYmQxZjVhNjMwNDZiYWE1NTIxYjhh
10
+ MGZhMDVlOWVhM2JlNDdjZmVhZGYyYzFiYzg4MGQzMmUyZjQ4ZDU0N2UwMGY4
11
+ ZDhhMjI0NjEyNzZmNmQwM2VmNWVhOGRmZDVmOWNkZmU1NzdkMTA=
12
12
  data.tar.gz: !binary |-
13
- NjkwMTE3ZGEwNjNkMTY0Yjg5OGI1ZGNmOWIyOTZjYTQyZjc1ZmIzYTdkOTc0
14
- YzUzZDM2MThhN2IxNDY0ZjFkY2JhNzk0MmM5MTNmNzAzZmEzOTEyNThlZmEz
15
- Y2UwZjVhMTM5YTBkOTRiNjE5MDgxYzA4YWU1YWU0YTlhNjcyYmI=
13
+ MmMwZDlmNGM3MjI2ZjZmMmM4ZDBlZDViNjkyMTUyOGRlYTdhZTM3Y2JkYTQ4
14
+ NGIxMDkwMjI0ZDkzZTJhM2FkNmJkMWY2YjMzYTQwNDUxM2FiODA0ZTg2ZjBh
15
+ OWU1ZjczZTc1MDc2NzcyZTNkZjBkOThlOGFjNTc1YWI4N2I3NmY=
data/CHANGELOG.md CHANGED
@@ -1,3 +1,6 @@
1
+ ## version 1.1.0
2
+ Fixes #4: Rename "job\_" parameters to "build\_" and add `build_name` param
3
+
1
4
  ## version 1.0.0
2
5
  1. Add ability to specify Chef passwords data bag name
3
6
  2. Add ability to specify Chef config file (e.g. knife.rb or client.rb)
data/bin/notify CHANGED
@@ -20,7 +20,7 @@ require 'slop'
20
20
  require 'stash_notifier'
21
21
 
22
22
  # EXAMPLE:
23
- # notify -u my_chef_user -c e2b8a34c60eeec41d3e9d83f60d3b288e909c1eb -r failed -k foobar -l http://jenkins.my_company.com/jenkins/view/FOO/job/Deploy/17/console -d 'Jenkins deploy job'
23
+ # notify -s https://git.mycompany.com -u my_chef_user -c e2b8a34c60eeec41d3e9d83f60d3b288e909c1eb -r failed -k REPO-MASTER -n REPO-MASTER-12 -l http://jenkins.my_company.com/jenkins/view/FOO/job/Deploy/17/console -d 'Jenkins deploy job'
24
24
 
25
25
  opts = Slop.parse( help: true, strict: true, arguments: true ) do
26
26
  banner 'Usage: notify [options]'
@@ -29,10 +29,11 @@ opts = Slop.parse( help: true, strict: true, arguments: true ) do
29
29
  on :g, :git_commit=, 'Git commit sha'
30
30
  on :d, :data_bag=, 'Name of Chef passwords data bag'
31
31
  on :c, :config=, 'Chef config file'
32
- on :r, :job_status=, 'CI server job status, e.g. INPROGRESS, SUCCESSFUL, FAILED'
33
- on :k, :job_key=, 'CI server job key'
34
- on :l, :job_url=, 'URL to CI server job results'
35
- on :d, :job_description=, 'CI server job description'
32
+ on :r, :build_status=, 'CI server job status, e.g. INPROGRESS, SUCCESSFUL, FAILED'
33
+ on :k, :build_key=, 'CI server job name'
34
+ on :n, :build_name=, 'CI server build name'
35
+ on :l, :build_url=, 'URL to CI server job results'
36
+ on :d, :build_description=, 'CI server job description'
36
37
  end
37
38
 
38
39
  args = opts.to_hash
@@ -14,5 +14,5 @@
14
14
  # limitations under the License.
15
15
 
16
16
  class StashNotifier
17
- VERSION = "1.0.0"
17
+ VERSION = "1.1.0"
18
18
  end
@@ -20,11 +20,11 @@ require "stash_notifier/version"
20
20
 
21
21
  class StashNotifier
22
22
  attr_accessor :stash_url, :stash_user, :git_commit,
23
- :job_key, :job_url, :job_description, :http_client, :pwd_vault
23
+ :build_key, :build_name, :build_url, :build_description, :http_client, :pwd_vault
24
24
 
25
- attr_reader :job_status
25
+ attr_reader :build_status
26
26
 
27
- VALID_JOB_STATUSES = %w{ INPROGRESS SUCCESSFUL FAILED }
27
+ VALID_BUILD_STATUSES = %w{ INPROGRESS SUCCESSFUL FAILED }
28
28
  STASH_BUILD_STATUS_PATH = 'rest/build-status/1.0/commits'
29
29
 
30
30
  DEFAULTS = {
@@ -35,24 +35,25 @@ class StashNotifier
35
35
  def initialize(args)
36
36
  args = DEFAULTS.merge(args) {|key, arg, default| arg.nil? ? default : arg}
37
37
 
38
- @stash_url = args[:stash_url]
39
- @stash_user = args[:stash_user]
40
- @git_commit = args[:git_commit]
41
- self.job_status = args[:job_status]
42
- @job_key = args[:job_key]
43
- @job_url = args[:job_url]
44
- @job_description = args[:job_description]
45
- @http_client = args[:http_client]
46
- @pwd_vault = args[:pwd_vault]
38
+ @stash_url = args[:stash_url]
39
+ @stash_user = args[:stash_user]
40
+ @git_commit = args[:git_commit]
41
+ self.build_status = args[:build_status]
42
+ @build_key = args[:build_key]
43
+ @build_name = args[:build_name]
44
+ @build_url = args[:build_url]
45
+ @build_description = args[:build_description]
46
+ @http_client = args[:http_client]
47
+ @pwd_vault = args[:pwd_vault]
47
48
  end
48
49
 
49
- def job_status=(new_job_status)
50
- new_job_status = new_job_status.strip.upcase
50
+ def build_status=(new_build_status)
51
+ new_build_status = new_build_status.strip.upcase
51
52
 
52
- if VALID_JOB_STATUSES.include?(new_job_status)
53
- @job_status = new_job_status
53
+ if VALID_BUILD_STATUSES.include?(new_build_status)
54
+ @build_status = new_build_status
54
55
  else
55
- raise ArgumentError, "'#{new_job_status}' is not a valid Stash Build Status! Valid job statuses are #{VALID_JOB_STATUSES}."
56
+ raise ArgumentError, "'#{new_build_status}' is not a valid Stash Build Status! Valid job statuses are #{VALID_BUILD_STATUSES}."
56
57
  end
57
58
  end
58
59
 
@@ -88,10 +89,11 @@ class StashNotifier
88
89
 
89
90
  def format_build_result
90
91
  build_result = {
91
- state: job_status,
92
- key: job_key,
93
- url: job_url,
94
- description: job_description
92
+ state: build_status,
93
+ key: build_key,
94
+ name: build_name,
95
+ url: build_url,
96
+ description: build_description
95
97
  }
96
98
  build_result.to_json
97
99
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: stash_notifier
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Doug Ireton
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-05-17 00:00:00.000000000 Z
11
+ date: 2013-05-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday