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

No new version of Provider published #576

Closed
1 of 2 tasks
m-radzikowski opened this issue Jan 14, 2021 · 4 comments
Closed
1 of 2 tasks

No new version of Provider published #576

m-radzikowski opened this issue Jan 14, 2021 · 4 comments

Comments

@m-radzikowski
Copy link

Issue Classification

  • Feature request
  • Bug report

Bug Report

Software versions

  • Pact library: @pact-foundation/pact 9.14.0
  • Node Version: 12

Behaviour

I'm implementing the CI/CD flow for the Pact Provider and Consumer and I have 2 problems, maybe somehow related.

The CI/CD is common for both services, but some steps do not run if not needed. The flow is:

  • build app
  • pact test (runs only for Consumer)
  • pact publish (runs only for Consumer)
  • deploy app to env
  • pact verify (runs only for Provider)
  • pact create version tag
  • pact broker can-i-deploy to check if it can be deployed to the next environment

This is slightly different from the flow in docs, but needed to make compromises.

Now, I try to deploy both Provider and Consumer for the first time. I'm using pactflow as a broker, which is initially empty.

When I run CI for the Provider, it breaks on can-i-deploy, because no contracts are available yet.

$ ts-node pactVerifier.ts
250 | [2021-01-14T10:22:38.726Z]  INFO: [email protected]/665 on 2a9fb392732c: Verifying provider
251 | [2021-01-14T10:22:38.734Z]  INFO: [email protected]/665 on 2a9fb392732c: Verifying Pacts.
252 | [2021-01-14T10:22:38.735Z]  INFO: [email protected]/665 on 2a9fb392732c: Verifying Pact Files
253 | [2021-01-14T10:22:41.829Z]  INFO: [email protected]/665 on 2a9fb392732c: Pact Verification succeeded.

$ /...path/node_modules/.bin/pact-broker can-i-deploy -a 'My Provider' -b https://company.pactflow.io -k secret --to dne-132 --version 1.0.0-4fd8338f4927bb26430300fb0c90c1c58a866c48
272 | Computer says no ¯\_(ツ)_/¯
273 |  
274 | No pacts or verifications have been published for version 1.0.0-4fd8338f4927bb26430300fb0c90c1c58a866c48 of My Provider

I was looking into pact broker repo and found this issue and this commit that seem to solve this problem, but yet I'm still facing it.

So what I did was:

  1. Deploy Provider - runs verify but fails on can-i-deploy (log above)
  2. Deploy Consumer - publishes contracts but also fails on can-i-deploy
  3. Re-deploy provider - now can-i-deploy passes

Then I merged Provider to master which triggered a new build. I expected it to do the verification and pass. But for some reason, although in VerifierOptions I have publishVerificationResult: true, it seems like the new version was not published to pactflow. In UI I don't see the new version (there is only the one with pre-merge commit, the one with merge commit is missing), and the CI/CD failed on adding a tag:

243 | [2021-01-14T15:18:55.182Z]  INFO: [email protected]/665 on 35ef670ecd55: Verifying provider
244 | [2021-01-14T15:18:55.192Z]  INFO: [email protected]/665 on 35ef670ecd55: Verifying Pacts.
245 | [2021-01-14T15:18:55.194Z]  INFO: [email protected]/665 on 35ef670ecd55: Verifying Pact Files
246 | [2021-01-14T15:18:58.423Z]  INFO: [email protected]/665 on 35ef670ecd55: Pact Verification succeeded.

...

264 | $ /...path/node_modules/.bin/pact-broker create-version-tag -a 'My Provider' -b https://company.pactflow.io -k secret --version 1.0.0-97e77f7d0a5a3326f37cb735def87470aa663be4 --tag test

269 | Could not create tag. Version 1.0.0-97e77f7d0a5a3326f37cb735def87470aa663be4 of My Provider does not exist.

So, I guess my problem is partially about pact broker, partially about pact-js and publishing verifier results, and maybe partially about the CI/CD flow. Can you point me to what can be the problem(s) here?

@bethesque
Copy link
Member

We need more logs from the merge build to see if/why/why not the verification results from that merge build were published. Do you have the output from the build that worked that showed the tags being created and the results being published?

@m-radzikowski
Copy link
Author

Ok, you know, I created a simple reproduction repo of the problems I'm facing. In fact, I have problems with verifying the Provider for the first time. I think the fact I didn't see the Provider version update could be my fault with how I have tags set up.

The repo with reproduction and description of problems with deploying Provider for the first time: https://github.com/m-radzikowski/pact-js-issue576

Please tell me if I should create a separate ticket for it in a different repo (or move it if needed and possible).

@bethesque
Copy link
Member

Create a separate ticket in the Pact Broker repository please.

@m-radzikowski
Copy link
Author

Created: pact-foundation/pact_broker#372

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

2 participants