Skip to content

Commit

Permalink
feat: allow consumer version selector JSON to be provided with an env…
Browse files Browse the repository at this point in the history
…ironment variable
  • Loading branch information
rholshausen committed Jun 21, 2022
1 parent 05309c1 commit de753fc
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,7 @@ open class PactBrokerClient(
else -> null
}
return if (pactsForVerification != null) {
val selectorsRawJson = System.getProperty("pactbroker.consumerversionselectors.rawjson")
val selectorsRawJson = lookupEnvironmentValue("pactbroker.consumerversionselectors.rawjson")
if(!selectorsRawJson.isNullOrBlank()){
fetchPactsUsingNewEndpointRaw(selectorsRawJson, enablePending, providerTags, providerBranch, includeWipPactsSince, halClient, pactsForVerification, providerName)
} else {
Expand Down
21 changes: 11 additions & 10 deletions provider/gradle/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,16 +98,17 @@ The following project properties can be specified with `-Pproperty=value` on the

The following project properties must be specified as system properties:

|Property|Description|
|--------|-----------|
|`pact.verifier.disableUrlPathDecoding`|Disables decoding of request paths|
|`pact.pactbroker.httpclient.usePreemptiveAuthentication`|Enables preemptive authentication with the pact broker when set to `true`|
|`pact.provider.tag`|Sets the provider tag to push before publishing verification results (can use a comma separated list)|
|`pact.provider.branch`|Sets the provider branch to push before publishing verification results|
|`pact.content_type.override.<TYPE>.<SUBTYPE>=<VAL>` where `<VAL>` may be `text`, `json` or `binary`|Overrides the handling of a particular content type [4.1.3+]|
|`pact.verifier.enableRedirectHandling`|Enables automatically handling redirects [4.1.8+]|
|`pact.verifier.generateDiff`|Controls the generation of diffs. Can be set to `true`, `false` or a size threshold (for instance `1mb` or `100kb`) which only enables diffs for payloads of size less than that [4.2.7+]|
|`pact.verifier.buildUrl`|Specifies buildUrl to report to the broker when publishing verification results [4.2.16/4.3.2+]|
| Property | Description |
|-----------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------|
| `pact.verifier.disableUrlPathDecoding` | Disables decoding of request paths |
| `pact.pactbroker.httpclient.usePreemptiveAuthentication` | Enables preemptive authentication with the pact broker when set to `true` |
| `pact.provider.tag` | Sets the provider tag to push before publishing verification results (can use a comma separated list) |
| `pact.provider.branch` | Sets the provider branch to push before publishing verification results |
| `pact.content_type.override.<TYPE>.<SUBTYPE>=<VAL>` where `<VAL>` may be `text`, `json` or `binary` | Overrides the handling of a particular content type [4.1.3+] |
| `pact.verifier.enableRedirectHandling` | Enables automatically handling redirects [4.1.8+] |
| `pact.verifier.generateDiff`|Controls the generation of diffs. Can be set to `true`, `false` or a size threshold (for instance `1mb` or `100kb`) which only enables diffs for payloads of size less than that [4.2.7+] |
| `pact.verifier.buildUrl` | Specifies buildUrl to report to the broker when publishing verification results [4.2.16/4.3.2+] |
| `pactbroker.consumerversionselectors.rawjson` | Overrides the consumer version selectors with raw JSON [4.1.29+/4.3.0+] |

## Specifying the provider hostname at runtime

Expand Down
1 change: 1 addition & 0 deletions provider/junit/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,7 @@ The following keys may be managed through the environment
* `pactbroker.auth.password` (for basic auth)
* `pactbroker.auth.token` (for bearer auth)
* `pactbroker.consumers` (comma separated list to filter pacts by consumer; if not provided, will fetch all pacts for the provider)
* `pactbroker.consumerversionselectors.rawjson` (overrides the selectors with the RAW JSON)


#### Using tags with the pact broker
Expand Down
33 changes: 17 additions & 16 deletions provider/maven/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -287,22 +287,23 @@ correctly encoded. The verifier will not be able to make a request with an inval

The following plugin properties can be specified with `-Dproperty=value` on the command line or in the configuration section:

|Property|Description|
|--------|-----------|
|`pact.showStacktrace`|This turns on stacktrace printing for each request. It can help with diagnosing network errors|
|`pact.showFullDiff`|This turns on displaying the full diff of the expected versus actual bodies|
|`pact.filter.consumers`|Comma separated list of consumer names to verify|
|`pact.filter.description`|Only verify interactions whose description match the provided regular expression|
|`pact.filter.providerState`|Only verify interactions whose provider state match the provided regular expression. An empty string matches interactions that have no state|
|`pact.filter.pacturl`|This filter allows just the just the changed pact specified in a webhook to be run. It should be used in conjunction with `pact.filter.consumers`|
|`pact.verifier.publishResults`|Publishing of verification results will be skipped unless this property is set to `true` [version 3.5.18+]|
|`pact.verifier.disableUrlPathDecoding`|Disables decoding of request paths|
|`pact.pactbroker.httpclient.usePreemptiveAuthentication`|Enables preemptive authentication with the pact broker when set to `true`|
|`pact.consumer.tags`|Overrides the tags used when publishing pacts [version 4.0.7+]|
|`pact.content_type.override.<TYPE>.<SUBTYPE>=text\|json\|binary`|Overrides the handling of a particular content type [version 4.1.3+]|
|`pact.verifier.enableRedirectHandling`|Enables automatically handling redirects [4.1.8+]|
|`pact.verifier.generateDiff`|Controls the generation of diffs. Can be set to `true`, `false` or a size threshold (for instance `1mb` or `100kb`) which only enables diffs for payloads of size less than that [4.2.7+]|
|`pact.verifier.buildUrl`|Specifies buildUrl to report to the broker when publishing verification results [4.3.2+]|
| Property | Description |
|----------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `pact.showStacktrace` | This turns on stacktrace printing for each request. It can help with diagnosing network errors |
| `pact.showFullDiff` | This turns on displaying the full diff of the expected versus actual bodies |
| `pact.filter.consumers` | Comma separated list of consumer names to verify |
| `pact.filter.description` | Only verify interactions whose description match the provided regular expression |
| `pact.filter.providerState` | Only verify interactions whose provider state match the provided regular expression. An empty string matches interactions that have no state |
| `pact.filter.pacturl` | This filter allows just the just the changed pact specified in a webhook to be run. It should be used in conjunction with `pact.filter.consumers` |
| `pact.verifier.publishResults` | Publishing of verification results will be skipped unless this property is set to `true` [version 3.5.18+] |
| `pact.verifier.disableUrlPathDecoding` | Disables decoding of request paths |
| `pact.pactbroker.httpclient.usePreemptiveAuthentication` | Enables preemptive authentication with the pact broker when set to `true` |
| `pact.consumer.tags` | Overrides the tags used when publishing pacts [version 4.0.7+] |
| `pact.content_type.override.<TYPE>.<SUBTYPE>=text\ | json\ |binary`|Overrides the handling of a particular content type [version 4.1.3+]|
| `pact.verifier.enableRedirectHandling` | Enables automatically handling redirects [4.1.8+] |
| `pact.verifier.generateDiff` | Controls the generation of diffs. Can be set to `true`, `false` or a size threshold (for instance `1mb` or `100kb`) which only enables diffs for payloads of size less than that [4.2.7+] |
| `pact.verifier.buildUrl` | Specifies buildUrl to report to the broker when publishing verification results [4.3.2+] |
| `pactbroker.consumerversionselectors.rawjson` | Overrides the consumer version selectors with raw JSON [4.1.29+/4.3.0+] |

Example in the configuration section:

Expand Down

0 comments on commit de753fc

Please sign in to comment.