pact_broker 2.111.0 → 2.112.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e21e3c2fc82cfe4697582921613bd435e026cf6f381c64c33d703b8c31c586be
4
- data.tar.gz: 6b6bc75a486f936441b172c7a80a7e8541f3bbb1731be03b1e33a869327014bf
3
+ metadata.gz: c7da30c01ac5c3b656df24282a63fe7d18e42d83ed7ffdda14d3919481497f39
4
+ data.tar.gz: 71c525bd8ac9ed56c8d15f3f2d6c274a32c925be65e75f889d351033d759c400
5
5
  SHA512:
6
- metadata.gz: 2afe779170a4910f06ace0a29b8ee66fa81bc355fc1a1c22a532fb3f9f64f5775309543c23b3b7ae4c4c837c1a66d0b10ddb0f62e8e9f586b7fd4942dc29d33c
7
- data.tar.gz: 3b2738f3785dc1c272d4e1ba24104b4786bd467780808d41bdf2dd7f2ce0e83f0f11645a8ca3b8fd16642055a897d60b573ea7fc8392751cf0a59ecafeba6130
6
+ metadata.gz: 95f5eed3bcda08ad27274d0bf858ea78319455ca45f783b0cd21a3709ee1ac3a1956325713466b8f1438cda86f83f51a35cccb875c81f864d2f53b054f7c0807
7
+ data.tar.gz: e51971781ce0679309cd60a8bb0eb281b2fc9a01872db91a4cd6f3f00b575805e7b5244d2b0f4d68a699140799e8cf50fca9940ddd72c77b207ca749de468fda
data/CHANGELOG.md CHANGED
@@ -1,3 +1,15 @@
1
+ <a name="v2.112.0"></a>
2
+ ### v2.112.0 (2024-09-09)
3
+
4
+ #### Features
5
+
6
+ * implemented setting cache for can-i-merge badges based on default configuration ([e2bce55e](/../../commit/e2bce55e))
7
+ * add application/hal+json content type for webhook logs (#679) ([e84de4f4](/../../commit/e84de4f4))
8
+
9
+ #### Bug Fixes
10
+
11
+ * make clean_task.rb print the payload correctly ([10fd69e2](/../../commit/10fd69e2))
12
+
1
13
  <a name="v2.111.0"></a>
2
14
  ### v2.111.0 (2024-07-26)
3
15
 
data/Gemfile CHANGED
@@ -4,7 +4,7 @@ gemspec
4
4
 
5
5
 
6
6
  gem "rake", "~>12.3.3"
7
- gem "sqlite3", "~>1.3"
7
+ gem "sqlite3", ">=2.0.0"
8
8
  gem "conventional-changelog", "~>1.3"
9
9
  gem "bump", "~> 0.5"
10
10
 
@@ -248,8 +248,8 @@ The number of seconds after which an SQL query will be aborted. Only supported f
248
248
 
249
249
  **Environment variable name:** `PACT_BROKER_DATABASE_STATEMENT_TIMEOUT`<br/>
250
250
  **YAML configuration key name:** `database_statement_timeout`<br/>
251
- **Default:** `15`<br/>
252
- **Allowed values:** A positive integer or float.<br/>
251
+ **Default:** `15000`<br/>
252
+ **Allowed values:** A positive integer in milliseconds<br/>
253
253
  **More information:** https://www.postgresql.org/docs/9.3/runtime-config-client.html<br/>
254
254
 
255
255
  ### metrics_sql_statement_timeout
@@ -0,0 +1,38 @@
1
+ require_relative "base_decorator"
2
+
3
+ module PactBroker
4
+ module Api
5
+ module Decorators
6
+ class TriggeredWebhookLogsDecorator < BaseDecorator
7
+ class WebhookExecutionDecorator < BaseDecorator
8
+ property :success
9
+ property :logs
10
+ property :created_at, as: :createdAt
11
+ end
12
+
13
+
14
+ nested :triggeredWebhook, embedded: true do
15
+ property :uuid
16
+ end
17
+
18
+ collection :webhook_executions, as: :executions, :class => PactBroker::Webhooks::Execution, :extend => WebhookExecutionDecorator
19
+
20
+ link :self do | options |
21
+ {
22
+ title: "Triggered webhook logs",
23
+ href: options[:resource_url]
24
+ }
25
+ end
26
+
27
+ link :'pb:webhook' do | context |
28
+ if represented.webhook
29
+ {
30
+ href: webhook_url(represented.webhook.uuid, context[:base_url]),
31
+ title: "Webhook"
32
+ }
33
+ end
34
+ end
35
+ end
36
+ end
37
+ end
38
+ end
@@ -32,7 +32,7 @@ module PactBroker
32
32
  end
33
33
 
34
34
  def moved_temporarily?
35
- response.headers["Cache-Control"] = "no-cache"
35
+ set_cache_control("no-cache")
36
36
  begin
37
37
  badge_url
38
38
  rescue StandardError => e
@@ -46,6 +46,10 @@ module PactBroker
46
46
  raise NotImplementedError
47
47
  end
48
48
 
49
+ def set_cache_control(cache_control_str)
50
+ response.headers["Cache-Control"] = cache_control_str
51
+ end
52
+
49
53
  private
50
54
 
51
55
  def label
@@ -15,6 +15,8 @@ module PactBroker
15
15
  # when there is no main branch version, we return an error badge url
16
16
  badge_service.error_badge_url("main branch version", "not found")
17
17
  else
18
+ # when badge is available, set cache based on configuration
19
+ set_cache_control(default_cache_for_succesful_badge)
18
20
  # we call badge_service to build the badge url
19
21
  badge_service.can_i_merge_badge_url(deployable: results)
20
22
  end
@@ -22,6 +24,10 @@ module PactBroker
22
24
 
23
25
  private
24
26
 
27
+ def default_cache_for_succesful_badge
28
+ PactBroker.configuration.badge_default_cache_setting
29
+ end
30
+
25
31
  def results
26
32
  # can_i_merge returns true or false if the main branch version is compatible with all the integrations
27
33
  @results ||= matrix_service.can_i_merge(pacticipant: pacticipant, latest_main_branch_version: version)
@@ -16,6 +16,10 @@ module PactBroker
16
16
  ["GET", "OPTIONS"]
17
17
  end
18
18
 
19
+ def malformed_request?
20
+ super || request.get? && validation_errors_for_schema?(schema, request.query)
21
+ end
22
+
19
23
  def policy_name
20
24
  :'labels::labels'
21
25
  end
@@ -28,6 +32,15 @@ module PactBroker
28
32
  )
