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 +8 -8
- data/CHANGELOG.md +3 -0
- data/bin/notify +6 -5
- data/lib/stash_notifier/version.rb +1 -1
- data/lib/stash_notifier.rb +23 -21
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
ZDQ5MWE1ZGYxMTgwNjVkZDUzYTFmYzkzZTZmMWIzMWY3ZTc0MDcwYQ==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
OTlhZTZjYTYxYzZiNGE1ZTc5MjkwNjcyMTQwODdmM2UzOTg1MGJlMg==
|
7
7
|
!binary "U0hBNTEy":
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
NTgxOGE5NGQxYjcxODQwNzFjOTUxZWYzYmQxZjVhNjMwNDZiYWE1NTIxYjhh
|
10
|
+
MGZhMDVlOWVhM2JlNDdjZmVhZGYyYzFiYzg4MGQzMmUyZjQ4ZDU0N2UwMGY4
|
11
|
+
ZDhhMjI0NjEyNzZmNmQwM2VmNWVhOGRmZDVmOWNkZmU1NzdkMTA=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
MmMwZDlmNGM3MjI2ZjZmMmM4ZDBlZDViNjkyMTUyOGRlYTdhZTM3Y2JkYTQ4
|
14
|
+
NGIxMDkwMjI0ZDkzZTJhM2FkNmJkMWY2YjMzYTQwNDUxM2FiODA0ZTg2ZjBh
|
15
|
+
OWU1ZjczZTc1MDc2NzcyZTNkZjBkOThlOGFjNTc1YWI4N2I3NmY=
|
data/CHANGELOG.md
CHANGED
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
|
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, :
|
33
|
-
on :k, :
|
34
|
-
on :
|
35
|
-
on :
|
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
|
data/lib/stash_notifier.rb
CHANGED
@@ -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
|
-
:
|
23
|
+
:build_key, :build_name, :build_url, :build_description, :http_client, :pwd_vault
|
24
24
|
|
25
|
-
attr_reader :
|
25
|
+
attr_reader :build_status
|
26
26
|
|
27
|
-
|
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
|
39
|
-
@stash_user
|
40
|
-
@git_commit
|
41
|
-
self.
|
42
|
-
@
|
43
|
-
@
|
44
|
-
@
|
45
|
-
@
|
46
|
-
@
|
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
|
50
|
-
|
50
|
+
def build_status=(new_build_status)
|
51
|
+
new_build_status = new_build_status.strip.upcase
|
51
52
|
|
52
|
-
if
|
53
|
-
@
|
53
|
+
if VALID_BUILD_STATUSES.include?(new_build_status)
|
54
|
+
@build_status = new_build_status
|
54
55
|
else
|
55
|
-
raise ArgumentError, "'#{
|
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:
|
92
|
-
key:
|
93
|
-
|
94
|
-
|
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.
|
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-
|
11
|
+
date: 2013-05-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|