pact_broker 2.76.1 → 2.79.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (188) hide show
  1. checksums.yaml +4 -4
  2. data/.codeclimate.yml +12 -0
  3. data/.github/workflows/release_gem.yml +1 -0
  4. data/.github/workflows/test-ruby-3.yml +19 -0
  5. data/.github/workflows/test.yml +16 -7
  6. data/.gitignore +3 -1
  7. data/CHANGELOG.md +50 -0
  8. data/DEVELOPER_DOCUMENTATION.md +13 -0
  9. data/DEVELOPER_SETUP.md +62 -3
  10. data/Dockerfile +1 -0
  11. data/ISSUES.md +12 -4
  12. data/config.ru +2 -1
  13. data/db/ddl_statements/head_pact_tags.rb +24 -1
  14. data/db/ddl_statements/latest_tagged_pact_consumer_version_orders.rb +11 -0
  15. data/db/ddl_statements/latest_tagged_pact_publications.rb +6 -0
  16. data/db/ddl_statements/latest_verification_ids_for_consumer_version_tags.rb +13 -0
  17. data/db/migrations/20210117_add_branch_to_version.rb +9 -0
  18. data/db/migrations/20210202_add_created_at_to_head_pact_tags.rb +14 -0
  19. data/db/migrations/20210205_add_pacticipant_id_to_tag.rb +17 -0
  20. data/db/migrations/20210206_add_index_to_tags_and_versions.rb +27 -0
  21. data/db/migrations/20210207_optimise_latest_verification_ids_for_consumer_version_tags.rb +13 -0
  22. data/db/migrations/20210208_optimise_latest_tagged_pact_cv_orders.rb +13 -0
  23. data/db/migrations/20210210_create_environments_table.rb +16 -0
  24. data/docker-compose-dev-postgres.yml +9 -1
  25. data/docker-compose-issue-repro-with-pact-broker-docker-image.yml +16 -5
  26. data/lib/pact_broker/api.rb +7 -2
  27. data/lib/pact_broker/api/contracts/dry_validation_predicates.rb +8 -0
  28. data/lib/pact_broker/api/contracts/environment_schema.rb +49 -0
  29. data/lib/pact_broker/api/decorators/base_decorator.rb +11 -0
  30. data/lib/pact_broker/api/decorators/dashboard_decorator.rb +5 -1
  31. data/lib/pact_broker/api/decorators/environment_decorator.rb +30 -0
  32. data/lib/pact_broker/api/decorators/environments_decorator.rb +21 -0
  33. data/lib/pact_broker/api/decorators/matrix_decorator.rb +3 -1
  34. data/lib/pact_broker/api/decorators/verifiable_pacts_query_decorator.rb +2 -0
  35. data/lib/pact_broker/api/decorators/version_decorator.rb +15 -2
  36. data/lib/pact_broker/api/pact_broker_urls.rb +8 -0
  37. data/lib/pact_broker/api/resources/default_base_resource.rb +18 -0
  38. data/lib/pact_broker/api/resources/environment.rb +76 -0
  39. data/lib/pact_broker/api/resources/environments.rb +75 -0
  40. data/lib/pact_broker/api/resources/index.rb +20 -0
  41. data/lib/pact_broker/api/resources/latest_version.rb +27 -0
  42. data/lib/pact_broker/api/resources/provider_pacts_for_verification.rb +1 -0
  43. data/lib/pact_broker/api/resources/verifications.rb +5 -2
  44. data/lib/pact_broker/api/resources/version.rb +15 -9
  45. data/lib/pact_broker/api/resources/webhook_execution.rb +1 -1
  46. data/lib/pact_broker/app.rb +1 -1
  47. data/lib/pact_broker/certificates/certificate.rb +1 -1
  48. data/lib/pact_broker/config/setting.rb +1 -1
  49. data/lib/pact_broker/config/space_delimited_integer_list.rb +25 -0
  50. data/lib/pact_broker/configuration.rb +22 -1
  51. data/lib/pact_broker/db/data_migrations/helpers.rb +4 -0
  52. data/lib/pact_broker/db/data_migrations/set_extra_columns_for_tags.rb +29 -0
  53. data/lib/pact_broker/db/migrate_data.rb +1 -0
  54. data/lib/pact_broker/db/seed_example_data.rb +13 -13
  55. data/lib/pact_broker/deployments/environment.rb +15 -0
  56. data/lib/pact_broker/deployments/environment_service.rb +39 -0
  57. data/lib/pact_broker/doc/views/index/environment.markdown +37 -0
  58. data/lib/pact_broker/doc/views/index/environments.markdown +53 -0
  59. data/lib/pact_broker/doc/views/index/latest-pact-versions.markdown +1 -1
  60. data/lib/pact_broker/doc/views/index/pacticipant-version-tag.markdown +1 -0
  61. data/lib/pact_broker/doc/views/index/pacticipant-version.markdown +13 -0
  62. data/lib/pact_broker/domain/index_item.rb +18 -4
  63. data/lib/pact_broker/domain/pacticipant.rb +9 -5
  64. data/lib/pact_broker/domain/tag.rb +131 -71
  65. data/lib/pact_broker/domain/verification.rb +3 -2
  66. data/lib/pact_broker/domain/version.rb +58 -23
  67. data/lib/pact_broker/domain/webhook.rb +12 -9
  68. data/lib/pact_broker/hash_refinements.rb +4 -0
  69. data/lib/pact_broker/index/service.rb +55 -49
  70. data/lib/pact_broker/locale/en.yml +3 -1
  71. data/lib/pact_broker/matrix/quick_row.rb +8 -0
  72. data/lib/pact_broker/metrics/service.rb +1 -1
  73. data/lib/pact_broker/pacts/eager_loaders.rb +52 -0
  74. data/lib/pact_broker/pacts/latest_pact_publication_id_for_consumer_version.rb +18 -13
  75. data/lib/pact_broker/pacts/lazy_loaders.rb +14 -0
  76. data/lib/pact_broker/pacts/pact_publication.rb +38 -84
  77. data/lib/pact_broker/pacts/pact_publication_dataset_module.rb +297 -0
  78. data/lib/pact_broker/pacts/pact_version.rb +1 -2
  79. data/lib/pact_broker/pacts/pacts_for_verification_repository.rb +286 -0
  80. data/lib/pact_broker/pacts/repository.rb +5 -240
  81. data/lib/pact_broker/pacts/selected_pact.rb +4 -0
  82. data/lib/pact_broker/pacts/selector.rb +56 -1
  83. data/lib/pact_broker/pacts/selectors.rb +16 -0
  84. data/lib/pact_broker/pacts/service.rb +6 -8
  85. data/lib/pact_broker/pacts/squash_pacts_for_verification.rb +1 -4
  86. data/lib/pact_broker/pacts/verifiable_pact.rb +23 -2
  87. data/lib/pact_broker/pacts/verifiable_pact_messages.rb +56 -16
  88. data/lib/pact_broker/repositories/helpers.rb +4 -0
  89. data/lib/pact_broker/services.rb +9 -0
  90. data/lib/pact_broker/tags/eager_loaders.rb +47 -0
  91. data/lib/pact_broker/tags/repository.rb +3 -1
  92. data/lib/pact_broker/tags/service.rb +0 -3
  93. data/lib/pact_broker/tags/tag_with_latest_flag.rb +1 -0
  94. data/lib/pact_broker/test/http_test_data_builder.rb +86 -25
  95. data/lib/pact_broker/test/test_data_builder.rb +50 -3
  96. data/lib/pact_broker/ui/view_models/index_item.rb +19 -2
  97. data/lib/pact_broker/ui/view_models/matrix_line.rb +38 -2
  98. data/lib/pact_broker/ui/views/index/show-with-tags.haml +14 -6
  99. data/lib/pact_broker/ui/views/matrix/show.haml +12 -2
  100. data/lib/pact_broker/verifications/latest_verification_id_for_pact_version_and_provider_version.rb +7 -5
  101. data/lib/pact_broker/verifications/service.rb +2 -1
  102. data/lib/pact_broker/version.rb +1 -1
  103. data/lib/pact_broker/versions/eager_loaders.rb +71 -0
  104. data/lib/pact_broker/versions/lazy_loaders.rb +13 -0
  105. data/lib/pact_broker/versions/repository.rb +22 -2
  106. data/lib/pact_broker/versions/service.rb +5 -1
  107. data/lib/pact_broker/webhooks/execution.rb +3 -2
  108. data/lib/pact_broker/webhooks/latest_triggered_webhook.rb +2 -0
  109. data/lib/pact_broker/webhooks/pact_and_verification_parameters.rb +10 -3
  110. data/lib/pact_broker/webhooks/service.rb +8 -7
  111. data/lib/pact_broker/webhooks/trigger_service.rb +56 -23
  112. data/lib/pact_broker/webhooks/triggered_webhook.rb +14 -5
  113. data/lib/pact_broker/webhooks/webhook.rb +1 -1
  114. data/lib/pact_broker/webhooks/webhook_event.rb +1 -1
  115. data/lib/pact_broker/webhooks/webhook_execution_result.rb +6 -1
  116. data/lib/pact_broker/webhooks/webhook_request_logger.rb +7 -1
  117. data/lib/rack/pact_broker/set_base_url.rb +35 -5
  118. data/lib/sequel/plugins/upsert.rb +18 -4
  119. data/public/javascripts/clipboard.js +8 -2
  120. data/public/stylesheets/index.css +22 -1
  121. data/public/stylesheets/matrix.css +0 -21
  122. data/regression/can_i_deploy_spec.rb +5 -4
  123. data/regression/index_spec.rb +26 -0
  124. data/regression/regression_helper.rb +29 -3
  125. data/regression/script/clear.sh +3 -0
  126. data/regression/script/run.sh +3 -0
  127. data/script/demonstrate-version-branches.rb +33 -0
  128. data/script/pry.rb +2 -2
  129. data/script/reproduce-issue-starting-up.rb +13 -23
  130. data/script/reproduce-issue.rb +2 -1
  131. data/script/trigger-release.sh +1 -1
  132. data/script/webhook-server.ru +5 -5
  133. data/spec/features/create_environment_spec.rb +47 -0
  134. data/spec/features/create_tag_spec.rb +32 -0
  135. data/spec/features/create_version_spec.rb +70 -0
  136. data/spec/features/delete_environment_spec.rb +16 -0
  137. data/spec/features/end_deployment_spec.rb +29 -0
  138. data/spec/features/get_environment_spec.rb +19 -0
  139. data/spec/features/get_environments_spec.rb +20 -0
  140. data/spec/features/record_deployment_spec.rb +28 -0
  141. data/spec/features/update_environment_spec.rb +44 -0
  142. data/spec/fixtures/approvals/modifiable_resources.approved.json +6 -0
  143. data/spec/fixtures/dashboard.json +4 -2
  144. data/spec/lib/pact_broker/api/contracts/environment_schema_spec.rb +83 -0
  145. data/spec/lib/pact_broker/api/decorators/dashboard_decorator_spec.rb +4 -2
  146. data/spec/lib/pact_broker/api/decorators/matrix_decorator_spec.rb +11 -6
  147. data/spec/lib/pact_broker/api/decorators/verifiable_pacts_query_decorator_spec.rb +6 -0
  148. data/spec/lib/pact_broker/api/decorators/version_decorator_spec.rb +18 -0
  149. data/spec/lib/pact_broker/api/resources/default_base_resource_approval_spec.rb +1 -1
  150. data/spec/lib/pact_broker/api/resources/provider_pacts_for_verification_spec.rb +4 -0
  151. data/spec/lib/pact_broker/api/resources/verifications_spec.rb +2 -5
  152. data/spec/lib/pact_broker/api/resources/webhook_execution_result_spec.rb +56 -0
  153. data/spec/lib/pact_broker/api/resources/webhook_execution_spec.rb +3 -2
  154. data/spec/lib/pact_broker/config/space_delimited_integer_list_spec.rb +47 -0
  155. data/spec/lib/pact_broker/configuration_spec.rb +12 -0
  156. data/spec/lib/pact_broker/domain/tag_spec.rb +101 -27
  157. data/spec/lib/pact_broker/domain/version_spec.rb +103 -15
  158. data/spec/lib/pact_broker/domain/webhook_spec.rb +7 -7
  159. data/spec/lib/pact_broker/index/service_spec.rb +89 -15
  160. data/spec/lib/pact_broker/pacts/pact_publication_dataset_module_spec.rb +400 -0
  161. data/spec/lib/pact_broker/pacts/pact_publication_spec.rb +434 -14
  162. data/spec/lib/pact_broker/pacts/repository_find_for_verification_fallback_spec.rb +1 -1
  163. data/spec/lib/pact_broker/pacts/repository_find_for_verification_spec.rb +1 -1
  164. data/spec/lib/pact_broker/pacts/repository_find_wip_pact_versions_for_provider_branch_spec.rb +224 -0
  165. data/spec/lib/pact_broker/pacts/repository_find_wip_pact_versions_for_provider_spec.rb +20 -7
  166. data/spec/lib/pact_broker/pacts/selector_spec.rb +3 -2
  167. data/spec/lib/pact_broker/pacts/service_find_for_verification_spec.rb +2 -3
  168. data/spec/lib/pact_broker/pacts/service_spec.rb +9 -7
  169. data/spec/lib/pact_broker/pacts/verifiable_pact_messages_spec.rb +57 -10
  170. data/spec/lib/pact_broker/tags/repository_spec.rb +2 -0
  171. data/spec/lib/pact_broker/verifications/service_spec.rb +4 -1
  172. data/spec/lib/pact_broker/versions/repository_spec.rb +54 -0
  173. data/spec/lib/pact_broker/webhooks/render_spec.rb +6 -5
  174. data/spec/lib/pact_broker/webhooks/service_spec.rb +13 -9
  175. data/spec/lib/pact_broker/webhooks/trigger_service_spec.rb +60 -18
  176. data/spec/lib/pact_broker/webhooks/webhook_request_logger_spec.rb +8 -0
  177. data/spec/lib/rack/pact_broker/set_base_url_spec.rb +86 -0
  178. data/spec/lib/sequel/plugins/upsert_spec.rb +31 -3
  179. data/spec/service_consumers/hal_relation_proxy_app.rb +3 -1
  180. data/spec/service_consumers/provider_states_for_pact_broker_client.rb +16 -0
  181. data/spec/spec_helper.rb +17 -5
  182. data/spec/support/approvals.rb +24 -0
  183. data/spec/support/shared_examples_for_responses.rb +11 -0
  184. data/tasks/database.rb +1 -1
  185. data/tasks/db.rake +1 -0
  186. data/tasks/rspec.rake +1 -1
  187. metadata +68 -4
  188. data/docker-compose-issue-repro.yml +0 -22
