Manage branches with the Cloud Console
You can manage your environments using either the Cloud Console or the magento-cloud
CLI. Your project files are stored in a Git repository. You can use Git commands to manage your code, but the magento-cloud
CLI is designed to interact with platform features whereas the Git commands do not. See Git commands in the cloud CLI topic.
This topic discusses how to use the Cloud Console to:
- Add or delete an environment
- Sync (
git pull
) from the parent environment - Merge (
git push
) to the parent environment
master
branch.Create an environment
The branching strategy uses a common Git workflow where you develop code and add extensions in a development branch. See Starter and Pro architecture overviews.
- For Starter, create a
staging
branch from themaster
branch, then branch fromstaging
for development. - For Pro, create a development branch from the
Integration
environment.
Your account supports a limited number of {width="32"} (active) and an unlimited number of {width="32"} (inactive) development branches. Manage active and inactive branches by adding or deleting a branch using only the Cloud Console or the Cloud CLI. Before you can delete a branch, you deactivate the branch, which remains in the Environments list as inactive. You can reactivate the branch later or you can delete the branch in environment settings or using the Cloud CLI.
If you need additional active environments for development, submit a Support ticket.
To add a branch:
-
Log in to the Cloud Console.
-
Select a project from the All projects list.
-
Select an environment.
note tip TIP Your new branch is cloned from this environment. Choose a parent environment that is similar to the environment that you are about to create. -
Click Branch.
{width="150"}
-
In the Branching from … form, enter a branch name.
The environment name is different from the environment ID only if you use spaces or capital letters in the environment name. An environment ID consists of all lowercase letters, numbers, and allowed symbols. Capital letters in an environment name are converted to lowercase in the ID; spaces in an environment name are converted to dashes.
An environment name cannot include characters reserved for your Linux shell or for regular expressions. Forbidden characters include curly braces (
{ }
), parentheses, asterisk (*
), angle brackets (>
), ampersand (&
), percent (%
), and other characters. -
Select an Environment type.
-
Click Create Branch.
-
Wait while the environment deploys.
During deployment, the environment status is In process. After a successful deployment, the status changes to a green check mark for success.
Create inactive branch
You cannot create an inactive branch from the Adobe Commerce Cloud console or CLI. If you want to create an inactive branch, create it on the Git repository and push using the environment.Parent
option on the command.
git push -o "environment.Parent=<parent branch>" <origin> <branch>
Delete an environment
Before you can delete an environment, you must deactivate it. Once an environment is inactive, you can delete it.
To deactivate an environment:
-
Log in to the Cloud Console.
-
Select a project from the All projects list.
-
Select the environment from the navigation bar Environment list.
-
Click the configure icon on the right side of the top navigation bar, which opens the environment settings.
-
On the General tab, scroll down to the Deactivate environment section and click Deactivate environment and delete data and follow the instructions.
Sync an environment
Syncing an environment (or branch) is the same as git pull origin <parent>
. You can sync updated code from a parent environment. You can use this feature through the Cloud Console for all Starter and Pro environments.
For Pro plan, you can sync from Staging and Production to your master
branch. This sync only pulls and pushes code, not data. To sync data, dump the database data and push it to another environment’s database. See Migrate and deploy static files and data.
To sync an environment:
-
Log in to the Cloud Console.
-
Select a project from the All projects list.
-
In the environment list, click the name of the branch to sync.
-
Click (sync).
{width="150"}
-
Select the items to sync.
- Replace the data—(data and files) syncs changes in the database and content files from the parent branch.
- Merge—(code) syncs updated code from the parent branch.
This also builds a CLI command for you to copy and use.
-
Click Sync.
Merge with parent environment
Merging an environment (or branch) is the same as git push origin
. You merge to push updated code from an environment to its parent environment. You can merge this code to master
. You can deploy to Staging and Production using the merge
command.
To merge with the parent environment:
-
Log in to the Cloud Console.
-
Select a project from the All projects list.
-
In the environment list, click the name of the branch to merge.
-
Click (merge).
{width="150"}
-
Click Merge and confirm the action.
View logs
Through the Cloud Console, you can review various logs for environments including build, deploy, and deployment history.
For Starter, you can review build and deploy logs and the deployment history. These environments include the master
(Production) branch and all branches created from it.
For Pro, you can review the following logs in each environment:
- Integration—Build and deploy and deployment history
- Staging—Build logs and deployment history. Use SSH to log into the server to view deploy logs.
- Production—Build logs and deployment history. Use SSH to log into the server to view deploy logs.
To view logs in the Cloud Console:
-
Log in to the Cloud Console.
-
Select a project from the All projects list.
-
Select an environment.
The environment view provides an Activity list that shows recent events, one entry per action attempted including syncs, merges, branches, backups, and more. Click All for the full deployment history.
-
To view the build log, select the Success or Failure link per deployment record on the account.
Pull code from a private Git repository
Your Adobe Commerce on cloud infrastructure project can include code from a private Git repository. For example, you may have code for a custom module or theme in a private repo. To do so, you must add your project’s public SSH key to your private Git repository and update your project composer.json
file.
To add a deployment key to your private GitHub repository, you must be the administrator of that repository. GitHub allows you to use a deploy key for one repository only.
If you prefer that your project accesses multiple repositories, you can attach an SSH key to an automated user account. Because this account is not used by a human, it is referred to as a machine user. Add the machine account as a collaborator or add the machine user to a team with access to the repositories.
To find your SSH public key:
-
Log in to the Cloud Console.
-
Select a project from the All projects list.
-
Click the configuration icon on the right side of the top navigation bar.
-
In Project Settings, click Deploy Key.
-
Copy the deploy key to the clipboard for use in one of the following Git-based methods:
Enter your GitHub deploy key
On GitHub, deploy keys are read-only by default.
To enter your project public key as a GitHub deploy key:
-
Log in to your GitHub repository as the administrator.
-
Click the repository Settings tab.
note note NOTE If you do not see this option, you are not logged in as a repository administrator, and you cannot complete this task. Ask your GitHub repository administrator to do this. -
On the Settings tab in the left navigation, click Deploy Keys.
-
Click Add deploy key.
-
Follow the prompts.
In composer.json
, use the <user>@<host>:<.git</code>
format, or ssh://<user>@<host>:<port>/<path>.git
if using a non-standard port.
Enter your Bitbucket deploy key
To enter your project public key as a Bitbucket deploy key:
-
Log in to your Bitbucket repository as the administrator.
-
In the left navigation, click Settings.
-
Click General > Deployment Keys.
-
Click Add Key.
-
Follow the prompts.
Enter your GitLab deploy key
To add the public SSH key for your project as a GitLab deploy key:
-
Log in to your GitLab repository as the owner.
-
Verify that the Pipelines option is enabled for your project:
- In the project settings, expand the Visibility, project, features, permissions section.
- If necessary, click Pipelines to enable the option.
-
Add your public SSH key to the CI/CD settings.
- In the left navigation, click Settings > CI / CD.
- Click Deploy Keys Expand to configure the key.
- In the Deploy Key form, add a deploy key name to the Title field and paste your public SSH key in the Key field.
- Click Add Key to save the configuration.
Secure environments and branches
You can access your project and environments from any location through a web browser using the Cloud Console. You may have security set for your Production environment, stores, and sites. This section helps you secure your Integration and Staging environments for strictly your developers, DBAs, and more.
To secure environments:
-
Log in to the Cloud Console.
-
Select a project from the All projects list.
-
Select an environment and click the configuration icon on the navigation bar.
-
On the environment settings General tab, click ON for HTTP access control enabled to enable secure access. You can choose between credentials or IP addresses to filter for access.
-
To filter by credentials, click Add Login, enter a username and password, and click Add Login to add.
-
To filter by IP address, enter the IP addresses in a list with
deny
orallow
. For example:code language-text 123.456.789.111/29 allow 123.456.789.112/29 allow 234.123.567.111/29 allow 0.0.0.0/0 deny
-
Click Save. This redeploys the environment to update security and settings. Adobe recommends testing the environment after completing security settings.