GuidesAPI Reference
Log In

Deployments on GitHub Actions

🚧

You do not have to do this if you are using Prodvana to deploy

This doc is for anyone who is not currently using Prodvana for deployment, but would still like to take advantage of Clairvoyance. If you are using Prodvana, deployments are recorded automatically.

If you deploy your services via GitHub Actions, you can use our Actions to record deployments to Clairvoyance.

  1. Make an API token.
    1. Install pvnctl and authenticate it.
    2. Create an API Token.
  2. Add the following to your GitHub Actions workflow that does the deployment.
steps:
  - uses: prodvana/[email protected]
    with:
      org: my-org
      api_token: ${{ secrets.YOUR_PRODVANA_API_TOKEN }}
  - uses: prodvana/[email protected]
    id: record-deployment  # this allows referencing the output of this action later
    with:
      app: my-app  # e.g. product name
      service: my-service  # e.g. web, api
      release_channel: prod  # e.g. staging, prod, staging-eu
      pending: true  # this marks the deployment as pending to be updated by a later step
  # do actual deployment
  # for example
  - name: Deploy code
    shell: bash
    run: |
      kubectl apply -f my-config.yaml
  # then add these finalizers at the end to update the status of your deployment
  - uses: prodvana/[email protected]
    with:
      deployment_id: ${{ steps.record-deployment.outputs.deployment_id }}
  - uses: prodvana/[email protected]
    if: failure()
    with:
      deployment_id: ${{ steps.record-deployment.outputs.deployment_id }}
      failed: true

If your GitHub Actions workflow does not allow you to easily add the finalizer, you can also use record-deployment-action on its own without setting pending. Note that in this case, you will not be able to differentiate between successful and failed deployments.

steps:
  - uses: prodvana/[email protected]
    with:
      org: my-org
      api_token: ${{ secrets.YOUR_PRODVANA_API_TOKEN }}
  - uses: prodvana/[email protected]
    with:
      app: my-app  # e.g. product name
      service: my-service  # e.g. web, api
      release_channel: prod  # e.g. staging, prod, staging-eu
  # do actual deployment
  # for example
  - name: deploy code
    shell: bash
    run: |
      kubectl apply -f my-config.yaml

For an end-to-end comprehensive example, please check out our demo repository.