How It Works
When preview environments are configured for an application, Nullstone will create a webhook in the GitHub repo associated with that application.
It is configured to trigger the webhook for
Pull Request events. With this configuration, the Nullstone webhook will be called for all the events needed to operate preview environments. Some of these events are:
|Pull Request opened
|Create and launch preview environment
|Pull Request closed
|Destroy preview environment
|Pull Request reopened
|Create and destroy preview environment
|Commit to PR
|Deploy the latest code to the preview environment
Creating the Environment
When a PR is opened (or reopened) for a repo, Nullstone will create preview environments for each application linked to the GitHub repo. You can have multiple applications (from multiple stacks) linked to the same GitHub repo. For each of the stacks, a new environment will be created.
The name of the environment created is based on a combination of the PR name and the PR id. This ensures that the environment name remains unique for each PR. If the PR name is
f153 add user profile and the PR id is
1242475871, then the preview environment name will be:
f153-add-user-profile-1242475871. All the whitespace characters are replaced with dashes and the PR id is appended to the end.
To create the environment, Nullstone also needs to know which cloud account to use when launching. In the first step of setting up preview environments, we configured a cloud account and region for the stack. This account and region will be used for each preview environment created. This means all the infrastructure launched for all your preview environments will be in this same account and region.
As Nullstone launches your preview environments, the status is reported back to the GitHub PR. Status of both the infrastructure launch and the code deployment can be seen in the pull request checks.
Events that occur during the lifecycle of launching your preview environment are posted to the PR as comments. Included in these comments are links to the environment in Nullstone and to your application.
If preview environments are not being created or destroyed as expected, check for any new status checks or messages on the GitHub PR. As Nullstone is performing a launch or code deployment, it will either show successful status checks and messages or it will show failures and post error messages. These messages should provide enough guidance to help you debug the issue.
In the example below, an error occurred while deploying the code for this preview environment. The
Details link will take you to the Nullstone dashboard where you can view the logs for the deployment.
The second place to check are the
Recent Deliveries for the webhook. From the GitHub repo, navigate to
Webhooks and select the webhook for the Nullstone application. From there, you can view the
Recent Deliveries tab to see all the webhook calls, their payload, and their status.
Any failed webhook calls should be reported to Nullstone support at firstname.lastname@example.org.