Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create can-i-deploy maven plugin #994

Closed
bethesque opened this issue Dec 16, 2019 · 10 comments
Closed

Create can-i-deploy maven plugin #994

bethesque opened this issue Dec 16, 2019 · 10 comments

Comments

@bethesque
Copy link
Member

Great first issue for a beginner! @ me if you're reading this and are interested in an easy little OSS contribution.

@araknoid
Copy link

araknoid commented Jan 4, 2020

Hi @bethesque ,
since I've found a lot of value in using Pact, I'd like to contribute.
I'd like to take this issue if it's possible.
If yes, can you please give me some details?
Thanks

@bethesque
Copy link
Member Author

bethesque commented Jan 4, 2020

Awesome! You're very welcome to do this one, but there is one that's of a higher importance and urgency if you're interested. I don't think it will be too hard to do, but you'll need to do a bit of digging to understand how the code is currently working. I can give you some pointers, but I'm not one of the pact-jvm maintainers, so I'll only be a slight bit ahead of you anyway.

#942 (follow the link through to the master issue)

@araknoid
Copy link

Sorry for the delay.
Fine by me; I'll start looking at the other issue.
If you have any pointers/details that could make easier to understand what is needed and what is missing, I'll gladly welcome them.

@uglyog
Copy link
Member

uglyog commented Jan 26, 2020

Basic version working:

$ mvn pact:can-i-deploy -Dpacticipant='Foo Web Client'  -DpacticipantVersion=1.0.2 -DtoTag=prod
[INFO] Scanning for projects...
[INFO] 
[INFO] ------------------------------------------------------------------------
[INFO] Building pact-gradle-test 1.0.0
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] --- pact-jvm-provider-maven:4.0.5:can-i-deploy (default-cli) @ pact-gradle-test ---
Computer says no ¯\_(ツ)_/¯ 

There is no verified pact between version 1.0.2 of Foo Web Client and the latest version of Activity Service with tag prod (no such version exists)
There is no verified pact between version 1.0.2 of Foo Web Client and the latest version of Activity Service with tag prod (no such version exists)
There is no verified pact between version 1.0.2 of Foo Web Client and the latest version of Activity Service with tag prod (no such version exists)
There is no verified pact between version 1.0.2 of Foo Web Client and the latest version of Activity Service with tag prod (no such version exists)
There is no verified pact between version 1.0.2 of Foo Web Client and the latest version of Activity Service with tag prod (no such version exists)
There is no verified pact between version 1.0.2 of Foo Web Client and the latest version of Activity Service with tag prod (no such version exists)
There is no verified pact between version 1.0.2 of Foo Web Client and the latest version of Activity Service with tag prod (no such version exists)
There is no verified pact between version 1.0.2 of Foo Web Client and the latest version of Activity Service with tag prod (no such version exists)
There is no verified pact between version 1.0.2 of Foo Web Client and the latest version of Activity Service with tag prod (no such version exists)
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.863 s
[INFO] Finished at: 2020-01-26T16:57:10+11:00
[INFO] Final Memory: 17M/74M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal au.com.dius:pact-jvm-provider-maven:4.0.5:can-i-deploy (default-cli) on project pact-gradle-test: Can you deploy? Computer says no ¯\_(ツ)_/¯  -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException

@uglyog
Copy link
Member

uglyog commented Jan 26, 2020

Version 4.0.5 has been released with this change

@bethesque
Copy link
Member Author

I checked the code, and there is an extra parameter that needs adding - it won't work in its current form. The matrix endpoint started as a generalised "show me these versions and these versions together" and then later had the "and can they be deployed together safely" added, so the parameters are a little obscure. I wrote some docs on the matrix "selectors" here: https://docs.pact.io/pact_broker/advanced_topics/selectors

You'll need to add the top level parameter latestby=cvp, or you'll get every row for the version you're about to deploy, rather than the latest row for each provider. This will make the deployable flag incorrect.

If the user doesn't specify a --to TAG then you'll need a plain latest=true top level parameter, otherwise, it will include multiple rows for each provider, and make the deployable flag incorrect again.

The pacts for the matrix endpoint are here: https://github.com/pact-foundation/pact_broker-client/blob/master/spec/pacts/pact_broker_client-pact_broker.json

The other option is to use the simplified can-i-deploy endpoint which has only been released recently (so will force people to upgrade). The docs are here: https://github.com/pact-foundation/pact_broker/blob/master/lib/pact_broker/doc/views/can-i-deploy.markdown

Note that this does not support the --latest for the pacticipant you're about to deploy, which personally, I don't think should be needed. Someone should know which version they're deploying, and relying on the broker to know which the latest one seems dicey.

@bethesque
Copy link
Member Author

You can see the effect of the 'latestby' by viewing the matrix for a integration, and changing the Show latest results by ... option.

@uglyog
Copy link
Member

uglyog commented Feb 22, 2020

4.0.6 has been released with the updated fix (latestby query parameter)

@bethesque
Copy link
Member Author

LGTM. Is the pact being published anywhere?

@uglyog
Copy link
Member

uglyog commented Feb 23, 2020

Don't think so

@uglyog uglyog closed this as completed Mar 8, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants