-
-
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: support creating version with branch (#371)
* wip: allow patch to version resource * feat: support PUT for creating version with branch and buildUrl * chore: correct the fields that are updated when using upsert * chore: add versions_pacticipant_id_branch_order_index * test: manually set created_at and updated_at for upsert test * test: upsert spec * feat: support WIP pacts for provider branch * refactor: clean up original wip pacts code * refactor: verifiable pact class * chore: set correct selectors * chore: implement sort for Selector with branch * feat: support provider branch in the response text for the 'pacts for verificaiton' api * feat: include wip pacts by consumer branch * chore: update wip pacts message for latest from branch * refactor: add method to PactPublication to find by consumer version selector * refactor: use PactPublication find for selector method to find pacts for verification * chore: support branches in http test data builder * tests: remove unncessary tests * refactor: make code climate happier * refactor: separate 'pacts for verification' code into separate class * test: add tests missed in previous commit * style: whitespace [ci-skip] * chore: remove unused method [ci-skip] * feat: add pb:pacticipant-version relation to index * chore: update feature toggle experimental_no_provider_versions_makes_all_head_pacts_wip handling * chore: update http test data builder [ci-skip] * chore: add script to demonstrate pacticipant branches [ci-skip] * chore: update GA test workflow
- Loading branch information
Showing
44 changed files
with
2,037 additions
and
404 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
Sequel.migration do | ||
change do | ||
alter_table(:versions) do | ||
add_column(:branch, String) | ||
add_column(:build_url, String) | ||
add_index([:pacticipant_id, :branch, :order], name: "versions_pacticipant_id_branch_order_index") | ||
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
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,27 @@ | ||
require 'pact_broker/api/resources/version' | ||
|
||
module PactBroker | ||
module Api | ||
module Resources | ||
class LatestVersion < Version | ||
def content_types_accepted | ||
[] | ||
end | ||
|
||
def allowed_methods | ||
["GET", "OPTIONS"] | ||
end | ||
|
||
private | ||
|
||
def version | ||
if identifier_from_path[:tag] | ||
@version ||= version_service.find_by_pacticipant_name_and_latest_tag(identifier_from_path[:pacticipant_name], identifier_from_path[:tag]) | ||
else | ||
@version ||= version_service.find_latest_by_pacticpant_name(identifier_from_path) | ||
end | ||
end | ||
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
13 changes: 13 additions & 0 deletions
13
lib/pact_broker/doc/views/index/pacticipant-version.markdown
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,13 @@ | ||
# Pacticipant version | ||
|
||
Allowed methods: `GET`, `PUT`, `DELETE` | ||
|
||
Path: `/pacticipants/{pacticipant}/versions/{version}` | ||
|
||
## Example | ||
|
||
PUT http://broker/pacticipants/Bar/versions/1e70030c6579915e5ff56b107a0fd25cf5df7464 | ||
{ | ||
"branch": "main", | ||
"buildUrl": "http://ci.mydomain/my-job/1" | ||
} |
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
Oops, something went wrong.