-
-
Notifications
You must be signed in to change notification settings - Fork 178
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: include tag and consumer version number in metadata parameter o…
…f verification creation URL when verifying latest pact for a tag
- Loading branch information
Showing
7 changed files
with
89 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
module PactBroker | ||
module Pacts | ||
module Metadata | ||
extend self | ||
|
||
# When verifying a pact at /.../latest/TAG, this stores the | ||
# tag and the current consumer version number in the | ||
# metadata parameter of the URL for publishing the verification results. | ||
# This is part of ensuring that verification results webhooks | ||
# go back to the correct consumer version number (eg for git statuses) | ||
def build_metadata_for_latest_pact(pact, selection_parameters) | ||
if selection_parameters[:tag] | ||
{ | ||
consumer_version_tags: selection_parameters[:tag], | ||
consumer_version_number: pact.consumer_version_number | ||
} | ||
else | ||
{ | ||
consumer_version_number: pact.consumer_version_number | ||
} | ||
end | ||
end | ||
|
||
# When a pact is published, and a webhook is triggered, this stores | ||
# the current tags and consumer version number in the metadata parameter of the | ||
# pact version URL that is made available in the webhook template | ||
# parameters. This is part of ensuring that verification results webhooks | ||
# go back to the correct consumer version number (eg for git statuses) | ||
def build_metadata_for_webhook_triggered_by_pact_publication(pact) | ||
{ | ||
consumer_version_number: pact.consumer_version_number, | ||
consumer_version_tags: pact.consumer_version_tag_names | ||
} | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters