Staging from a branch
Create a staging environment that runs one Git branch, with a copy of the site's database and uploads, and deploys again on every push.
Before you start
- You can open the site in Managed Websites. Anyone who can open a site can create its environments.
- The site is a WordPress site. Other platforms start an environment empty or from a copy.
- A repository is connected on Production's Deployments: see Connect a repository.
Create the environment from a branch
Open the create dialog
Go to Managed Websites, choose the site, then Environments under Code & backups. Choose Create environment, then enter a Name and choose a Size.
Choose A git branch
Under Start from, choose A git branch. The dialog shows the site's repository.
Choose the branch
Choose the Branch from the list; Filter the branches narrows it. If the list cannot be read, enter the branch name.
Choose the data
Under Take database and uploads from, choose an environment, or Nothing (start empty). The data is copied once, when the environment is created; the code comes from the branch.
Choose when it deploys
Leave Deploy on push on to deploy the environment on every push to the branch. Turn it off to deploy by hand.
Create it
Choose Create environment. The environment is created, the data is copied, then the branch is deployed with the site's pipeline.
When it is ready, the environment's Deploy column in Environments shows Git, the branch and on push. If the first deployment fails, the environment still exists: open Deployments to see why.
The environment starts like any other staging environment, and its login is shown once when it is ready: see Create an environment.
Automate this
Adds a staging environment to the site, protected by HTTP authentication from the start, with the data source chooses.
curl -X POST https://manage.corefinity.com/api/corestack/sites/1042/environments \
-H "Authorization: Bearer $COREFINITY_TOKEN" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-d '{
"name": "Review",
"slug": "review",
"source": {
"environment_id": 1043,
"scope": "files_db",
"type": "clone"
}
}'Your assistant calls corestack_environment_create.
{
"name": "corestack_environment_create",
"arguments": {
"site_id": 4211,
"name": "Staging",
"source": {
"type": "empty"
}
}
}