29
33
  end
30
34
 
35
+ private
36
+
37
+ def schema
38
+ if request.get?
39
+ PactBroker::Api::Contracts::PaginationQueryParamsSchema
40
+ end
41
+ end
42
+
43
+
31
44
  def labels
32
45
  label_service.get_all_unique_labels(pagination_options)
33
46
  end
@@ -7,7 +7,7 @@ module PactBroker
7
7
  class TriggeredWebhookLogs < BaseResource
8
8
 
9
9
  def content_types_provided
10
- [["text/plain", :to_text]]
10
+ [["text/plain", :to_text], ["application/hal+json", :to_json]]
11
11
  end
12
12
 
13
13
  def allowed_methods
@@ -27,6 +27,10 @@ module PactBroker
27
27
  end
28
28
  end
29
29
 
30
+ def to_json
31
+ decorator_class(:triggered_webhook_logs_decorator).new(triggered_webhook).to_json(**decorator_options)
32
+ end
33
+
30
34
  def policy_name
31
35
  :'webhooks::triggered_webhook'
32
36
  end
@@ -76,6 +76,7 @@ module PactBroker
76
76
  badge_provider_mode: :redirect,
77
77
  enable_public_badge_access: false,
78
78
  shields_io_base_url: "https://img.shields.io",
79
+ badge_default_cache_setting: "max-age=30",
79
80
  use_case_sensitive_resource_names: true,
80
81
  pact_content_diff_timeout: 15
81
82
  )
@@ -129,8 +129,9 @@ end
129
129
  # target_for_index | text | NOT NULL DEFAULT ''::text
130
130
  # auto_created | boolean | DEFAULT false
131
131
  # Indexes:
132
- # deployed_versions_pkey | PRIMARY KEY btree (id)
133
- # deployed_versions_uuid_index | UNIQUE btree (uuid)
132
+ # deployed_versions_pkey | PRIMARY KEY btree (id)
133
+ # deployed_versions_uuid_index | UNIQUE btree (uuid)
134
+ # deployed_versions_version_id_ndx | btree (version_id)
134
135
  # Foreign key constraints:
135
136
  # deployed_versions_environment_id_fkey | (environment_id) REFERENCES environments(id)
136
137
  # deployed_versions_version_id_fkey | (version_id) REFERENCES versions(id)
