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

docs: CI/CD update - branches / contract_requiring_verification_published webhook #149

Merged
merged 29 commits into from
Oct 21, 2022

Conversation

YOU54F
Copy link
Member

@YOU54F YOU54F commented Oct 4, 2022

Update Pactflow CI/CD Workshop

  • update to use contract_requiring_verification_published event/webhook
  • update to use branches over tags
  • rename workshop to Consumer-Driven Contract Testing (to contrast against Bi-Directional Contract Testing) workshops
  • some other niceties (file locations, git commit commands)

@YOU54F YOU54F changed the title docs: CI/CD update to use contract_requiring_verification_published event docs: CI/CD update - branches / contract_requiring_verification_published webhook Oct 4, 2022
@@ -1,6 +1,6 @@
---
id: ci-cd
title: Pactflow CI/CD Workshop
title: Consumer-Driven Contract Testing Workshop
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good call to clarify this now we have two different workflows. Can we make it "Consumer-Driven Contract Testing CI/CD Workshop"? Or "Consumer-Driven Contract Testing Workflow Workshop" (that one is a bit of a W mouth-full though). The point of this one is to show users how CDC fits into the pipeline, not just how to do consumer driven contract testing.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

gone for

  • Consumer-Driven Contract Testing CI/CD Workshop
  • Consumer-Driven Contract Testing CI/CD Workshop (Legacy)

@bethesque
Copy link
Contributor

Hoorah for this update happening!

@YOU54F
Copy link
Member Author

YOU54F commented Oct 7, 2022

Hey @Ilia

I've addressed these

  1. [Minor] Setup deployment environment - "Settings > Environments", its more a UX issue, but there was no "settings", there was a gear icon, maybe worth including that as an imagine in the docs
  2. [Minor] Setup deployment environment - "production" environment, since I had a brand new setup, I already had a production environment, and thought for some reason it will allow me to create another, but it didnt and showed an error, at this stage I wasnt sure if I could re-use the one there, OR i should delete and create another
  3. [Minor] Configure consumer pipeline - we could instruct the user to just update the files in Github Editor and commit, potentially saving the step of cloning locally and running npm (unsure though if this is required in the next steps)
  4. [Minor] Configure consumer pipeline - step 2, once github picked up the commit, my build errored, i thought I did something wrong, but it actually should still error. I know the text indicates that it should, but maybe a warning box may be good, as this This build should now successfully publish the pact, but it will fail on the can-i-deploy step before it tries to deploy gets lost

Not done this one yet, but it's not a bad shout, having it as a secret means the user can just add it during the pb token step 👍🏾

  1. [Minor] Configure provider pipeline - There are TWO workflow files - we could simplify this with a shared env across workflows, there is some docs here https://arinco.com.au/blog/github-actions-share-environment-variables-across-workflows/ or maybe even have it as a secret, which is shared across all workflows - more a recommendation

@bethesque
Copy link
Contributor

There are TWO workflow files - we could simplify this with a shared env across workflows,

Sometimes duplicated+simple is better than shared+moreComplicated ;)

* the latest version from the provider's main branch
* any version currently deployed to an environment

This is achieved by passing the URL of the changed pact to the build via a parameter in the body of the webhook request, as well as the provider version number and the provider branch of the head, test and production versions.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

head -> main

* Consumer: leave as "ALL"
* Provider: select `pactflow-example-provider`
* Events: select `Contract published with changed content or tags`
* Events: select `Contract published that requires verification`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

woot!

Before starting the consumer, create a `.env` file in the root of the project and add:
Before starting the consumer, we need to configure it so it knows the address of our running provider.

create a `.env` file in the root of the project and add:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Create


A "work in progress" pact is a pact that is the latest for its tag that does not have any successful verification results (ie. is still pending) for the configured provider tag . At this stage in the exercise, the `feat/new-field` pact is still in pending state for the `master` branch of the provider, so it is considered a "work in progress" pact for master.
A "work in progress" pact is a pact that is the latest for its branch that does not have any successful verification results (ie. is still pending) for the configured provider branch . At this stage in the exercise, the `feat/new-field` pact is still in pending state for the main branch of the provider, so it is considered a "work in progress" pact for `master`.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's slightly more complicated than this now. My brain is not working so I'll come back to this.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now I think about it, it's not worth confusing people with the full technical details of how WIP pacts are selected at this stage. What you've got is 👍🏽

@bethesque
Copy link
Contributor

This makes me so happy!!!! 🎉

@netlify
Copy link

netlify bot commented Oct 21, 2022

Deploy Preview for docs-pactflow-preview ready!

Name Link
🔨 Latest commit f150f67
🔍 Latest deploy log https://app.netlify.com/sites/docs-pactflow-preview/deploys/635285f3b7723600082282e9
😎 Deploy Preview https://deploy-preview-149--docs-pactflow-preview.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@YOU54F
Copy link
Member Author

YOU54F commented Oct 21, 2022

Will merge it and go through with the SE team next week for some user feedback :)

@YOU54F YOU54F merged commit 0b2a399 into master Oct 21, 2022
@YOU54F YOU54F mentioned this pull request Oct 21, 2022
@YOU54F YOU54F deleted the cicd_branches_environments branch January 24, 2023 18:31
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

Successfully merging this pull request may close these issues.

None yet

3 participants