pact_broker 2.98.0 → 2.99.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (29) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +24 -0
  3. data/docs/CONFIGURATION.md +11 -1
  4. data/lib/pact_broker/api/middleware/http_debug_logs.rb +13 -7
  5. data/lib/pact_broker/api/resources/base_resource.rb +4 -0
  6. data/lib/pact_broker/api/resources/latest_pacts.rb +1 -1
  7. data/lib/pact_broker/api/resources/pact.rb +0 -8
  8. data/lib/pact_broker/api/resources/pact_content_diff.rb +7 -2
  9. data/lib/pact_broker/api/resources/pact_versions.rb +1 -5
  10. data/lib/pact_broker/api/resources/pact_versions_for_branch.rb +1 -5
  11. data/lib/pact_broker/api/resources/provider_pacts.rb +1 -1
  12. data/lib/pact_broker/api/resources/tagged_pact_versions.rb +1 -5
  13. data/lib/pact_broker/api/resources/verification.rb +0 -4
  14. data/lib/pact_broker/api/resources/verifications.rb +0 -4
  15. data/lib/pact_broker/api/resources/version.rb +8 -0
  16. data/lib/pact_broker/config/runtime_configuration.rb +2 -1
  17. data/lib/pact_broker/config/runtime_configuration_database_methods.rb +1 -1
  18. data/lib/pact_broker/matrix/every_row.rb +19 -1
  19. data/lib/pact_broker/matrix/integration.rb +5 -5
  20. data/lib/pact_broker/matrix/quick_row.rb +36 -3
  21. data/lib/pact_broker/matrix/repository.rb +2 -0
  22. data/lib/pact_broker/pacts/create_formatted_diff.rb +1 -0
  23. data/lib/pact_broker/pacts/eager_loaders.rb +4 -1
  24. data/lib/pact_broker/pacts/pact_publication_dataset_module.rb +25 -0
  25. data/lib/pact_broker/pacts/pact_publication_wip_dataset_module.rb +0 -15
  26. data/lib/pact_broker/test/http_test_data_builder.rb +4 -2
  27. data/lib/pact_broker/ui/views/groups/show.html.erb +2 -2
  28. data/lib/pact_broker/version.rb +1 -1
  29. metadata +3 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d9aac85ace2c0ba5eaacc6fe462dbe4fc3d7623414f13a9bf351bc70d7a8b37f
4
- data.tar.gz: 8bae3685f8b675c447aa986c0629875dad4e5e5e614411dea6ca75d77ed0918d
3
+ metadata.gz: edd8be1bf717f3b98618f1f585146efa701f4833a9c2d8ba05eb395278bd435c
4
+ data.tar.gz: 36c07bdd448edd40e623c0976ec65df4c2512ddf73ce400512e27d08f7a086d8
5
5
  SHA512:
6
- metadata.gz: d2249bef385597430fa0f9c296a4b83e489a71dc027b681f60c57e82efe6805403ae9054d996afeb2a65c20fa7f363e868dd754b4a589249c7a639e86b616c9d
7
- data.tar.gz: 60605b088a39d895374fc10028525b012b7d3a33579ade4f9f3c9119b014fbbf7857a18bb2f09147c65059d35f37a0858fcd126a408ba010dbd1c82ccc7e7788
6
+ metadata.gz: 023ae6605034518c73da217fff6be8c6888bd7d56abcbf11895f18ec3eab9e32775ec574381473e626e1bca75bc3b132fd30fd755157e980d3e16dea9c125f4f
7
+ data.tar.gz: 67d5dcb38a78a5e590ec961826951e32c4e391ad13eea43fbf57faa48de2c20212397cdb116b93c975ecdb576e7790112e6db16b43ba5c866af4c074c0370cd3
data/CHANGELOG.md CHANGED
@@ -1,3 +1,27 @@
1
+ <a name="v2.99.0"></a>
2
+ ### v2.99.0 (2022-05-13)
3
+
4
+ #### Features
5
+
6
+ * remove disable_use_branch_heads_for_latest_branch_pacts feature toggle ([5c6f1766](/../../commit/5c6f1766))
7
+ * remove new_wip_calculation feature toggle ([add6cb08](/../../commit/add6cb08))
8
+ * timeout long running pact content diff requests (#555) ([88abb2cf](/../../commit/88abb2cf))
9
+ * change sql_log_level default from debug to none ([9f7aed46](/../../commit/9f7aed46))
10
+
11
+ #### Bug Fixes
12
+
13
+ * **ui**
14
+ * fix unescaped pacticipant name and main branch in details and network pages ([b8b1d306](/../../commit/b8b1d306))
15
+
16
+ * return a 400 when invalid JSON is used to create a version ([9af2cfaf](/../../commit/9af2cfaf))
17
+ * only log API requests/responses, not web assets, when http_debug_logging_enabled is true ([1f232c08](/../../commit/1f232c08))
18
+
19
+ * **matrix**
20
+ * fix performance issue when querying matrix with one selector ([3a08d128](/../../commit/3a08d128))
21
+
22
+ * **pacts for verification**
23
+ * return the pacts for the branch heads when using the branch selector ([6dac495e](/../../commit/6dac495e))
24
+
1
25
  <a name="v2.98.0"></a>
2
26
  ### v2.98.0 (2022-03-29)
3
27
 
@@ -57,6 +57,7 @@ While the default is `file` for the Ruby application, it is set to `stdout` on t
57
57
 
58
58
  Enable this setting to print the entire request and response to the logs at debug level. Used for troubleshooting issues.
59
59
  Do not leave this on permanently, as it will have performance and security issues.
60
+ Ensure the application [`log_level`](#log_level) is set to `debug` when this setting is enabled.
60
61
 
61
62
  **Supported versions:** From v2.98.0<br/>
62
63
  **Environment variable name:** `PACT_BROKER_HTTP_DEBUG_LOGGING_ENABLED`<br/>
@@ -156,7 +157,7 @@ To disable noisy SQL query logging when the application `log_level` is set to `d
156
157
 
157
158
  **Environment variable name:** `PACT_BROKER_SQL_LOG_LEVEL`<br/>
158
159
  **YAML configuration key name:** `sql_log_level`<br/>
159
- **Default:** `debug`<br/>
160
+ **Default:** From 2.99+, the default is `none`. In previous versions, the default is `debug`.<br/>
160
161
  **Allowed values:** `none`, `debug`, `info`, `warn`, `error`, `fatal`<br/>
161
162
 
162
163
  ### sql_log_warn_duration
@@ -654,6 +655,15 @@ with a unique version number.
654
655
  **Allowed values:** `true`, `false`<br/>
655
656
  **More information:** https://docs.pact.io/versioning<br/>
656
657
 
658
+ ### pact_content_diff_timeout
659
+
660
+ The maximum amount of time in seconds to attempt to generate the diff between two pacts before aborting the request. This is required due to performance issues in the underlying diff generation code.
661
+
662
+ **Supported versions:** From 2.99.0<br/>
663
+ **Environment variable name:** `PACT_BROKER_PACT_CONTENT_DIFF_TIMEOUT`<br/>
664
+ **YAML configuration key name:** `pact_content_diff_timeout`<br/>
665
+ **Default:** `15`<br/>
666
+
657
667
  <br/>
658
668
 
659
669
  ## Miscellaneous
@@ -1,10 +1,12 @@
1
1
  require "pact_broker/logging"
2
+ require "rack/pact_broker/request_target"
2
3
 
3
4
  module PactBroker
4
5
  module Api
5
6
  module Middleware
6
7
  class HttpDebugLogs
7
8
  include PactBroker::Logging
9
+ include Rack::PactBroker::RequestTarget
8
10
 
9
11
  EXCLUDE_HEADERS = ["puma.", "rack.", "pactbroker."]
10
12
  RACK_SESSION = "rack.session"
@@ -15,13 +17,17 @@ module PactBroker
15
17
  end
16
18
 
17
19
  def call(env)
18
- env_to_log = env.reject { | header, _ | header.start_with?(*EXCLUDE_HEADERS) }
19
- env_to_log["rack.session"] = env["rack.session"].to_hash if env["rack.session"]
20
- env_to_log["rack.input"] = request_body(env) if env["rack.input"]
21
- logger.debug("env", payload: env_to_log)
22
- status, headers, body = @app.call(env)
23
- logger.debug("response", payload: { "status" => status, "headers" => headers, "body" => body })
24
- [status, headers, body]
20
+ if request_for_api?(env)
21
+ env_to_log = env.reject { | header, _ | header.start_with?(*EXCLUDE_HEADERS) }
22
+ env_to_log["rack.session"] = env["rack.session"].to_hash if env["rack.session"]
23
+ env_to_log["rack.input"] = request_body(env) if env["rack.input"]
24
+ logger.debug("env", payload: env_to_log)
25
+ status, headers, body = @app.call(env)
26
+ logger.debug("response", payload: { "status" => status, "headers" => headers, "body" => body })
27
+ [status, headers, body]
28
+ else
29
+ @app.call(env)
30
+ end
25
31
  end
26
32
 
27
33
  def request_body(env)
@@ -152,6 +152,10 @@ module PactBroker
152
152
  @request_body ||= request.body.to_s
153
153
  end
154
154
 
155
+ def any_request_body?
156
+ request_body && request_body.size > 0
157
+ end
158
+
155
159
  def consumer_name
156
160
  identifier_from_path[:consumer_name]
157
161
  end
@@ -22,7 +22,7 @@ module PactBroker
22
22
  end
23
23
 
24
24
  def policy_name
25
- :'pacts::pacts'
25
+ :'pacts::latest_pacts'
26
26
  end
27
27
  end
28
28
  end
@@ -94,14 +94,6 @@ module PactBroker
94
94
  :'pacts::pact'
95
95
  end
96
96
 
97
- def policy_pacticipant
98
- if resource_exists?
99
- consumer
100
- else
101
- nil
102
- end
103
- end
104
-
105
97
  private
106
98
 
107
99
  def pact
@@ -1,6 +1,7 @@
1
1
  require "pact_broker/api/resources/base_resource"
2
2
  require "pact_broker/pacts/pact_params"
3
3
  require "pact_broker/pacts/diff"
4
+ require "timeout"
4
5
 
5
6
  module PactBroker
6
7
  module Api
@@ -19,8 +20,12 @@ module PactBroker
19
20
  end
20
21
 
21
22
  def to_text
22
- output = PactBroker::Pacts::Diff.new.process pact_params.merge(base_url: base_url), comparison_pact_params, raw: false
23
- response.body = output
23
+ Timeout::timeout(PactBroker.configuration.pact_content_diff_timeout) do
24
+ output = PactBroker::Pacts::Diff.new.process pact_params.merge(base_url: base_url), comparison_pact_params, raw: false
25
+ response.body = output
26
+ end
27
+ rescue Timeout::Error
28
+ 408
24
29
  end
25
30
 
26
31
  def pact
@@ -32,11 +32,7 @@ module PactBroker
32
32
  end
33
33
 
34
34
  def policy_name
35
- :'pacts::pacts'
36
- end
37
-
38
- def policy_pacticipant
39
- consumer
35
+ :'pacts::pact_versions'
40
36
  end
41
37
  end
42
38
  end
@@ -28,11 +28,7 @@ module PactBroker
28
28
  end
29
29
 
30
30
  def policy_name
31
- :'pacts::pacts'
32
- end
33
-
34
- def policy_pacticipant
35
- consumer
31
+ :'pacts::pact_versions'
36
32
  end
37
33
  end
38
34
  end
@@ -20,7 +20,7 @@ module PactBroker
20
20
  end
21
21
 
22
22
  def policy_name
23
- :'pacts::pacts'
23
+ :'pacts::provider_pacts'
24
24
  end
25
25
 
26
26
  def to_json
@@ -36,11 +36,7 @@ module PactBroker
36
36
  end
37
37
 
38
38
  def policy_name
39
- :'pacts::pacts'
40
- end
41
-
42
- def policy_pacticipant
43
- consumer
39
+ :'pacts::pact_versions'
44
40
  end
45
41
  end
46
42
  end
@@ -54,10 +54,6 @@ module PactBroker
54
54
  :'verifications::verification'
55
55
  end
56
56
 
57
- def policy_pacticipant
58
- provider
59
- end
60
-
61
57
  private
62
58
 
63
59
  def verification
@@ -62,10 +62,6 @@ module PactBroker
62
62
  :'verifications::verifications'
63
63
  end
64
64
 
65
- def policy_pacticipant
66
- provider
67
- end
68
-
69
65
  private
70
66
 
71
67
  def pact
@@ -25,6 +25,14 @@ module PactBroker
25
25
  !!version
26
26
  end
27
27
 
28
+ def malformed_request?
29
+ if request.put? && any_request_body?
30
+ invalid_json?
31
+ else
32
+ false
33
+ end
34
+ end
35
+
28
36
  def from_json
29
37
  if request.really_put?
30
38
  handle_request do
@@ -71,7 +71,8 @@ module PactBroker
71
71
  badge_provider_mode: :redirect,
72
72
  enable_public_badge_access: false,
73
73
  shields_io_base_url: "https://img.shields.io",
74
- use_case_sensitive_resource_names: true
74
+ use_case_sensitive_resource_names: true,
75
+ pact_content_diff_timeout: 15
75
76
  )
76
77
 
77
78
  # domain attributes
@@ -16,7 +16,7 @@ module PactBroker
16
16
  database_port: nil,
17
17
  database_url: nil,
18
18
  database_sslmode: nil,
19
- sql_log_level: :debug,
19
+ sql_log_level: :none,
20
20
  sql_log_warn_duration: 5,
21
21
  sql_enable_caller_logging: false,
22
22
  database_max_connections: nil,
@@ -17,15 +17,19 @@ module PactBroker
17
17
  Sequel[:p][:created_at].as(:consumer_version_created_at),
18
18
  Sequel[:p][:id].as(:pact_order)
19
19
  ]
20
+
20
21
  VERIFICATION_COLUMNS = [
21
22
  Sequel[:v][:id].as(:verification_id),
22
23
  Sequel[:v][:provider_version_id],
23
24
  Sequel[:v][:created_at].as(:provider_version_created_at)
24
25
  ]
25
26
 
27
+ JOINED_VERIFICATION_COLUMNS = [:id, :pact_version_id, :provider_id, :provider_version_id, :created_at]
28
+
26
29
  ALL_COLUMNS = PACT_COLUMNS + VERIFICATION_COLUMNS
27
30
 
28
31
  SELECT_ALL_COLUMN_ARGS = [:select_all_columns] + ALL_COLUMNS
32
+
29
33
  dataset_module do
30
34
  select(*SELECT_ALL_COLUMN_ARGS)
31
35
 
@@ -33,9 +37,23 @@ module PactBroker
33
37
  left_outer_join(:verifications, P_V_JOIN, { table_alias: :v } )
34
38
  end
35
39
 
40
+ def inner_join_verifications
41
+ join(:verifications, P_V_JOIN, { table_alias: :v } )
42
+ end
43
+
44
+ def inner_join_verifications_matching_one_selector_provider_or_provider_version(query_ids)
45
+ verifications = db[:verifications]
46
+ .select(*JOINED_VERIFICATION_COLUMNS)
47
+ .where {
48
+ QueryBuilder.provider_or_provider_version_matches(query_ids)
49
+ }
50
+
51
+ join(verifications, P_V_JOIN, { table_alias: :v } )
52
+ end
53
+
36
54
  def verifications_for(query_ids)
37
55
  db[:verifications]
38
- .select(:id, :pact_version_id, :provider_id, :provider_version_id, :created_at)
56
+ .select(*JOINED_VERIFICATION_COLUMNS)
39
57
  .where {
40
58
  Sequel.&(
41
59
  QueryBuilder.consumer_in_pacticipant_ids(query_ids),
@@ -1,9 +1,9 @@
1
-
2
1
  # Represents the integration relationship between a consumer and a provider in the context
3
2
  # of a matrix or can-i-deploy query.
4
- # If the required flag is set, then one of the pacticipants (consumers) specified in the HTTP query
5
- # requires the provider. It would not be required if a provider was specified, and it had an
6
- # integration with a consumer.
3
+ # If the required flag is set, then one of the pacticipants specified in the matrix query
4
+ # is a consumer and it requires the provider to be already deployed. An integration would not be required if a provider
5
+ # was specified, and it had an integration with a consumer, but that consumer wasn't deployed yet.
6
+ #
7
7
 
8
8
  module PactBroker
9
9
  module Matrix
@@ -11,7 +11,7 @@ module PactBroker
11
11
 
12
12
  attr_reader :consumer_name, :consumer_id, :provider_name, :provider_id
13
13
 
14
- def initialize consumer_id, consumer_name, provider_id, provider_name, required
14
+ def initialize(consumer_id, consumer_name, provider_id, provider_name, required)
15
15
  @consumer_id = consumer_id
16
16
  @consumer_name = consumer_name
17
17
  @provider_id = provider_id
@@ -11,6 +11,14 @@ require "pact_broker/pacts/pact_publication"
11
11
  require "pact_broker/tags/tag_with_latest_flag"
12
12
  require "pact_broker/matrix/query_ids"
13
13
 
14
+ # The PactBroker::Matrix::QuickRow represents a row in the table that is created when
15
+ # the consumer versions are joined to the provider versions via the pacts and verifications tables,
16
+ # aka "The Matrix". The difference between this class and the EveryRow class is that
17
+ # the EveryRow class includes results for overridden pact verisons and verifications (used only when there is no latestby
18
+ # set in the matrix query), where as the QuickRow class does not.
19
+ # It is called the QuickRow because the initial implementation was called the Row, and this is an optimised
20
+ # version. It needs to be renamed back to Row now that the old Row class has been deleted.
21
+
14
22
  # The difference between `join_verifications_for` and `join_verifications` is that
15
23
  # the left outer join is done on a pre-filtered dataset in `join_verifications_for`,
16
24
  # so that we get a row with null verification fields for a pact that has been verified
@@ -19,6 +27,7 @@ require "pact_broker/matrix/query_ids"
19
27
 
20
28
  module PactBroker
21
29
  module Matrix
30
+ # TODO rename this to just Row
22
31
  # rubocop: disable Metrics/ClassLength
23
32
  class QuickRow < Sequel::Model(Sequel.as(:latest_pact_publication_ids_for_consumer_versions, :p))
24
33
 
@@ -45,6 +54,15 @@ module PactBroker
45
54
  Sequel[:v][:verification_id],
46
55
  Sequel[:v][:created_at].as(:provider_version_created_at)
47
56
  ]
57
+
58
+ JOINED_VERIFICATION_COLUMNS = [
59
+ :verification_id,
60
+ :provider_version_id,
61
+ :pact_version_id,
62
+ :provider_id,
63
+ :created_at
64
+ ]
65
+
48
66
  LAST_ACTION_DATE = Sequel.lit("CASE WHEN (provider_version_created_at IS NOT NULL AND provider_version_created_at > consumer_version_created_at) THEN provider_version_created_at ELSE consumer_version_created_at END").as(:last_action_date)
49
67
 
50
68
  ALL_COLUMNS = PACT_COLUMNS + VERIFICATION_COLUMNS
@@ -146,10 +164,15 @@ module PactBroker
146
164
  # When we have one selector, we need to join ALL the verifications to find out
147
165
  # what integrations exist
148
166
  def matching_one_selector(selectors)
149
- join_verifications
167
+ query_ids = QueryIds.from_selectors(selectors)
168
+ rows_where_selector_matches_consumer_cols = join_verifications
150
169
  .where {
151
- QueryBuilder.consumer_or_consumer_version_or_provider_or_provider_or_provider_version_match(QueryIds.from_selectors(selectors), :p, :v)
170
+ QueryBuilder.consumer_or_consumer_version_matches(query_ids, :p)
152
171
  }
172
+
173
+ rows_where_selector_matches_provider_cols = inner_join_verifications_matching_one_selector_provider_or_provider_version(query_ids)
174
+
175
+ rows_where_selector_matches_consumer_cols.union(rows_where_selector_matches_provider_cols)
153
176
  end
154
177
 
155
178
  def pacticipant_ids_matching_one_selector_optimised(selectors)
@@ -229,9 +252,19 @@ module PactBroker
229
252
  left_outer_join(verifications_for(query_ids), LP_LV_JOIN, { table_alias: :v } )
230
253
  end
231
254
 
255
+ def inner_join_verifications_matching_one_selector_provider_or_provider_version(query_ids)
256
+ verifications = db[LV]
257
+ .select(*JOINED_VERIFICATION_COLUMNS)
258
+ .where {
259
+ QueryBuilder.provider_or_provider_version_matches(query_ids)
260
+ }
261
+
262
+ join(verifications, LP_LV_JOIN, { table_alias: :v } )
263
+ end
264
+
232
265
  def verifications_for(query_ids)
233
266
  db[LV]
234
- .select(:verification_id, :provider_version_id, :pact_version_id, :provider_id, :created_at)
267
+ .select(*JOINED_VERIFICATION_COLUMNS)
235
268
  .where {
236
269
  Sequel.&(
237
270
  QueryBuilder.consumer_in_pacticipant_ids(query_ids),
@@ -123,6 +123,8 @@ module PactBroker
123
123
  end
124
124
  end
125
125
 
126
+ # Why does the consumer equivalent of this method use the QuickRow distinct_integrations_for_selector_as_consumer
127
+ # while this method uses the Integration?
126
128
  def integrations_where_specified_selector_is_provider(resolved_specified_selectors)
127
129
  integrations_involving_specified_providers = PactBroker::Integrations::Integration
128
130
  .where(provider_id: resolved_specified_selectors.collect(&:pacticipant_id))
@@ -19,6 +19,7 @@ module PactBroker
19
19
  end
20
20
 
21
21
  difference = diff(previous_pact_hash, pact_hash)
22
+
22
23
  Pact::Matchers::UnixDiffFormatter.call(difference, colour: false, include_explanation: false)
23
24
  end
24
25
  end
@@ -32,7 +32,10 @@ module PactBroker
32
32
 
33
33
  pact_publications.each do | pact_publication |
34
34
  pact_publication.consumer_version_tags.collect(&:name).sort.each do | tag_name |
35
- pact_publication.associations[:head_pact_publications_for_tags] << head_pact_publications_by_tag[tag_name]
35
+ # Not sure how this can ever be nil, but a PF error suggests that it has happend. Maybe a timing issue?
36
+ if head_pact_publications_by_tag[tag_name]
37
+ pact_publication.associations[:head_pact_publications_for_tags] << head_pact_publications_by_tag[tag_name]
38
+ end
36
39
  end
37
40
  end
38
41
  end
@@ -111,7 +111,32 @@ module PactBroker
111
111
  .limit(1)
112
112
  end
113
113
 
114
+ # Return the pacts (if they exist) for the branch heads.
115
+ # This uses the new logic of finding the branch head and returning any associated pacts,
116
+ # rather than the old logic of returning the pact for the latest version
117
+ # on the branch that had a pact.
118
+ def for_branch_heads(branch_name)
119
+ branch_head_join = {
120
+ Sequel[:pact_publications][:consumer_version_id] => Sequel[:branch_heads][:version_id],
121
+ }
122
+
123
+ base_query = self
124
+ if no_columns_selected?
125
+ base_query = base_query.select_all_qualified.select_append(Sequel[:branch_heads][:branch_name].as(:branch_name))
126
+ end
127
+
128
+ base_query
129
+ .join(:branch_heads, branch_head_join) do
130
+ name_like(Sequel[:branch_heads][:branch_name], branch_name)
131
+ end
132
+ .remove_overridden_revisions_from_complete_query
133
+ end
134
+
114
135
  def latest_for_consumer_branch(branch_name)
136
+ for_branch_heads(branch_name)
137
+ end
138
+
139
+ def old_latest_for_consumer_branch(branch_name)
115
140
  branch_versions_join = {
116
141
  Sequel[:pact_publications][:consumer_version_id] => Sequel[:branch_versions][:version_id]
117
142
  }
@@ -47,21 +47,6 @@ module PactBroker
47
47
  end
48
48
 
49
49
  def successfully_verified_by_provider_another_tag_before_this_tag_first_created(provider_id, provider_tag)
50
- return new_successfully_verified_by_provider_another_tag_before_this_tag_first_created(provider_id, provider_tag) if PactBroker.feature_enabled?(:new_wip_calculation)
51
-
52
- first_tag_with_name = PactBroker::Domain::Tag.where(pacticipant_id: provider_id, name: provider_tag).order(:created_at).first
53
- from_self(alias: :pp)
54
- .select(Sequel[:pp].*)
55
- .where(Sequel[:pp][:provider_id] => provider_id)
56
- .join_successful_non_wip_verifications_for_provider_id(provider_id)
57
- .join_provider_version_tags do
58
- Sequel.lit("provider_tags.name != ?", provider_tag)
59
- end
60
- .verified_before_creation_date_of(first_tag_with_name)
61
- .distinct
62
- end
63
-
64
- def new_successfully_verified_by_provider_another_tag_before_this_tag_first_created(provider_id, provider_tag)
65
50
  first_tag_with_name = PactBroker::Domain::Tag.where(pacticipant_id: provider_id, name: provider_tag).order(:created_at).first
66
51
 
67
52
  pact_version_provider_tag_verifications_join = {
@@ -57,6 +57,8 @@ module PactBroker
57
57
 
58
58
  def create_version(pacticipant:, version:, branch: nil)
59
59
  if branch
60
+ puts "Adding #{pacticipant} version #{version} to branch #{branch}"
61
+ puts ""
60
62
  client.put("pacticipants/#{encode(pacticipant)}/branches/#{encode(branch)}/versions/#{encode(version)}", {}).tap { |response| check_for_error(response) }
61
63
  else
62
64
  client.put("pacticipants/#{encode(pacticipant)}/versions/#{encode(version)}").tap { |response| check_for_error(response) }
@@ -80,7 +82,7 @@ module PactBroker
80
82
  available_environments = version_body["_links"]["pb:record-deployment"].collect{ | relation | relation["name"]}.join
81
83
  puts "Environment with name #{environment_name} not found. Available environments: #{available_environments}"
82
84
  else
83
- client.post(environment_relation["href"], { replacedPreviousDeployedVersion: true }).tap { |response| check_for_error(response) }
85
+ client.post(environment_relation["href"]).tap { |response| check_for_error(response) }
84
86
  end
85
87
 
86
88
  separate
@@ -91,7 +93,7 @@ module PactBroker
91
93
  puts "Recording release of #{pacticipant} version #{version} to #{environment_name}"
92
94
  version_body = client.get("/pacticipants/#{encode(pacticipant)}/versions/#{encode(version)}").tap { |response| check_for_error(response) }.body
93
95
  environment_relation = version_body["_links"]["pb:record-release"].find { |relation| relation["name"] == environment_name }
94
- client.post(environment_relation["href"], { replacedPreviousDeployedVersion: true }).tap { |response| check_for_error(response) }
96
+ client.post(environment_relation["href"]).tap { |response| check_for_error(response) }
95
97
  separate
96
98
  self
97
99
  end
@@ -6,7 +6,7 @@
6
6
  <html lang="en">
7
7
  <head>
8
8
  <meta charset="utf-8">
9
- <title><%= pacticipant_name %></title>
9
+ <title><%= escape_html(pacticipant_name) %></title>
10
10
  <link rel='shortcut icon' href='<%= base_url %>/favicon.ico' type='image/x-icon'/>
11
11
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
12
12
  <meta name="description" content="">
@@ -69,7 +69,7 @@ svg{
69
69
  Main branch:
70
70
  </div>
71
71
  <div class="col col-md-6">
72
- <%= pacticipant.main_branch %>
72
+ <%= escape_html(pacticipant.main_branch) %>
73
73
  </div>
74
74
  </div>
75
75
  <div class="row">
@@ -1,3 +1,3 @@
1
1
  module PactBroker
2
- VERSION = "2.98.0"
2
+ VERSION = "2.99.0"
3
3
  end
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.98.0
4
+ version: 2.99.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bethany Skurrie
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2022-03-29 00:00:00.000000000 Z
13
+ date: 2022-05-16 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: httparty
@@ -1222,7 +1222,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
1222
1222
  - !ruby/object:Gem::Version
1223
1223
  version: '0'
1224
1224
  requirements: []
1225
- rubygems_version: 3.3.10
1225
+ rubygems_version: 3.3.13
1226
1226
  signing_key:
1227
1227
  specification_version: 4
1228
1228
  summary: See description