@@ -87,6 +87,7 @@ end
87
87
  # released_versions_uuid_index | UNIQUE btree (uuid)
88
88
  # released_versions_version_id_environment_id_index | UNIQUE btree (version_id, environment_id)
89
89
  # released_version_support_ended_at_index | btree (support_ended_at)
90
+ # released_versions_version_id_ndx | btree (version_id)
90
91
  # Foreign key constraints:
91
92
  # released_versions_environment_id_fkey | (environment_id) REFERENCES environments(id)
92
93
  # released_versions_version_id_fkey | (version_id) REFERENCES versions(id)
@@ -266,6 +266,7 @@ end
266
266
  # verifications_pact_version_id_id_index | btree (pact_version_id, id)
267
267
  # verifications_provider_id_consumer_id_index | btree (provider_id, consumer_id)
268
268
  # verifications_provider_id_index | btree (provider_id)
269
+ # verifications_provider_version_id_index | btree (provider_version_id)
269
270
  # Foreign key constraints:
270
271
  # fk_verifications_versions | (provider_version_id) REFERENCES versions(id)
271
272
  # verifications_consumer_id_fkey | (consumer_id) REFERENCES pacticipants(id)
@@ -149,9 +149,11 @@ end
149
149
 
150
150
  # Table: integrations
151
151
  # Columns:
152
- # id | integer | PRIMARY KEY GENERATED BY DEFAULT AS IDENTITY
153
- # consumer_id | integer | NOT NULL
154
- # provider_id | integer | NOT NULL
152
+ # id | integer | PRIMARY KEY GENERATED BY DEFAULT AS IDENTITY
153
+ # consumer_id | integer | NOT NULL
154
+ # provider_id | integer | NOT NULL
155
+ # created_at | timestamp without time zone | NOT NULL
156
+ # contract_data_updated_at | timestamp without time zone |
155
157
  # Indexes:
156
158
  # integrations_pkey | PRIMARY KEY btree (id)
157
159
  # integrations_consumer_id_provider_id_unique | UNIQUE btree (consumer_id, provider_id)
@@ -24,6 +24,7 @@ end
24
24
  # Indexes:
25
25
  # latest_pact_publication_ids_for_consume_pact_publication_id_key | UNIQUE btree (pact_publication_id)
26
26
  # unq_latest_ppid_prov_conver | UNIQUE btree (provider_id, consumer_version_id)
27
+ # latest_pp_ids_for_cons_ver_con_ver_id_ndx | btree (consumer_version_id)
27
28
  # lpp_provider_id_consumer_id_index | btree (provider_id, consumer_id)
28
29
  # Foreign key constraints:
29
30
  # latest_pact_publication_ids_for_consum_consumer_version_id_fkey | (consumer_version_id) REFERENCES versions(id) ON DELETE CASCADE
@@ -105,7 +105,7 @@ module PactBroker
105
105
 
106
106
  def output(string, payload = {})
107
107
  prefix = dry_run ? "[DRY RUN] " : ""
108
- logger ? logger.info("#{prefix}#{string}") : puts("#{prefix}#{string} #{payload.to_json}")
108
+ logger ? logger.info("#{prefix}#{string}", payload) : puts("#{prefix}#{string} #{payload.to_json}")
109
109
  end
110
110
 
111
111
  def add_defaults_to_keep_selectors
@@ -23,9 +23,10 @@ end
23
23
  # verification_id | integer | NOT NULL
24
24
  # created_at | timestamp without time zone |
25
25
  # Indexes:
26
- # latest_v_id_for_pv_and_pv_pv_id_pv_id_unq | UNIQUE btree (pact_version_id, provider_version_id)
27
- # latest_v_id_for_pv_and_pv_v_id_unq | UNIQUE btree (verification_id)
28
- # latest_v_id_for_pv_and_pv_pv_id_v_id | btree (pact_version_id, verification_id)
26
+ # latest_v_id_for_pv_and_pv_pv_id_pv_id_unq | UNIQUE btree (pact_version_id, provider_version_id)
27
+ # latest_v_id_for_pv_and_pv_v_id_unq | UNIQUE btree (verification_id)
28
+ # latest_v_id_for_pv_and_pv_pv_id_v_id | btree (pact_version_id, verification_id)
29
+ # latest_verif_id_for_pact_ver_and_prov_ver_prov_ver_id_ndx | btree (provider_version_id)
29
30
  # Foreign key constraints:
