pact_broker 2.26.1 → 2.27.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +9 -0
- data/README.md +3 -4
- data/lib/pact_broker/api/decorators/pacticipant_decorator.rb +8 -0
- data/lib/pact_broker/api/pact_broker_urls.rb +4 -0
- data/lib/pact_broker/doc/views/webhooks.markdown +11 -9
- data/lib/pact_broker/pacts/placeholder_pact.rb +2 -2
- data/lib/pact_broker/version.rb +1 -1
- data/lib/pact_broker/webhooks/render.rb +7 -1
- data/spec/lib/pact_broker/webhooks/render_spec.rb +24 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 05fcf55e9f52ba3eab88ff971faffb939b8bf3a3
|
4
|
+
data.tar.gz: 15dd2c9ae6976e5f0ed924947072625fab619dfe
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 74e9bf66eebb3355c4809b5423469242ccfb31d780eb29c3c0d28d6d6b140726826a4fa8ac204672631a5cd856356708580e6e7d205468b4a3e8f76e4c1c1e2d
|
7
|
+
data.tar.gz: 7e52f4d4457fa1a9c013a3d58340d5ccbc01b4075c0fd7ca7d787b66593e0a71736992e773bec72e4767e6cdddb5bb893087380e61896b1e75537e516dfd7e26
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,12 @@
|
|
1
|
+
<a name="v2.27.0"></a>
|
2
|
+
### v2.27.0 (2018-09-07)
|
3
|
+
|
4
|
+
|
5
|
+
#### Features
|
6
|
+
|
7
|
+
* add ${pactbroker.consumerLabels} and ${pactbroker.providerLabels} to webhook templates ([afebbc5a](/../../commit/afebbc5a))
|
8
|
+
|
9
|
+
|
1
10
|
<a name="v2.26.1"></a>
|
2
11
|
### v2.26.1 (2018-09-07)
|
3
12
|
|
data/README.md
CHANGED
@@ -136,11 +136,10 @@ You can use the [Pact Broker Docker image][docker] or [Terraform on AWS][terrafo
|
|
136
136
|
#### Rolling your own
|
137
137
|
|
138
138
|
* Are you sure you don't just want to use the [Pact Broker Docker image][docker]? No Docker at your company yet? Ah well, keep reading.
|
139
|
-
* Create a PostgreSQL (recommended) or MySQL (not recommended,
|
140
|
-
|
141
|
-
* Check the [travis.yml][travisyml] file to make sure you're using the version of the database that we're currently running our tests against.
|
139
|
+
* Create a PostgreSQL (recommended) or MySQL (not _as_ recommended because of @bethesque's personal prejudices, but still fully supported) database.
|
140
|
+
* To ensure you're on a supported version of the database that you choose, check the [travis.yml][travisyml] file to see which versions we're currently running our tests against.
|
142
141
|
* If you're using PostgreSQL (did we mention this was _recommended!_) you'll find the database creation script in the [example/config.ru](https://github.com/pact-foundation/pact_broker/blob/master/example/config.ru).
|
143
|
-
* Install ruby 2.
|
142
|
+
* Install ruby 2.4 or later and the latest version of bundler (if you've come this far, I'm assuming you know how to do both of these. Did I mention there was a [Docker][docker] image?)
|
144
143
|
* Copy the [pact\_broker](https://github.com/DiUS/pact_broker-docker/tree/master/pact_broker) directory from the Pact Broker Docker project. This will have the recommended settings for database connections, logging, basic auth etc. Note that the Docker image uses Phusion Passenger as the web application server in front of the Pact Broker Ruby application, which is the recommended set up.
|
145
144
|
* Modify the config.ru and Gemfile as desired (eg. choose database driver gem, set your database credentials. Use the "pg" gem if using Postgres and the "mysql2" gem if using MySQL)
|
146
145
|
* example Sequel configuration for postgres `{adapter: "postgres", database: "pact_broker", username: 'pact_broker', password: 'pact_broker', :encoding => 'utf8'}`
|
@@ -33,6 +33,14 @@ module PactBroker
|
|
33
33
|
}
|
34
34
|
end
|
35
35
|
|
36
|
+
link :'pb:label' do | options |
|
37
|
+
{
|
38
|
+
title: "Get, create or delete a label for #{represented.name}",
|
39
|
+
href: templated_label_url_for_pacticipant(represented.name, options[:base_url]),
|
40
|
+
templated: true
|
41
|
+
}
|
42
|
+
end
|
43
|
+
|
36
44
|
# TODO deprecate in v3
|
37
45
|
# URL isn't implemented
|
38
46
|
# link 'latest-version' do | options |
|
@@ -140,6 +140,10 @@ module PactBroker
|
|
140
140
|
pacticipant_url_from_params({pacticipant_name: pacticipant_name}, base_url) + "/versions/{version}/tags/{tag}"
|
141
141
|
end
|
142
142
|
|
143
|
+
def templated_label_url_for_pacticipant pacticipant_name, base_url = ""
|
144
|
+
pacticipant_url_from_params({pacticipant_name: pacticipant_name}, base_url) + "/labels/{label}"
|
145
|
+
end
|
146
|
+
|
143
147
|
def label_url label, base_url
|
144
148
|
"#{labels_url(label.pacticipant, base_url)}/#{label.name}"
|
145
149
|
end
|
@@ -84,15 +84,17 @@ To specify an XML body, you will need to use a correctly escaped string (or use
|
|
84
84
|
|
85
85
|
The following variables may be used in the request path, parameters or body, and will be replaced with their appropriate values at runtime.
|
86
86
|
|
87
|
-
`${pactbroker.consumerName}`: the consumer name
|
88
|
-
`${pactbroker.providerName}`: the provider name
|
89
|
-
`${pactbroker.consumerVersionNumber}`: the version number of the most recent consumer version associated with the pact content.
|
90
|
-
`${pactbroker.providerVersionNumber}`: the provider version number for the verification result
|
91
|
-
`${pactbroker.consumerVersionTags}`: the list of tag names for the most recent consumer version associated with the pact content, separated by ", ".
|
92
|
-
`${pactbroker.providerVersionTags}`: the list of tag names for the provider version associated with the verification result, separated by ", ".
|
93
|
-
`${pactbroker.
|
94
|
-
`${pactbroker.
|
95
|
-
`${pactbroker.
|
87
|
+
* `${pactbroker.consumerName}`: the consumer name
|
88
|
+
* `${pactbroker.providerName}`: the provider name
|
89
|
+
* `${pactbroker.consumerVersionNumber}`: the version number of the most recent consumer version associated with the pact content.
|
90
|
+
* `${pactbroker.providerVersionNumber}`: the provider version number for the verification result
|
91
|
+
* `${pactbroker.consumerVersionTags}`: the list of tag names for the most recent consumer version associated with the pact content, separated by ", ".
|
92
|
+
* `${pactbroker.providerVersionTags}`: the list of tag names for the provider version associated with the verification result, separated by ", ".
|
93
|
+
* `${pactbroker.consumerLabels}`: the list of labels for the consumer associated with the pact content, separated by ", ".
|
94
|
+
* `${pactbroker.providerLabels}`: the list of labels for the provider associated with the pact content, separated by ", ".
|
95
|
+
* `${pactbroker.githubVerificationStatus}`: the verification status using the correct keywords for posting to the the [Github commit status API](https://developer.github.com/v3/repos/statuses).
|
96
|
+
* `${pactbroker.pactUrl}`: the "permalink" URL to the newly published pact (the URL specifying the consumer version URL, rather than the "/latest" format.)
|
97
|
+
* `${pactbroker.verificationResultUrl}`: the URL to the relevant verification result.
|
96
98
|
|
97
99
|
Example usage:
|
98
100
|
|
@@ -4,8 +4,8 @@ module PactBroker
|
|
4
4
|
module Pacts
|
5
5
|
class PlaceholderPact < PactBroker::Domain::Pact
|
6
6
|
def initialize
|
7
|
-
consumer = OpenStruct.new(name: "placeholder-consumer")
|
8
|
-
@provider = OpenStruct.new(name: "placeholder-provider")
|
7
|
+
consumer = OpenStruct.new(name: "placeholder-consumer", labels: [OpenStruct.new(name: "placeholder-consumer-label")])
|
8
|
+
@provider = OpenStruct.new(name: "placeholder-provider", labels: [OpenStruct.new(name: "placeholder-provider-label")])
|
9
9
|
@consumer_version = OpenStruct.new(number: "gggghhhhjjjjkkkkllll66667777888899990000", pacticipant: consumer, tags: [OpenStruct.new(name: "master")])
|
10
10
|
@consumer_version_number = @consumer_version.number
|
11
11
|
@created_at = DateTime.now
|
data/lib/pact_broker/version.rb
CHANGED
@@ -16,7 +16,9 @@ module PactBroker
|
|
16
16
|
'${pactbroker.consumerVersionTags}' => consumer_version_tags(pact),
|
17
17
|
'${pactbroker.consumerName}' => pact ? pact.consumer_name : "",
|
18
18
|
'${pactbroker.providerName}' => pact ? pact.provider_name : "",
|
19
|
-
'${pactbroker.githubVerificationStatus}' => github_verification_status(verification)
|
19
|
+
'${pactbroker.githubVerificationStatus}' => github_verification_status(verification),
|
20
|
+
'${pactbroker.consumerLabels}' => pacticipant_labels(pact && pact.consumer),
|
21
|
+
'${pactbroker.providerLabels}' => pacticipant_labels(pact && pact.provider)
|
20
22
|
}
|
21
23
|
|
22
24
|
if escaper
|
@@ -61,6 +63,10 @@ module PactBroker
|
|
61
63
|
""
|
62
64
|
end
|
63
65
|
end
|
66
|
+
|
67
|
+
def self.pacticipant_labels pacticipant
|
68
|
+
pacticipant && pacticipant.labels ? pacticipant.labels.collect(&:name).join(", ") : ""
|
69
|
+
end
|
64
70
|
end
|
65
71
|
end
|
66
72
|
end
|
@@ -21,6 +21,8 @@ module PactBroker
|
|
21
21
|
consumer_version_number: "1.2.3+foo",
|
22
22
|
consumer_name: "Foo",
|
23
23
|
provider_name: "Bar",
|
24
|
+
consumer: consumer,
|
25
|
+
provider: provider,
|
24
26
|
latest_verification: nil)
|
25
27
|
end
|
26
28
|
|
@@ -32,6 +34,8 @@ module PactBroker
|
|
32
34
|
consumer_version_number: "1.2.3+foo",
|
33
35
|
consumer_name: "Foo",
|
34
36
|
provider_name: "Bar",
|
37
|
+
consumer: consumer,
|
38
|
+
provider: provider,
|
35
39
|
latest_verification: verification)
|
36
40
|
end
|
37
41
|
|
@@ -41,9 +45,19 @@ module PactBroker
|
|
41
45
|
consumer_version_number: "1.2.3+foo",
|
42
46
|
consumer_name: "Foo",
|
43
47
|
provider_name: "Bar",
|
48
|
+
consumer: consumer,
|
49
|
+
provider: provider,
|
44
50
|
latest_verification: failed_verification)
|
45
51
|
end
|
46
52
|
|
53
|
+
let (:provider) do
|
54
|
+
double("provider", labels: provider_labels)
|
55
|
+
end
|
56
|
+
|
57
|
+
let (:consumer) do
|
58
|
+
double("consumer", labels: consumer_labels)
|
59
|
+
end
|
60
|
+
|
47
61
|
let(:verification) do
|
48
62
|
double("verification", provider_version_number: "3", success: true, provider_version: provider_version)
|
49
63
|
end
|
@@ -68,6 +82,14 @@ module PactBroker
|
|
68
82
|
[ double("tag", name: "test") ]
|
69
83
|
end
|
70
84
|
|
85
|
+
let(:provider_labels) do
|
86
|
+
[ double("label", name: "finance"), double("label", name: "IT") ]
|
87
|
+
end
|
88
|
+
|
89
|
+
let(:consumer_labels) do
|
90
|
+
[ double("label", name: "foo"), double("label", name: "bar") ]
|
91
|
+
end
|
92
|
+
|
71
93
|
let(:nil_pact) { nil }
|
72
94
|
let(:nil_verification) { nil }
|
73
95
|
|
@@ -91,6 +113,8 @@ module PactBroker
|
|
91
113
|
["${pactbroker.verificationResultUrl}", "http://verification", :pact_with_successful_verification, :verification],
|
92
114
|
["${pactbroker.providerVersionTags}", "test, prod", :pact_with_successful_verification, :verification],
|
93
115
|
["${pactbroker.consumerVersionTags}", "test", :pact_with_successful_verification, :verification],
|
116
|
+
["${pactbroker.consumerLabels}", "foo, bar", :pact_with_successful_verification, :verification],
|
117
|
+
["${pactbroker.providerLabels}", "finance, IT", :pact, :nil_verification],
|
94
118
|
]
|
95
119
|
|
96
120
|
TEST_CASES.each do | (template, expected_output, pact_var_name, verification_var_name) |
|