pact_broker 2.97.0 → 2.100.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 +52 -0
- data/docs/CONFIGURATION.md +37 -5
- data/lib/pact_broker/api/decorators/reason_decorator.rb +1 -15
- data/lib/pact_broker/api/middleware/http_debug_logs.rb +13 -7
- data/lib/pact_broker/api/resources/base_resource.rb +4 -0
- data/lib/pact_broker/api/resources/deployed_version.rb +8 -2
- data/lib/pact_broker/api/resources/deployed_versions_for_version_and_environment.rb +1 -5
- data/lib/pact_broker/api/resources/latest_pacts.rb +1 -1
- data/lib/pact_broker/api/resources/pact.rb +0 -8
- data/lib/pact_broker/api/resources/pact_content_diff.rb +7 -2
- data/lib/pact_broker/api/resources/pact_versions.rb +1 -5
- data/lib/pact_broker/api/resources/pact_versions_for_branch.rb +1 -5
- data/lib/pact_broker/api/resources/pacticipant_resource_methods.rb +0 -1
- data/lib/pact_broker/api/resources/provider_pacts.rb +1 -1
- data/lib/pact_broker/api/resources/publish_contracts.rb +1 -1
- data/lib/pact_broker/api/resources/released_version.rb +8 -2
- data/lib/pact_broker/api/resources/released_versions_for_version_and_environment.rb +1 -1
- data/lib/pact_broker/api/resources/tagged_pact_versions.rb +1 -5
- data/lib/pact_broker/api/resources/verification.rb +0 -4
- data/lib/pact_broker/api/resources/verifications.rb +0 -4
- data/lib/pact_broker/api/resources/version.rb +8 -0
- data/lib/pact_broker/app.rb +2 -0
- data/lib/pact_broker/config/runtime_configuration.rb +4 -2
- data/lib/pact_broker/config/runtime_configuration_database_methods.rb +1 -1
- data/lib/pact_broker/contracts/contract_to_publish.rb +4 -0
- data/lib/pact_broker/contracts/contracts_to_publish.rb +4 -0
- data/lib/pact_broker/contracts/service.rb +23 -5
- data/lib/pact_broker/domain/tag.rb +8 -32
- data/lib/pact_broker/domain/version.rb +18 -10
- data/lib/pact_broker/locale/en.yml +7 -4
- data/lib/pact_broker/matrix/deployment_status_summary.rb +28 -19
- data/lib/pact_broker/matrix/every_row.rb +19 -1
- data/lib/pact_broker/matrix/integration.rb +5 -5
- data/lib/pact_broker/matrix/parse_query.rb +5 -0
- data/lib/pact_broker/matrix/quick_row.rb +41 -5
- data/lib/pact_broker/matrix/repository.rb +5 -3
- data/lib/pact_broker/matrix/resolved_selector.rb +47 -10
- data/lib/pact_broker/matrix/service.rb +4 -2
- data/lib/pact_broker/matrix/unresolved_selector.rb +14 -2
- data/lib/pact_broker/messages.rb +0 -15
- data/lib/pact_broker/pacticipants/service.rb +11 -1
- data/lib/pact_broker/pacts/create_formatted_diff.rb +1 -0
- data/lib/pact_broker/pacts/eager_loaders.rb +4 -1
- data/lib/pact_broker/pacts/pact_publication_dataset_module.rb +25 -0
- data/lib/pact_broker/pacts/pact_publication_wip_dataset_module.rb +0 -15
- data/lib/pact_broker/pacts/verifiable_pact_messages.rb +4 -2
- data/lib/pact_broker/repositories/helpers.rb +13 -0
- data/lib/pact_broker/test/http_test_data_builder.rb +18 -2
- data/lib/pact_broker/ui/views/groups/show.html.erb +2 -2
- data/lib/pact_broker/ui/views/matrix/show.haml +5 -2
- data/lib/pact_broker/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f22862d2054c07b06fb947f8a1f710dab261ae6ac1207e6a15adebb07dc488db
|
4
|
+
data.tar.gz: 5cc63160ad026673f194af54237080aeb6eb8ab4f9ac93cbe5cd71b63727d60e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8b6c0cefc1e4847ed53627f0b2aae7cfd5be46e351ce1969f21b80f5f8899990cca3f612d9ab14a82d58c0521b91fb5f5a820f4c7d9e72f17fbc391f1583daff
|
7
|
+
data.tar.gz: 4c1c3fa1a8e983718f1f841c8b17088678c6f4ada22c36b3ededb71a46c2bf004712c4716a8af33c17e068c88b88a6b69f219a286549841c20fa8c79ae41a214
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,55 @@
|
|
1
|
+
<a name="v2.100.0"></a>
|
2
|
+
### v2.100.0 (2022-05-20)
|
3
|
+
|
4
|
+
#### Features
|
5
|
+
|
6
|
+
* check for potential duplicate pacticipants in publish contracts endpoint (#558) ([ed714f03](/../../commit/ed714f03))
|
7
|
+
* add support for "can i merge" matrix query ([bb108ed2](/../../commit/bb108ed2))
|
8
|
+
* remove inefficient skynet query for tags ([bdc2599c](/../../commit/bdc2599c))
|
9
|
+
* update text for matrix version description when no version is in an enviroment ([3eb5581d](/../../commit/3eb5581d))
|
10
|
+
|
11
|
+
* **pacts for verification**
|
12
|
+
* update wip and pending descriptions for wip pacts ([b06d4477](/../../commit/b06d4477))
|
13
|
+
|
14
|
+
* **matrix**
|
15
|
+
* add support for selectors specified by branch and environment name when reporting that a version does not exist ([07ff8044](/../../commit/07ff8044))
|
16
|
+
|
17
|
+
#### Bug Fixes
|
18
|
+
|
19
|
+
* **matrix**
|
20
|
+
* identify the correct failed version when a selector resolves to multiple versions ([11e7dc1c](/../../commit/11e7dc1c))
|
21
|
+
|
22
|
+
<a name="v2.99.0"></a>
|
23
|
+
### v2.99.0 (2022-05-13)
|
24
|
+
|
25
|
+
#### Features
|
26
|
+
|
27
|
+
* remove disable_use_branch_heads_for_latest_branch_pacts feature toggle ([5c6f1766](/../../commit/5c6f1766))
|
28
|
+
* remove new_wip_calculation feature toggle ([add6cb08](/../../commit/add6cb08))
|
29
|
+
* timeout long running pact content diff requests (#555) ([88abb2cf](/../../commit/88abb2cf))
|
30
|
+
* change sql_log_level default from debug to none ([9f7aed46](/../../commit/9f7aed46))
|
31
|
+
|
32
|
+
#### Bug Fixes
|
33
|
+
|
34
|
+
* **ui**
|
35
|
+
* fix unescaped pacticipant name and main branch in details and network pages ([b8b1d306](/../../commit/b8b1d306))
|
36
|
+
|
37
|
+
* return a 400 when invalid JSON is used to create a version ([9af2cfaf](/../../commit/9af2cfaf))
|
38
|
+
* only log API requests/responses, not web assets, when http_debug_logging_enabled is true ([1f232c08](/../../commit/1f232c08))
|
39
|
+
|
40
|
+
* **matrix**
|
41
|
+
* fix performance issue when querying matrix with one selector ([3a08d128](/../../commit/3a08d128))
|
42
|
+
|
43
|
+
* **pacts for verification**
|
44
|
+
* return the pacts for the branch heads when using the branch selector ([6dac495e](/../../commit/6dac495e))
|
45
|
+
|
46
|
+
<a name="v2.98.0"></a>
|
47
|
+
### v2.98.0 (2022-03-29)
|
48
|
+
|
49
|
+
#### Features
|
50
|
+
|
51
|
+
* support debug logging of entire request and response ([42eb4a17](/../../commit/42eb4a17))
|
52
|
+
|
1
53
|
<a name="v2.97.0"></a>
|
2
54
|
### v2.97.0 (2022-03-29)
|
3
55
|
|
data/docs/CONFIGURATION.md
CHANGED
@@ -53,6 +53,18 @@ While the default is `file` for the Ruby application, it is set to `stdout` on t
|
|
53
53
|
**Default:** `file`<br/>
|
54
54
|
**Allowed values:** `stdout`, `file`<br/>
|
55
55
|
|
56
|
+
### http_debug_logging_enabled
|
57
|
+
|
58
|
+
Enable this setting to print the entire request and response to the logs at debug level. Used for troubleshooting issues.
|
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.
|
61
|
+
|
62
|
+
**Supported versions:** From v2.98.0<br/>
|
63
|
+
**Environment variable name:** `PACT_BROKER_HTTP_DEBUG_LOGGING_ENABLED`<br/>
|
64
|
+
**YAML configuration key name:** `http_debug_logging_enabled`<br/>
|
65
|
+
**Default:** `false`<br/>
|
66
|
+
**Allowed values:** `true`, `false`<br/>
|
67
|
+
|
56
68
|
### hide_pactflow_messages
|
57
69
|
|
58
70
|
Set to `true` to hide the messages in the logs about Pactflow
|
@@ -145,7 +157,7 @@ To disable noisy SQL query logging when the application `log_level` is set to `d
|
|
145
157
|
|
146
158
|
**Environment variable name:** `PACT_BROKER_SQL_LOG_LEVEL`<br/>
|
147
159
|
**YAML configuration key name:** `sql_log_level`<br/>
|
148
|
-
**Default:** `debug
|
160
|
+
**Default:** From 2.99+, the default is `none`. In previous versions, the default is `debug`.<br/>
|
149
161
|
**Allowed values:** `none`, `debug`, `info`, `warn`, `error`, `fatal`<br/>
|
150
162
|
|
151
163
|
### sql_log_warn_duration
|
@@ -422,8 +434,6 @@ chain in PEM format, indented by 2 more characters.
|
|
422
434
|
When setting the path, the full path to the certificate file in PEM format must be specified. When using Docker, you must ensure the
|
423
435
|
certificate file is [mounted into the container](https://docs.docker.com/storage/volumes/).
|
424
436
|
|
425
|
-
*NOTE: USING ENVIRONMENT VARIABLES TO SET THE WEBHOOK CERTIFICATES IS NOT SUPPORTED.*
|
426
|
-
|
427
437
|
YAML Example:
|
428
438
|
|
429
439
|
```yaml
|
@@ -436,11 +446,24 @@ webhook_certificates:
|
|
436
446
|
jHT1Ty2CglM=
|
437
447
|
-----END CERTIFICATE-----
|
438
448
|
- description: "An example self signed certificate with a path"
|
439
|
-
path: /full/path/to/the/cert.pem
|
449
|
+
path: "/full/path/to/the/cert.pem"
|
450
|
+
|
451
|
+
```
|
440
452
|
|
453
|
+
Environment variable example:
|
454
|
+
|
455
|
+
```shell
|
456
|
+
PACT_BROKER_WEBHOOK_CERTIFICATES__0__LABEL="An example self signed certificate with content"
|
457
|
+
PACT_BROKER_WEBHOOK_CERTIFICATES__0__CONTENT="-----BEGIN CERTIFICATE-----
|
458
|
+
MIIDZDCCAkygAwIBAgIBATANBgkqhkiG9w0BAQsFADBCMRMwEQYKCZImiZPyLGQB
|
459
|
+
<REST OF CERTIFICATE>
|
460
|
+
jHT1Ty2CglM=
|
461
|
+
-----END CERTIFICATE-----"
|
462
|
+
PACT_BROKER_WEBHOOK_CERTIFICATES__1__LABEL="An example self signed certificate with a path"
|
463
|
+
PACT_BROKER_WEBHOOK_CERTIFICATES__1__PATH="/full/path/to/the/cert.pem"
|
441
464
|
```
|
442
465
|
|
443
|
-
**Supported versions:** From v2.90.0
|
466
|
+
**Supported versions:** From v2.90.0 for YAML and 2.97.0 for environment variables.<br/>
|
444
467
|
**Environment variable name:** `PACT_BROKER_WEBHOOK_CERTIFICATES`<br/>
|
445
468
|
**YAML configuration key name:** `webhook_certificates`<br/>
|
446
469
|
|
@@ -632,6 +655,15 @@ with a unique version number.
|
|
632
655
|
**Allowed values:** `true`, `false`<br/>
|
633
656
|
**More information:** https://docs.pact.io/versioning<br/>
|
634
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
|
+
|
635
667
|
<br/>
|
636
668
|
|
637
669
|
## Miscellaneous
|
@@ -30,7 +30,7 @@ module PactBroker
|
|
30
30
|
when PactBroker::Matrix::PactNotVerifiedByRequiredProviderVersion
|
31
31
|
"There is no verified pact between #{reason.consumer_selector.description} and #{reason.provider_selector.description}"
|
32
32
|
when PactBroker::Matrix::SpecifiedVersionDoesNotExist
|
33
|
-
|
33
|
+
reason.selector.version_does_not_exist_description
|
34
34
|
when PactBroker::Matrix::VerificationFailed
|
35
35
|
"The verification for the pact between #{reason.consumer_selector.description} and #{reason.provider_selector.description} failed"
|
36
36
|
when PactBroker::Matrix::NoDependenciesMissing
|
@@ -53,20 +53,6 @@ module PactBroker
|
|
53
53
|
end
|
54
54
|
end
|
55
55
|
|
56
|
-
def version_does_not_exist_description selector
|
57
|
-
if selector.version_does_not_exist?
|
58
|
-
if selector.tag
|
59
|
-
"No version with tag #{selector.tag} exists for #{selector.pacticipant_name}"
|
60
|
-
elsif selector.pacticipant_version_number
|
61
|
-
"No pacts or verifications have been published for version #{selector.pacticipant_version_number} of #{selector.pacticipant_name}"
|
62
|
-
else
|
63
|
-
"No pacts or verifications have been published for #{selector.pacticipant_name}"
|
64
|
-
end
|
65
|
-
else
|
66
|
-
""
|
67
|
-
end
|
68
|
-
end
|
69
|
-
|
70
56
|
# TODO move this somewhere else
|
71
57
|
def interaction_description(interaction)
|
72
58
|
if interaction["providerState"] && interaction["providerState"] != ""
|
@@ -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
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
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)
|
@@ -58,11 +58,17 @@ module PactBroker
|
|
58
58
|
end
|
59
59
|
|
60
60
|
def policy_name
|
61
|
-
:'versions::
|
61
|
+
:'versions::deployed_version'
|
62
|
+
end
|
63
|
+
|
64
|
+
def policy_record_context
|
65
|
+
{
|
66
|
+
pacticipant: deployed_version&.pacticipant
|
67
|
+
}
|
62
68
|
end
|
63
69
|
|
64
70
|
def policy_record
|
65
|
-
deployed_version&.
|
71
|
+
deployed_version&.environment
|
66
72
|
end
|
67
73
|
|
68
74
|
private
|
@@ -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
|
-
|
23
|
-
|
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
|
@@ -100,7 +100,7 @@ module PactBroker
|
|
100
100
|
end
|
101
101
|
|
102
102
|
def conflict_notices
|
103
|
-
@conflict_notices ||= contract_service.conflict_notices(parsed_contracts)
|
103
|
+
@conflict_notices ||= contract_service.conflict_notices(parsed_contracts, base_url: base_url)
|
104
104
|
end
|
105
105
|
|
106
106
|
def base64_decode(content)
|
@@ -48,11 +48,17 @@ module PactBroker
|
|
48
48
|
end
|
49
49
|
|
50
50
|
def policy_name
|
51
|
-
:'versions::
|
51
|
+
:'versions::released_version'
|
52
|
+
end
|
53
|
+
|
54
|
+
def policy_record_context
|
55
|
+
{
|
56
|
+
pacticipant: released_version&.pacticipant
|
57
|
+
}
|
52
58
|
end
|
53
59
|
|
54
60
|
def policy_record
|
55
|
-
released_version&.
|
61
|
+
released_version&.environment
|
56
62
|
end
|
57
63
|
|
58
64
|
private
|
data/lib/pact_broker/app.rb
CHANGED
@@ -29,6 +29,7 @@ require "pact_broker/api/middleware/configuration"
|
|
29
29
|
require "pact_broker/api/middleware/basic_auth"
|
30
30
|
require "pact_broker/config/basic_auth_configuration"
|
31
31
|
require "pact_broker/api/authorization/resource_access_policy"
|
32
|
+
require "pact_broker/api/middleware/http_debug_logs"
|
32
33
|
|
33
34
|
module PactBroker
|
34
35
|
|
@@ -174,6 +175,7 @@ module PactBroker
|
|
174
175
|
end
|
175
176
|
|
176
177
|
def configure_middleware
|
178
|
+
@app_builder.use PactBroker::Api::Middleware::HttpDebugLogs if configuration.http_debug_logging_enabled
|
177
179
|
configure_basic_auth
|
178
180
|
configure_rack_protection
|
179
181
|
@app_builder.use Rack::PactBroker::InvalidUriProtection
|
@@ -39,7 +39,8 @@ module PactBroker
|
|
39
39
|
log_format: nil,
|
40
40
|
warning_error_class_names: ["Sequel::ForeignKeyConstraintViolation"],
|
41
41
|
hide_pactflow_messages: false,
|
42
|
-
log_configuration_on_startup: true
|
42
|
+
log_configuration_on_startup: true,
|
43
|
+
http_debug_logging_enabled: false
|
43
44
|
)
|
44
45
|
|
45
46
|
on_load :validate_logging_attributes!
|
@@ -70,7 +71,8 @@ module PactBroker
|
|
70
71
|
badge_provider_mode: :redirect,
|
71
72
|
enable_public_badge_access: false,
|
72
73
|
shields_io_base_url: "https://img.shields.io",
|
73
|
-
use_case_sensitive_resource_names: true
|
74
|
+
use_case_sensitive_resource_names: true,
|
75
|
+
pact_content_diff_timeout: 15
|
74
76
|
)
|
75
77
|
|
76
78
|
# domain attributes
|
@@ -43,19 +43,26 @@ module PactBroker
|
|
43
43
|
)
|
44
44
|
end
|
45
45
|
|
46
|
-
def conflict_notices(parsed_contracts)
|
46
|
+
def conflict_notices(parsed_contracts, base_url: )
|
47
47
|
notices = []
|
48
|
+
add_pact_conflict_notices(notices, parsed_contracts)
|
49
|
+
add_pacticipant_conflict_notices(notices, parsed_contracts, base_url)
|
50
|
+
notices
|
51
|
+
end
|
52
|
+
|
53
|
+
def add_pact_conflict_notices(notices, parsed_contracts)
|
48
54
|
parsed_contracts.contracts.collect do | contract_to_publish |
|
49
55
|
pact_params = create_pact_params(parsed_contracts, contract_to_publish)
|
50
56
|
existing_pact = pact_service.find_pact(pact_params)
|
51
57
|
if existing_pact && pact_service.disallowed_modification?(existing_pact, contract_to_publish.decoded_content)
|
52
|
-
|
58
|
+
add_pact_conflict_notice(notices, parsed_contracts, contract_to_publish, existing_pact.json_content, contract_to_publish.decoded_content)
|
53
59
|
end
|
54
60
|
end
|
55
|
-
notices
|
56
61
|
end
|
57
62
|
|
58
|
-
|
63
|
+
private :add_pact_conflict_notices
|
64
|
+
|
65
|
+
def add_pact_conflict_notice(notices, parsed_contracts, contract_to_publish, existing_json_content, new_json_content)
|
59
66
|
message_params = {
|
60
67
|
consumer_name: contract_to_publish.provider_name,
|
61
68
|
consumer_version_number: parsed_contracts.pacticipant_version_number,
|
@@ -65,7 +72,18 @@ module PactBroker
|
|
65
72
|
notices << Notice.info(PactBroker::Pacts::CreateFormattedDiff.call(new_json_content, existing_json_content))
|
66
73
|
end
|
67
74
|
|
68
|
-
private :
|
75
|
+
private :add_pact_conflict_notice
|
76
|
+
|
77
|
+
def add_pacticipant_conflict_notices(notices, parsed_contracts, base_url)
|
78
|
+
if PactBroker.configuration.check_for_potential_duplicate_pacticipant_names
|
79
|
+
duplicate_pacticipant_messages = pacticipant_service.messages_for_potential_duplicate_pacticipants(parsed_contracts.pacticipant_names, base_url)
|
80
|
+
duplicate_pacticipant_messages.each do | message_text |
|
81
|
+
notices << Notice.error(message_text)
|
82
|
+
end
|
83
|
+
end
|
84
|
+
end
|
85
|
+
|
86
|
+
private :add_pacticipant_conflict_notices
|
69
87
|
|
70
88
|
def create_version(parsed_contracts)
|
71
89
|
version_params = {
|
@@ -39,53 +39,28 @@ module PactBroker
|
|
39
39
|
end
|
40
40
|
|
41
41
|
def latest_tags
|
42
|
-
|
43
|
-
Sequel[:tags][:pacticipant_id] => Sequel[:tags_2][:pacticipant_id],
|
44
|
-
Sequel[:tags][:name] => Sequel[:tags_2][:name]
|
45
|
-
}
|
46
|
-
|
47
|
-
PactBroker::Domain::Tag
|
42
|
+
Tag
|
48
43
|
.select_all_qualified
|
49
|
-
.
|
50
|
-
Sequel[:tags_2][:version_order] > Sequel[:tags][:version_order]
|
51
|
-
end
|
52
|
-
.where(Sequel[:tags_2][:name] => nil)
|
44
|
+
.max_group_by(:version_order, [:pacticipant_id, :name])
|
53
45
|
end
|
54
46
|
|
55
47
|
# Does NOT care about whether or not there is a pact publication
|
56
48
|
# for the version
|
57
49
|
def latest_tags_for_pacticipant_ids(pacticipant_ids)
|
58
|
-
self_join = {
|
59
|
-
Sequel[:tags][:pacticipant_id] => Sequel[:tags_2][:pacticipant_id],
|
60
|
-
Sequel[:tags][:name] => Sequel[:tags_2][:name],
|
61
|
-
Sequel[:tags_2][:pacticipant_id] => pacticipant_ids,
|
62
|
-
}
|
63
|
-
|
64
50
|
Tag
|
65
51
|
.select_all_qualified
|
66
|
-
.
|
67
|
-
Sequel[:
|
52
|
+
.max_group_by(:version_order, [:pacticipant_id, :name]) do | ds |
|
53
|
+
ds.where(Sequel[:tags][:pacticipant_id] => pacticipant_ids)
|
68
54
|
end
|
69
|
-
.where(Sequel[:tags_2][:name] => nil)
|
70
|
-
.where(Sequel[:tags][:pacticipant_id] => pacticipant_ids)
|
71
55
|
end
|
72
56
|
|
73
57
|
def latest_tags_for_pacticipant_ids_and_tag_names(pacticipant_ids, tag_names)
|
74
|
-
self_join = {
|
75
|
-
Sequel[:tags][:pacticipant_id] => Sequel[:tags_2][:pacticipant_id],
|
76
|
-
Sequel[:tags][:name] => Sequel[:tags_2][:name],
|
77
|
-
Sequel[:tags_2][:pacticipant_id] => pacticipant_ids,
|
78
|
-
Sequel[:tags_2][:name] => tag_names
|
79
|
-
}
|
80
|
-
|
81
58
|
Tag
|
82
59
|
.select_all_qualified
|
83
|
-
.
|
84
|
-
Sequel[:
|
60
|
+
.max_group_by(:version_order, [:pacticipant_id, :name]) do | ds |
|
61
|
+
ds.where(Sequel[:tags][:name] => tag_names)
|
62
|
+
.where(Sequel[:tags][:pacticipant_id] => pacticipant_ids)
|
85
63
|
end
|
86
|
-
.where(Sequel[:tags_2][:name] => nil)
|
87
|
-
.where(Sequel[:tags][:pacticipant_id] => pacticipant_ids)
|
88
|
-
.where(Sequel[:tags][:name] => tag_names)
|
89
64
|
end
|
90
65
|
|
91
66
|
# ignores tags that don't have a pact publication
|
@@ -110,6 +85,7 @@ module PactBroker
|
|
110
85
|
.join(lp, versions_pact_publications_join)
|
111
86
|
end
|
112
87
|
|
88
|
+
# TODO convert this to use max and join
|
113
89
|
def head_tags_for_pact_publication(pact_publication)
|
114
90
|
Tag.where(version_id: pact_publication.consumer_version_id).all.select do | tag |
|
115
91
|
tag_pp_join = {
|