Deployment Step: Git MetaData
The Git MetaData deployment step lets you deploy contents from a Git commit to an org using the Metadata API.
When this deployment step is executed, Copado retrieves the selected metadata from the Git repository and deploys it to the destination organization.
To create a Git MetaData deployment, follow these steps:
- Navigate to the Deployments tab and create a new Advanced (multi-step) deployment.
- Give your deployment a name and select a source and a destination organization.
- Add a new step and select Git MetaData as step type:
- Select a commit from the Commit Id lookup field:
To make the search easier, you can filter the commits grid by repository or branch name, or search directly for a commit Id. Click on the commit you want to deploy to select it.
Back in the deployment step screen, you will see that the Git Repository, the Commit Name and the Branch fields have been populated with data related to the selected commit:
- The grid with all the components related to the commit selected in the previous step will be displayed. Select the components you want to deploy.
- If your commit contains Apex components, you can specify the test level you want to apply to the deployment:
- No Test Run (no Apex tests are run unless it is a production deployment).
- Run Specified Tests (only included apex test classes will run, aka fast deploy).
- Run Local Tests (all Apex test classes excluding managed packages are run).
- Run All Tests In Org (all Apex test classes including managed packages are run).
For more information regarding test levels check out the article Apex Tests Run While Deploying.
- Find and Replace in files allows you to find a specific text inside the metadata files using a regular expression for matching and replacing matching pieces with a given text. Use cases for this feature are countless, examples can be found in the article about the metadata step.
- Once you are ready to execute the deployment click on Deploy and then on Deploy All.
- A good example of when to use this type of deployment step is when you do a sandbox refresh. If you have work in progress, you can commit your metadata changes into Git by means of a Git snapshot commit or on a user story before refreshing the sandbox. Once the sandbox has been refreshed, you can use a Git MetaData deployment step to deploy the work in progress to the sandbox you just refreshed. This is a great way of ensuring no work in progress is lost.
- Rollback: When you detect a critical issue in a component in UAT or production, you can deploy a previous version of the component from a Git commit prior to when the issue was introduced in that component.