@@ -24,6 +24,12 @@ module Sequel
24
24
  plugin :upsert, identifying_columns: [:provider_id, :consumer_version_id]
25
25
  end
26
26
 
27
+ describe PacticipantNoUpsert do
28
+ it "has an _insert_dataset method" do
29
+ expect(PacticipantNoUpsert.private_instance_methods).to include (:_insert_dataset)
30
+ end
31
+ end
32
+
27
33
  describe "LatestPactPublicationIdForConsumerVersion" do
28
34
  before do
29
35
  td.create_pact_with_hierarchy("Foo", "1", "Bar")
@@ -102,10 +108,20 @@ module Sequel
102
108
 
103
109
  context "when a duplicate Version is inserted with upsert" do
104
110
  let!(:pacticipant) { Pacticipant.new(name: "Foo").save }
105
- let!(:original_version) { Version.new(number: "1", pacticipant_id: pacticipant.id).upsert }
111
+ let!(:original_version) do
112
+ version = Version.new(
113
+ number: "1",
114
+ pacticipant_id: pacticipant.id,
115
+ branch: "original-branch",
116
+ build_url: "original-url"
117
+ ).upsert
118
+ Version.where(id: version.id).update(created_at: yesterday, updated_at: yesterday)
119
+ version
120
+ end
121
+ let(:yesterday) { DateTime.now - 2 }
106
122
 
