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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d3741742cfc8f29b64fd8bde01c62c9bdf445b9c
4
- data.tar.gz: 204bd0c2317882a9ce4c50d0cfab2cb9829278ea
3
+ metadata.gz: 05fcf55e9f52ba3eab88ff971faffb939b8bf3a3
4
+ data.tar.gz: 15dd2c9ae6976e5f0ed924947072625fab619dfe
5
5
  SHA512:
6
- metadata.gz: 591321838ff5732fb86fd4383ce4a603cd6f7f35c6337a1554343675c2d33d03bb80481eab609eec311d6e4a79f78961aa027cdf51100d7cb6f3b8a8949e255a
7
- data.tar.gz: aa3ebf059c8d4d0bfb04ffb13c8da4380596c8bbe532daecea1efdcaecff28a1da2546de0567493ce8e06a2799e6899400a90c86214bb493ce89851ca74ff3ae
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, see following note) database.
140
- * __Note:__ It is recommended to use __PostgreSQL__ as it will support JSON search features that are planned in the future, however MySQL the other [semi supported](https://github.com/pact-foundation/pact_broker/issues/33) database.
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.2.0 or later (ruby 2.4 is recommended) and bundler >= 1.12.0 (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?)
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.githubVerificationStatus}`: the verification status using the correct keywords for posting to the the [Github commit status API](https://developer.github.com/v3/repos/statuses).
94
- `${pactbroker.pactUrl}`: the "permalink" URL to the newly published pact (the URL specifying the consumer version URL, rather than the "/latest" format.)
95
- `${pactbroker.verificationResultUrl}`: the URL to the relevant verification result.
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
@@ -1,3 +1,3 @@
1
1
  module PactBroker
2
- VERSION = '2.26.1'
2
+ VERSION = '2.27.0'
3
3
  end
@@ -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) |
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pact_broker
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.26.1
4
+ version: 2.27.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bethany Skurrie