30
31
  # latest_v_id_for_pv_and_pv_consumer_id_fk | (consumer_id) REFERENCES pacticipants(id) ON DELETE CASCADE
31
32
  # latest_v_id_for_pv_and_pv_pact_version_id_fk | (pact_version_id) REFERENCES pact_versions(id) ON DELETE CASCADE
@@ -22,6 +22,7 @@ end
22
22
  # Indexes:
23
23
  # pact_version_provider_tag_successful_verifications_pkey | PRIMARY KEY btree (id)
24
24
  # pact_version_provider_tag_verifications_pv_pvtn_wip_unique | UNIQUE btree (pact_version_id, provider_version_tag_name, wip)
25
+ # pact_ver_prov_tag_success_verif_verif_id_ndx | btree (verification_id)
25
26
  # Foreign key constraints:
26
27
  # pact_version_provider_tag_successful_verifications_pv_id_fk | (pact_version_id) REFERENCES pact_versions(id) ON DELETE CASCADE
27
28
  # pact_version_provider_tag_successful_verifications_v_id_fk | (verification_id) REFERENCES verifications(id) ON DELETE SET NULL
@@ -1,3 +1,3 @@
1
1
  module PactBroker
2
- VERSION = "2.111.0"
2
+ VERSION = "2.112.0"
3
3
  end
@@ -32,10 +32,11 @@ end
32
32
  # pacticipant_id | integer | NOT NULL
33
33
  # branch_name | text | NOT NULL
34
34
  # Indexes:
35
- # branch_heads_branch_id_index | UNIQUE btree (branch_id)
36
- # branch_heads_branch_name_index | btree (branch_name)
37
- # branch_heads_pacticipant_id_index | btree (pacticipant_id)
38
- # branch_heads_version_id_index | btree (version_id)
35
+ # branch_heads_branch_id_index | UNIQUE btree (branch_id)
36
+ # branch_heads_branch_name_index | btree (branch_name)
37
+ # branch_heads_branch_version_id_index | btree (branch_version_id)
38
+ # branch_heads_pacticipant_id_index | btree (pacticipant_id)
39
+ # branch_heads_version_id_index | btree (version_id)
39
40
  # Foreign key constraints:
40
41
  # branch_heads_branch_id_fkey | (branch_id) REFERENCES branches(id) ON DELETE CASCADE
41
42
  # branch_heads_branch_version_id_fkey | (branch_version_id) REFERENCES branch_versions(id) ON DELETE CASCADE
@@ -29,12 +29,13 @@ end
29
29
  # Table: webhook_executions
30
30
  # Columns:
31
31
  # id | integer | PRIMARY KEY GENERATED BY DEFAULT AS IDENTITY
32
- # triggered_webhook_id | integer |
33
32
  # success | boolean | NOT NULL
34
33
  # logs | text |
35
34
  # created_at | timestamp without time zone | NOT NULL
35
+ # triggered_webhook_id | integer |
36
36
  # Indexes:
37
37
  # webhook_executions_pkey | PRIMARY KEY btree (id)
38
+ # webhook_executions_pact_publication_id_index | btree (pact_publication_id)
38
39
  # webhook_executions_triggered_webhook_id_index | btree (triggered_webhook_id)
39
40
  # Foreign key constraints:
40
41
  # webhook_executions_consumer_id_fkey | (consumer_id) REFERENCES pacticipants(id)
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.111.0
4
+ version: 2.112.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: 2024-08-12 00:00:00.000000000 Z
13
+ date: 2024-09-17 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: json
@@ -685,6 +685,7 @@ files:
685
685
  - lib/pact_broker/api/decorators/tagged_pact_versions_decorator.rb
686
686
  - lib/pact_broker/api/decorators/timestamps.rb
687
687
  - lib/pact_broker/api/decorators/triggered_webhook_decorator.rb
688
+ - lib/pact_broker/api/decorators/triggered_webhook_logs_decorator.rb
688
689
  - lib/pact_broker/api/decorators/triggered_webhooks_decorator.rb
689
690
  - lib/pact_broker/api/decorators/validation_errors_decorator.rb
690
691
  - lib/pact_broker/api/decorators/validation_errors_problem_json_decorator.rb
@@ -1268,7 +1269,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
1268
1269
  - !ruby/object:Gem::Version
1269
1270
  version: '0'
1270
1271
  requirements: []
1271
- rubygems_version: 3.5.17
1272
+ rubygems_version: 3.5.18
1272
1273
  signing_key:
1273
1274
  specification_version: 4
1274
1275
  summary: See description