107
123
  subject do
108
- Version.new(number: "1", pacticipant_id: pacticipant.id).upsert
124
+ Version.new(number: "1", pacticipant_id: pacticipant.id, branch: "new-branch").upsert
109
125
  end
110
126
 
111
127
  it "does not raise an error" do
@@ -113,12 +129,24 @@ module Sequel
113
129
  end
114
130
 
115
131
  it "sets the values on the object" do
116
- expect(subject.id).to eq original_version.id
132
+ expect(subject.branch).to eq "new-branch"
133
+ end
134
+
135
+ it "nils out values that weren't set on the second model" do
136
+ expect(subject.build_url).to eq nil
117
137
  end
118
138
 
119
139
  it "does not insert another row" do
120
140
  expect { subject }.to_not change { Version.count }
121
141
  end
142
+
143
+ it "does not change the created_at" do
144
+ expect { subject }.to_not change { Version.where(number: "1").first.created_at }
145
+ end
146
+
147
+ it "does change the updated_at" do
148
+ expect { subject }.to change { Version.where(number: "1").first.updated_at }
149
+ end
122
150
  end
123
151
  end
124
152
  end
@@ -9,7 +9,9 @@ class HalRelationProxyApp
9
9
  '/HAL-REL-PLACEHOLDER-INDEX-PB-LATEST-VERSION-Condor' =>
10
10
  '/pacticipants/Condor/latest-version',
11
11
  '/HAL-REL-PLACEHOLDER-PB-WEBHOOKS' =>
12
- '/webhooks'
12
+ '/webhooks',
13
+ '/HAL-REL-PLACEHOLDER-INDEX-PB-PACTICIPANT-VERSION-Foo-26f353580936ad3b9baddb17b00e84f33c69e7cb' =>
14
+ '/pacticipants/Foo/versions/26f353580936ad3b9baddb17b00e84f33c69e7cb'
13
15
  }
14
16
 
