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

feat: support recording deployments #389

Merged
merged 11 commits into from
Feb 23, 2021
Merged

feat: support recording deployments #389

merged 11 commits into from
Feb 23, 2021

Conversation

bethesque
Copy link
Member

@bethesque bethesque commented Feb 14, 2021

  • Support querying can-i-deploy with an environment name
    • The Pact CLI now supports (not yet released) pact-broker can-i-deploy --pacticipant Foo --version 1 --to-environment test
  • Support recording deployments
    • to be called via Pact CLI as pact-broker record-deployment --pacticipant Foo --version 1 --environment test (not yet written).
    • The endpoint to call to record the deployment is available in the pacticipant version relations (the pb:record-deployment relation with the matching environment name).
    • By default, the CLI will assume that the current deployment replaces the previous, and send { replacedPreviousDeployedVersion: true } with the "record deployment" post request, and the previous deployed version will be marked as undeployed in the broker.
    • When --no-replace-previous-deployed-version is specified in the CLI, the call to record the deployment will specify { replacedPreviousDeployedVersion: false } and the previous deployed version will not be marked as undeployed.
    • This will allow us to
      • know exactly which versions of an app are in an environment (unlike tags, where we don't know if "all prod" or "latest prod" are currently deployed).
      • measure the time between deployments to provide better metrics
  • Update the matrix UI to show the environment field
  • Seed the broker on start up with "test" and "production" environments
  • Update the seeded data to have deployments as well as tags (todo: remove the tags once the UI is done)

Next

  • show the environments in the index/matrix pages
  • provide a migration path from tags to deployed versions (mostly so we can get retrospective data in PF).

@bethesque bethesque marked this pull request as draft February 14, 2021 22:18
@bethesque bethesque marked this pull request as ready for review February 22, 2021 21:55
@@ -34,6 +33,10 @@ def self.find_by_name(name)
def self.delete(uuid)
PactBroker::Deployments::Environment.where(uuid: uuid).delete
end

def self.find_for_pacticipant(pacticipant)
Copy link
Member

Choose a reason for hiding this comment

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

Not using the pacticipant?

Copy link
Member Author

Choose a reason for hiding this comment

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

Well spotted - that's a dummy method for Pactflow to override by supplying a different service. In the OSS version, any pacticipant can deploy to any environment (mostly because I don't want to have to develop a configuration page 😆 ), but in Pactflow, I envisage us supporting assigning particular environments to pacticipants.

@bethesque bethesque merged commit 19ac1fc into master Feb 23, 2021
@bethesque bethesque deleted the feat/deployed-version branch February 23, 2021 08:41
@mefellows
Copy link
Member

I didn't look at the code Beth, but I can agree that this is awesomeness.

@bethesque
Copy link
Member Author

It's ok, Ron's got the 🦅 eyes. Just wanted to get you across the upcoming features.

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.

3 participants