Skip to content

Lifecycle

Cyril Rohr edited this page Feb 10, 2021 · 2 revisions

When you add the pullpreview label to a PR, this is what happens, assuming you have correctly set up your workflow file:

  • A GitHub Action workflow is triggered: your repository code is checked out at the exact reference used by your PR.
  • If no existing instance exists for that PR, a new instance is provisioned on AWS Lightsail.
  • When the instance is ready, your code is synchronised to the instance. This uses ephemeral SSH credentials that are automatically expired.
  • docker-compose is run on the instance. This builds and runs your application.
  • If the deployment is successful, the preview URL is added at the bottom of your PR, and is also visible in the Deployments page of your repository. In the GitHub Action logs for the workflow, you can also find the details to SSH into the instance, as well as the preview URL.
  • If the deployment has failed, the failure is reported into the Checks section at the bottom of your PR.

After the first deployment:

  • a new deployment will be triggered every time you push new code to the branch of your PR, but only if those changes are mergeable with the base branch. If you have conflicts, then PullPreview will not run.
  • if you remove the pullpreview label, the instance will be destroyed. If you then relabel the PR, the instance will be recreated from scratch.
  • if you close the PR, the instance is automatically removed, and the pullpreview label is removed.
  • if you merge the PR, the instance is automatically removed, and the pullpreview label is removed.