15
17
  RESPONSE_BODY_REPLACEMENTS = {
@@ -255,4 +255,20 @@ Pact.provider_states_for "Pact Broker Client" do
255
255
  .create_consumer("Foo")
256
256
  end
257
257
  end
258
+
259
+ provider_state "the pb:pacticipant-version relation exists in the index resource" do
260
+ no_op
261
+ end
262
+
263
+ provider_state "version 26f353580936ad3b9baddb17b00e84f33c69e7cb of pacticipant Foo does not exist" do
264
+ no_op
265
+ end
266
+
267
+ provider_state "version 26f353580936ad3b9baddb17b00e84f33c69e7cb of pacticipant Foo does exist" do
268
+ set_up do
269
+ TestDataBuilder.new
270
+ .create_consumer("Foo")
271
+ .create_consumer_version("26f353580936ad3b9baddb17b00e84f33c69e7cb")
272
+ end
273
+ end
258
274
  end
data/spec/spec_helper.rb CHANGED
@@ -1,3 +1,7 @@
1
+ # Can't stop the gression tests loading the spec_helper becaues of the .rspec file
2
+ # At least we can avoid executing it.
3
+ return if ENV["REGRESSION"] == "true"
4
+
1
5
  $: << File.expand_path("../../", __FILE__)
2
6
 
3
7
  RACK_ENV = ENV['RACK_ENV'] = 'test'
@@ -12,7 +16,6 @@ require 'rspec/pact/matchers'
12
16
  require 'sucker_punch/testing/inline'
13
17
  require 'webmock/rspec'
14
18
  require 'pact_broker/policies'
15
- require 'approvals/rspec'
16
19
 
17
20
  Dir.glob("./spec/support/**/*.rb") { |file| require file }
18
21
 
@@ -20,10 +23,6 @@ WebMock.disable_net_connect!(allow_localhost: true)
20
23
 
21
24
  I18n.config.enforce_available_locales = false
22
25
 
23
- Approvals.configure do |c|
24
- c.approvals_path = 'spec/fixtures/approvals/'
25
- end
26
-
27
26
  RSpec.configure do | config |
28
27
  config.before :each do
29
28
  PactBroker.reset_configuration
@@ -53,6 +52,19 @@ RSpec.configure do | config |
53
52
  config.example_status_persistence_file_path = "./spec/examples.txt"
54
53
  config.filter_run_excluding skip: true
55
54
 
55
+ config.after(:each) do | example, something |
56
+ if example.exception.is_a?(Approvals::ApprovalError)
57
+ require "pact/support"
58
+ parts = example.exception.message.split('"')
59
+ received_file = parts[1]
60
+ approved_file = parts[3]
61
+ received_hash = JSON.parse(File.read(received_file))
62
+ approved_hash = JSON.parse(File.read(approved_file))
63
+ diff = Pact::Matchers.diff(approved_hash, received_hash)
64
+ puts Pact::Matchers::UnixDiffFormatter.call(diff)
65
+ end
66
+ end
67
+
56
68
  def app
57
69
  PactBroker::API
58
70
  end
@@ -0,0 +1,24 @@
1
+ require 'approvals/rspec'
2
+ require 'pact/support'
3
+
4
+ Approvals.configure do |c|
5
+ c.approvals_path = 'spec/fixtures/approvals/'
6
+ end
7
+
8
+ def print_diff(exception)
9
+ parts = exception.message.split('"')
10
+ received_file = parts[1]
11
+ approved_file = parts[3]
12
+ received_hash = JSON.parse(File.read(received_file))
13
+ approved_hash = JSON.parse(File.read(approved_file))
14
+ diff = Pact::Matchers.diff(approved_hash, received_hash)
15
+ puts Pact::Matchers::UnixDiffFormatter.call(diff)
16
+ end
17
+
18
+ RSpec.configure do | config |
19
+ config.after(:each) do | example |
20
+ if example.exception.is_a?(Approvals::ApprovalError)
21
+ print_diff(example.exception)
22
+ end
23
+ end
24
+ end
@@ -22,6 +22,17 @@ RSpec::Matchers.define :be_a_hal_json_success_response do
22
22
  end
23
23
  end
24
24
 
25
+ RSpec::Matchers.define :be_a_hal_json_created_response do
26
+ match do | actual |
27
+ expect(actual.status).to be 201
28
+ expect(actual.headers['Content-Type']).to eq 'application/hal+json;charset=utf-8'
29
+ end
30
+
31
+ failure_message do
32
+ "Expected creation successful json response, got #{actual.status} #{actual.headers['Content-Type']} with body #{actual.body}"
33
+ end
34
+ end
35
+
25
36
  RSpec::Matchers.define :be_a_json_response do
26
37
  match do | actual |
27
38
  expect(actual.headers['Content-Type']).to eq 'application/hal+json;charset=utf-8'
data/tasks/database.rb CHANGED
@@ -14,7 +14,7 @@ module PactBroker
14
14
  extend self
15
15
 
16
16
  def migrate target = nil
17
- opts = target ? {target: target} : {}
17
+ opts = target ? { target: target } : {}
18
18
  PactBroker::DB::Migrate.call(database, opts)
19
19
  end
20
20
 
data/tasks/db.rake CHANGED
@@ -98,6 +98,7 @@ namespace :db do
98
98
  desc 'Annotate the Sequel domain classes with schema information'
99
99
  task :annotate do
100
100
  begin
101
+ raise "Need to set INSTALL_PG=true" unless ENV["INSTALL_PG"] == "true"
101
102
  ENV['RACK_ENV'] = 'test'
102
103
  ENV['DATABASE_ADAPTER'] = 'docker_postgres'
103
104
  load 'tasks/docker_database.rb'
data/tasks/rspec.rake CHANGED
@@ -11,7 +11,7 @@ end
11
11
 
12
12
  RSpec::Core::RakeTask.new('regression') do |task|
13
13
  task.pattern = 'regression/**{,/*/**}/*_spec.rb'
14
- task.rspec_opts = '--require regression/regression_helper.rb'
14
+ task.rspec_opts = '--require ./regression/regression_helper.rb'
15
15
  end
16
16
 
17
17
  RSpec::Core::RakeTask.new('spec:slow') do |task|
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.76.1
4
+ version: 2.79.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: 2021-01-27 00:00:00.000000000 Z
13
+ date: 2021-02-25 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: httparty
@@ -373,6 +373,7 @@ files:
373
373
  - ".github/ISSUE_TEMPLATE.md"
374
374
  - ".github/PULL_REQUEST_TEMPLATE.md"
375
375
  - ".github/workflows/release_gem.yml"
376
+ - ".github/workflows/test-ruby-3.yml"
376
377
  - ".github/workflows/test.yml"
377
378
  - ".gitignore"
378
379
  - ".optic/.gitignore"
@@ -407,6 +408,7 @@ files:
407
408
  - db/ddl_statements/latest_pact_consumer_version_orders.rb
408
409
  - db/ddl_statements/latest_pact_publications_by_consumer_versions.rb
409
410
  - db/ddl_statements/latest_tagged_pact_consumer_version_orders.rb
411
+ - db/ddl_statements/latest_tagged_pact_publications.rb
410
412
  - db/ddl_statements/latest_triggered_webhooks.rb
411
413
  - db/ddl_statements/latest_verification_ids_for_consumer_and_provider.rb
412
414
  - db/ddl_statements/latest_verification_ids_for_consumer_version_tags.rb
@@ -532,6 +534,13 @@ files:
532
534
  - db/migrations/20201026_update_latest_verification_ids_for_consumer_and_provider.rb
533
535
  - db/migrations/20210115_add_webhook_foreign_key_indexes.rb
534
536
  - db/migrations/20210116_add_context_to_triggered_webhook.rb
537
+ - db/migrations/20210117_add_branch_to_version.rb
538
+ - db/migrations/20210202_add_created_at_to_head_pact_tags.rb
539
+ - db/migrations/20210205_add_pacticipant_id_to_tag.rb
540
+ - db/migrations/20210206_add_index_to_tags_and_versions.rb
541
+ - db/migrations/20210207_optimise_latest_verification_ids_for_consumer_version_tags.rb
542
+ - db/migrations/20210208_optimise_latest_tagged_pact_cv_orders.rb
543
+ - db/migrations/20210210_create_environments_table.rb
535
544
  - db/migrations/migration_helper.rb
536
545
  - db/test/backwards_compatibility/.rspec
537
546
  - db/test/backwards_compatibility/Appraisals
@@ -566,7 +575,6 @@ files:
566
575
  - docker-compose-ci-mysql.yml
567
576
  - docker-compose-dev-postgres.yml
568
577
  - docker-compose-issue-repro-with-pact-broker-docker-image.yml
569
- - docker-compose-issue-repro.yml
570
578
  - docker-compose-test.yml
571
579
  - docs/images/Pactflow logo - black small.png
572
580
  - example/Gemfile
@@ -595,6 +603,7 @@ files:
595
603
  - lib/pact_broker/api/contracts/base_contract.rb
596
604
  - lib/pact_broker/api/contracts/dry_validation_predicates.rb
597
605
  - lib/pact_broker/api/contracts/dry_validation_workarounds.rb
606
+ - lib/pact_broker/api/contracts/environment_schema.rb
598
607
  - lib/pact_broker/api/contracts/pacticipant_name_contract.rb
599
608
  - lib/pact_broker/api/contracts/pacticipant_name_validation.rb
600
609
  - lib/pact_broker/api/contracts/put_pact_params_contract.rb
@@ -614,6 +623,8 @@ files:
614
623
  - lib/pact_broker/api/decorators/embedded_label_decorator.rb
615
624
  - lib/pact_broker/api/decorators/embedded_tag_decorator.rb
616
625
  - lib/pact_broker/api/decorators/embedded_version_decorator.rb
626
+ - lib/pact_broker/api/decorators/environment_decorator.rb
627
+ - lib/pact_broker/api/decorators/environments_decorator.rb
617
628
  - lib/pact_broker/api/decorators/extended_pact_decorator.rb
618
629
  - lib/pact_broker/api/decorators/extended_verification_decorator.rb
619
630
  - lib/pact_broker/api/decorators/format_date_time.rb
@@ -668,6 +679,8 @@ files:
668
679
  - lib/pact_broker/api/resources/clean.rb
669
680
  - lib/pact_broker/api/resources/dashboard.rb
670
681
  - lib/pact_broker/api/resources/default_base_resource.rb
682
+ - lib/pact_broker/api/resources/environment.rb
683
+ - lib/pact_broker/api/resources/environments.rb
671
684
  - lib/pact_broker/api/resources/error_handler.rb
672
685
  - lib/pact_broker/api/resources/error_response_body_generator.rb
673
686
  - lib/pact_broker/api/resources/error_test.rb
@@ -682,6 +695,7 @@ files:
682
695
  - lib/pact_broker/api/resources/latest_verification_for_latest_pact.rb
683
696
  - lib/pact_broker/api/resources/latest_verification_for_pact.rb
684
697
  - lib/pact_broker/api/resources/latest_verifications_for_consumer_version.rb
698
+ - lib/pact_broker/api/resources/latest_version.rb
685
699
  - lib/pact_broker/api/resources/matrix.rb
686
700
  - lib/pact_broker/api/resources/matrix_badge.rb
687
701
  - lib/pact_broker/api/resources/matrix_for_consumer_and_provider.rb
@@ -726,6 +740,7 @@ files:
726
740
  - lib/pact_broker/config/repository.rb
727
741
  - lib/pact_broker/config/save.rb
728
742
  - lib/pact_broker/config/setting.rb
743
+ - lib/pact_broker/config/space_delimited_integer_list.rb
729
744
  - lib/pact_broker/config/space_delimited_string_list.rb
730
745
  - lib/pact_broker/configuration.rb
731
746
  - lib/pact_broker/constants.rb
@@ -740,6 +755,7 @@ files:
740
755
  - lib/pact_broker/db/data_migrations/set_consumer_ids_for_pact_publications.rb
741
756
  - lib/pact_broker/db/data_migrations/set_created_at_for_latest_pact_publications.rb
742
757
  - lib/pact_broker/db/data_migrations/set_created_at_for_latest_verifications.rb
758
+ - lib/pact_broker/db/data_migrations/set_extra_columns_for_tags.rb
743
759
  - lib/pact_broker/db/data_migrations/set_latest_version_sequence_value.rb
744
760
  - lib/pact_broker/db/data_migrations/set_pacticipant_ids_for_verifications.rb
745
761
  - lib/pact_broker/db/data_migrations/set_webhooks_enabled.rb
@@ -755,6 +771,8 @@ files:
755
771
  - lib/pact_broker/db/table_dependency_calculator.rb
756
772
  - lib/pact_broker/db/validate_encoding.rb
757
773
  - lib/pact_broker/db/version.rb
774
+ - lib/pact_broker/deployments/environment.rb
775
+ - lib/pact_broker/deployments/environment_service.rb
758
776
  - lib/pact_broker/diagnostic/app.rb
759
777
  - lib/pact_broker/diagnostic/resources/base_resource.rb
760
778
  - lib/pact_broker/diagnostic/resources/dependencies.rb
@@ -763,12 +781,15 @@ files:
763
781
  - lib/pact_broker/doc/views/can-i-deploy.markdown
764
782
  - lib/pact_broker/doc/views/consumer-version.markdown
765
783
  - lib/pact_broker/doc/views/consumer.markdown
784
+ - lib/pact_broker/doc/views/index/environment.markdown
785
+ - lib/pact_broker/doc/views/index/environments.markdown
766
786
  - lib/pact_broker/doc/views/index/latest-pact-versions.markdown
767
787
  - lib/pact_broker/doc/views/index/latest-provider-pacts-with-tag.markdown
768
788
  - lib/pact_broker/doc/views/index/latest-provider-pacts.markdown
769
789
  - lib/pact_broker/doc/views/index/latest-tagged-version.markdown
770
790
  - lib/pact_broker/doc/views/index/latest-version.markdown
771
791
  - lib/pact_broker/doc/views/index/pacticipant-version-tag.markdown
792
+ - lib/pact_broker/doc/views/index/pacticipant-version.markdown
772
793
  - lib/pact_broker/doc/views/index/pacticipants.markdown
773
794
  - lib/pact_broker/doc/views/index/provider-pacts-with-tag.markdown
774
795
  - lib/pact_broker/doc/views/index/provider-pacts.markdown
@@ -855,6 +876,7 @@ files:
855
876
  - lib/pact_broker/pacts/content.rb
856
877
  - lib/pact_broker/pacts/create_formatted_diff.rb
857
878
  - lib/pact_broker/pacts/diff.rb
879
+ - lib/pact_broker/pacts/eager_loaders.rb
858
880
  - lib/pact_broker/pacts/generate_interaction_sha.rb
859
881
  - lib/pact_broker/pacts/generate_sha.rb
860
882
  - lib/pact_broker/pacts/head_pact.rb
@@ -862,12 +884,15 @@ files:
862
884
  - lib/pact_broker/pacts/latest_pact_publications.rb
863
885
  - lib/pact_broker/pacts/latest_pact_publications_by_consumer_version.rb
864
886
  - lib/pact_broker/pacts/latest_tagged_pact_publications.rb
887
+ - lib/pact_broker/pacts/lazy_loaders.rb
865
888
  - lib/pact_broker/pacts/merger.rb
866
889
  - lib/pact_broker/pacts/metadata.rb
867
890
  - lib/pact_broker/pacts/order_hash_keys.rb
868
891
  - lib/pact_broker/pacts/pact_params.rb
869
892
  - lib/pact_broker/pacts/pact_publication.rb
893
+ - lib/pact_broker/pacts/pact_publication_dataset_module.rb
870
894
  - lib/pact_broker/pacts/pact_version.rb
895
+ - lib/pact_broker/pacts/pacts_for_verification_repository.rb
871
896
  - lib/pact_broker/pacts/parse.rb
872
897
  - lib/pact_broker/pacts/placeholder_pact.rb
873
898
  - lib/pact_broker/pacts/repository.rb
@@ -886,6 +911,7 @@ files:
886
911
  - lib/pact_broker/repositories/helpers.rb
887
912
  - lib/pact_broker/services.rb
888
913
  - lib/pact_broker/string_refinements.rb
914
+ - lib/pact_broker/tags/eager_loaders.rb
889
915
  - lib/pact_broker/tags/head_pact_tags.rb
890
916
  - lib/pact_broker/tags/repository.rb
891
917
  - lib/pact_broker/tags/service.rb
@@ -938,7 +964,9 @@ files:
938
964
  - lib/pact_broker/verifications/summary_for_consumer_version.rb
939
965
  - lib/pact_broker/version.rb
940
966
  - lib/pact_broker/versions/abbreviate_number.rb
967
+ - lib/pact_broker/versions/eager_loaders.rb
941
968
  - lib/pact_broker/versions/latest_version.rb
969
+ - lib/pact_broker/versions/lazy_loaders.rb
942
970
  - lib/pact_broker/versions/parse_semantic_version.rb
943
971
  - lib/pact_broker/versions/repository.rb
944
972
  - lib/pact_broker/versions/sequence.rb
@@ -1056,9 +1084,13 @@ files:
1056
1084
  - public/stylesheets/pact.css
1057
1085
  - regression/.gitignore
1058
1086
  - regression/can_i_deploy_spec.rb
1087
+ - regression/index_spec.rb
1059
1088
  - regression/regression_helper.rb
1060
1089
  - regression/script/approval-all.sh
1090
+ - regression/script/clear.sh
1091
+ - regression/script/run.sh
1061
1092
  - script/db-spec.sh
1093
+ - script/demonstrate-version-branches.rb
1062
1094
  - script/docker-container/test.sh
1063
1095
  - script/docker/db-execute-sql-file.sh
1064
1096
  - script/docker/db-psql.sh
@@ -1107,8 +1139,12 @@ files:
1107
1139
  - script/webhook-server.ru
1108
1140
  - spec/features/base_equality_only_on_content_that_affects_verification_results_spec.rb
1109
1141
  - spec/features/can_i_deploy_spec.rb
1142
+ - spec/features/create_environment_spec.rb
1110
1143
  - spec/features/create_pacticipant_spec.rb
1144
+ - spec/features/create_tag_spec.rb
1145
+ - spec/features/create_version_spec.rb
1111
1146
  - spec/features/create_webhook_spec.rb
1147
+ - spec/features/delete_environment_spec.rb
1112
1148
  - spec/features/delete_integration_spec.rb
1113
1149
  - spec/features/delete_label_spec.rb
1114
1150
  - spec/features/delete_pact_spec.rb
@@ -1118,11 +1154,14 @@ files:
1118
1154
  - spec/features/delete_version_spec.rb
1119
1155
  - spec/features/delete_webhook_spec.rb
1120
1156
  - spec/features/edit_webhook_spec.rb
1157
+ - spec/features/end_deployment_spec.rb
1121
1158
  - spec/features/execute_unsaved_webhook_spec.rb
1122
1159
  - spec/features/execute_webhook_spec.rb
1123
1160
  - spec/features/get_can_i_deploy_badge_spec.rb
1124
1161
  - spec/features/get_dashboard_spec.rb
1125
1162
  - spec/features/get_diff_spec.rb
1163
+ - spec/features/get_environment_spec.rb
1164
+ - spec/features/get_environments_spec.rb
1126
1165
  - spec/features/get_integrations_dot_file_spec.rb
1127
1166
  - spec/features/get_integrations_spec.rb
1128
1167
  - spec/features/get_label_spec.rb
@@ -1155,7 +1194,9 @@ files:
1155
1194
  - spec/features/publish_not_a_pact_spec.rb
1156
1195
  - spec/features/publish_pact_spec.rb
1157
1196
  - spec/features/publish_verification_spec.rb
1197
+ - spec/features/record_deployment_spec.rb
1158
1198
  - spec/features/tag_version_spec.rb
1199
+ - spec/features/update_environment_spec.rb
1159
1200
  - spec/features/update_matrix_spec.rb
1160
1201
  - spec/features/update_pacticipant_spec.rb
1161
1202
  - spec/features/update_webhook_spec.rb
@@ -1192,6 +1233,7 @@ files:
1192
1233
  - spec/lib/pact/doc/interaction_view_model_spec.rb
1193
1234
  - spec/lib/pact/doc/markdown/consumer_contract_renderer_spec.rb
1194
1235
  - spec/lib/pact/doc/markdown/index_renderer_spec.rb
1236
+ - spec/lib/pact_broker/api/contracts/environment_schema_spec.rb
1195
1237
  - spec/lib/pact_broker/api/contracts/put_pact_params_contract_spec.rb
1196
1238
  - spec/lib/pact_broker/api/contracts/verifiable_pacts_json_query_schema_spec.rb
1197
1239
  - spec/lib/pact_broker/api/contracts/verifiable_pacts_query_schema_spec.rb
@@ -1262,6 +1304,7 @@ files:
1262
1304
  - spec/lib/pact_broker/api/resources/verification_spec.rb
1263
1305
  - spec/lib/pact_broker/api/resources/verification_triggered_webhooks_spec.rb
1264
1306
  - spec/lib/pact_broker/api/resources/verifications_spec.rb
1307
+ - spec/lib/pact_broker/api/resources/webhook_execution_result_spec.rb
1265
1308
  - spec/lib/pact_broker/api/resources/webhook_execution_spec.rb
1266
1309
  - spec/lib/pact_broker/api/resources/webhook_spec.rb
1267
1310
  - spec/lib/pact_broker/api/resources/webhooks_spec.rb
@@ -1272,6 +1315,7 @@ files:
1272
1315
  - spec/lib/pact_broker/config/load_spec.rb
1273
1316
  - spec/lib/pact_broker/config/save_and_load_spec.rb
1274
1317
  - spec/lib/pact_broker/config/save_spec.rb
1318
+ - spec/lib/pact_broker/config/space_delimited_integer_list_spec.rb
1275
1319
  - spec/lib/pact_broker/config/space_delimited_string_list_spec.rb
1276
1320
  - spec/lib/pact_broker/configuration_spec.rb
1277
1321
  - spec/lib/pact_broker/db/clean_incremental_spec.rb
@@ -1334,10 +1378,12 @@ files:
1334
1378
  - spec/lib/pact_broker/pacts/merger_spec.rb
1335
1379
  - spec/lib/pact_broker/pacts/metadata_spec.rb
1336
1380
  - spec/lib/pact_broker/pacts/pact_params_spec.rb
1381
+ - spec/lib/pact_broker/pacts/pact_publication_dataset_module_spec.rb
1337
1382
  - spec/lib/pact_broker/pacts/pact_publication_spec.rb
1338
1383
  - spec/lib/pact_broker/pacts/pact_version_spec.rb
1339
1384
  - spec/lib/pact_broker/pacts/repository_find_for_verification_fallback_spec.rb
1340
1385
  - spec/lib/pact_broker/pacts/repository_find_for_verification_spec.rb
1386
+ - spec/lib/pact_broker/pacts/repository_find_wip_pact_versions_for_provider_branch_spec.rb
1341
1387
  - spec/lib/pact_broker/pacts/repository_find_wip_pact_versions_for_provider_spec.rb
1342
1388
  - spec/lib/pact_broker/pacts/repository_spec.rb
1343
1389
  - spec/lib/pact_broker/pacts/selected_pact_spec.rb
@@ -1385,6 +1431,7 @@ files:
1385
1431
  - spec/lib/rack/pact_broker/database_transaction_spec.rb
1386
1432
  - spec/lib/rack/pact_broker/invalid_uri_protection_spec.rb
1387
1433
  - spec/lib/rack/pact_broker/request_target_spec.rb
1434
+ - spec/lib/rack/pact_broker/set_base_url_spec.rb
1388
1435
  - spec/lib/rack/pact_broker/use_when_spec.rb
1389
1436
  - spec/lib/sequel/plugins/insert_ignore_spec.rb
1390
1437
  - spec/lib/sequel/plugins/upsert_spec.rb
@@ -1405,6 +1452,7 @@ files:
1405
1452
  - spec/service_consumers/provider_states_for_pact_broker_client.rb
1406
1453
  - spec/service_consumers/provider_states_for_pact_ruby.rb
1407
1454
  - spec/spec_helper.rb
1455
+ - spec/support/approvals.rb
1408
1456
  - spec/support/database.rb
1409
1457
  - spec/support/database_cleaner.rb
1410
1458
  - spec/support/fixture_helpers.rb
@@ -1502,15 +1550,19 @@ required_rubygems_version: !ruby/object:Gem::Requirement
1502
1550
  - !ruby/object:Gem::Version
1503
1551
  version: '0'
1504
1552
  requirements: []
1505
- rubygems_version: 3.2.7
1553
+ rubygems_version: 3.2.11
1506
1554
  signing_key:
1507
1555
  specification_version: 4
1508
1556
  summary: See description
1509
1557
  test_files:
1510
1558
  - spec/features/base_equality_only_on_content_that_affects_verification_results_spec.rb
1511
1559
  - spec/features/can_i_deploy_spec.rb
1560
+ - spec/features/create_environment_spec.rb
1512
1561
  - spec/features/create_pacticipant_spec.rb
1562
+ - spec/features/create_tag_spec.rb
1563
+ - spec/features/create_version_spec.rb
1513
1564
  - spec/features/create_webhook_spec.rb
1565
+ - spec/features/delete_environment_spec.rb
1514
1566
  - spec/features/delete_integration_spec.rb
1515
1567
  - spec/features/delete_label_spec.rb
1516
1568
  - spec/features/delete_pact_spec.rb
@@ -1520,11 +1572,14 @@ test_files:
1520
1572
  - spec/features/delete_version_spec.rb
1521
1573
  - spec/features/delete_webhook_spec.rb
1522
1574
  - spec/features/edit_webhook_spec.rb
1575
+ - spec/features/end_deployment_spec.rb
1523
1576
  - spec/features/execute_unsaved_webhook_spec.rb
1524
1577
  - spec/features/execute_webhook_spec.rb
1525
1578
  - spec/features/get_can_i_deploy_badge_spec.rb
1526
1579
  - spec/features/get_dashboard_spec.rb
1527
1580
  - spec/features/get_diff_spec.rb
1581
+ - spec/features/get_environment_spec.rb
1582
+ - spec/features/get_environments_spec.rb
1528
1583
  - spec/features/get_integrations_dot_file_spec.rb
1529
1584
  - spec/features/get_integrations_spec.rb
1530
1585
  - spec/features/get_label_spec.rb
@@ -1557,7 +1612,9 @@ test_files:
1557
1612
  - spec/features/publish_not_a_pact_spec.rb
1558
1613
  - spec/features/publish_pact_spec.rb
1559
1614
  - spec/features/publish_verification_spec.rb
1615
+ - spec/features/record_deployment_spec.rb
1560
1616
  - spec/features/tag_version_spec.rb
1617
+ - spec/features/update_environment_spec.rb
1561
1618
  - spec/features/update_matrix_spec.rb
1562
1619
  - spec/features/update_pacticipant_spec.rb
1563
1620
  - spec/features/update_webhook_spec.rb
@@ -1594,6 +1651,7 @@ test_files:
1594
1651
  - spec/lib/pact/doc/interaction_view_model_spec.rb
1595
1652
  - spec/lib/pact/doc/markdown/consumer_contract_renderer_spec.rb
1596
1653
  - spec/lib/pact/doc/markdown/index_renderer_spec.rb
1654
+ - spec/lib/pact_broker/api/contracts/environment_schema_spec.rb
1597
1655
  - spec/lib/pact_broker/api/contracts/put_pact_params_contract_spec.rb
1598
1656
  - spec/lib/pact_broker/api/contracts/verifiable_pacts_json_query_schema_spec.rb
1599
1657
  - spec/lib/pact_broker/api/contracts/verifiable_pacts_query_schema_spec.rb
@@ -1664,6 +1722,7 @@ test_files:
1664
1722
  - spec/lib/pact_broker/api/resources/verification_spec.rb
1665
1723
  - spec/lib/pact_broker/api/resources/verification_triggered_webhooks_spec.rb
1666
1724
  - spec/lib/pact_broker/api/resources/verifications_spec.rb
1725
+ - spec/lib/pact_broker/api/resources/webhook_execution_result_spec.rb
1667
1726
  - spec/lib/pact_broker/api/resources/webhook_execution_spec.rb
1668
1727
  - spec/lib/pact_broker/api/resources/webhook_spec.rb
1669
1728
  - spec/lib/pact_broker/api/resources/webhooks_spec.rb
@@ -1674,6 +1733,7 @@ test_files:
1674
1733
  - spec/lib/pact_broker/config/load_spec.rb
1675
1734
  - spec/lib/pact_broker/config/save_and_load_spec.rb
1676
1735
  - spec/lib/pact_broker/config/save_spec.rb
1736
+ - spec/lib/pact_broker/config/space_delimited_integer_list_spec.rb
1677
1737
  - spec/lib/pact_broker/config/space_delimited_string_list_spec.rb
1678
1738
  - spec/lib/pact_broker/configuration_spec.rb
1679
1739
  - spec/lib/pact_broker/db/clean_incremental_spec.rb
@@ -1736,10 +1796,12 @@ test_files:
1736
1796
  - spec/lib/pact_broker/pacts/merger_spec.rb
1737
1797
  - spec/lib/pact_broker/pacts/metadata_spec.rb
1738
1798
  - spec/lib/pact_broker/pacts/pact_params_spec.rb
1799
+ - spec/lib/pact_broker/pacts/pact_publication_dataset_module_spec.rb
1739
1800
  - spec/lib/pact_broker/pacts/pact_publication_spec.rb
1740
1801
  - spec/lib/pact_broker/pacts/pact_version_spec.rb
1741
1802
  - spec/lib/pact_broker/pacts/repository_find_for_verification_fallback_spec.rb
1742
1803
  - spec/lib/pact_broker/pacts/repository_find_for_verification_spec.rb
1804
+ - spec/lib/pact_broker/pacts/repository_find_wip_pact_versions_for_provider_branch_spec.rb
1743
1805
  - spec/lib/pact_broker/pacts/repository_find_wip_pact_versions_for_provider_spec.rb
1744
1806
  - spec/lib/pact_broker/pacts/repository_spec.rb
1745
1807
  - spec/lib/pact_broker/pacts/selected_pact_spec.rb
@@ -1787,6 +1849,7 @@ test_files:
1787
1849
  - spec/lib/rack/pact_broker/database_transaction_spec.rb
1788
1850
  - spec/lib/rack/pact_broker/invalid_uri_protection_spec.rb
1789
1851
  - spec/lib/rack/pact_broker/request_target_spec.rb
1852
+ - spec/lib/rack/pact_broker/set_base_url_spec.rb
1790
1853
  - spec/lib/rack/pact_broker/use_when_spec.rb
1791
1854
  - spec/lib/sequel/plugins/insert_ignore_spec.rb
1792
1855
  - spec/lib/sequel/plugins/upsert_spec.rb
@@ -1807,6 +1870,7 @@ test_files:
1807
1870
  - spec/service_consumers/provider_states_for_pact_broker_client.rb
1808
1871
  - spec/service_consumers/provider_states_for_pact_ruby.rb
1809
1872
  - spec/spec_helper.rb
1873
+ - spec/support/approvals.rb
1810
1874
  - spec/support/database.rb
1811
1875
  - spec/support/database_cleaner.rb
1812
1876
  - spec/support/fixture_helpers.rb