A connection behavior is a template that is used to define the promotion, back-promotion and automation behaviors that will be applied throughout your release management process with Copado Continuous Delivery. A connection behavior allows you to define three things:
- The promotion behavior. You can specify whether you want to schedule or automate a promotion, or execute a manual promotion.
- The back-promotion behavior. As with promotions, you can specify whether you want to schedule or automate a back-promotion, or execute a manual back-promotion.
- The automations that will be applied. Automations allow you to automatically or manually verify that your deployment meets requirements. See the Automations section below for a list of all the automations you can specify.
You can define a connection behavior for each of the connections in your pipeline. The connection behavior that is used can either be defined by the environment it is connecting into or by the environment it is connecting out of. In the pipeline, each environment can have multiple incoming connections, but can only have one outgoing connection. By editing the incoming connection behavior for an environment, you are setting the default behavior for all connections coming into that environment. This is useful in cases where there are many incoming connections to a single environment, since you only have to define the connection behavior one time for all of them.
There may be cases, however, when you want to have a special behavior for one particular connection that is different from the behavior that is applied to other connections going into the same environment. In that case, you can define an outgoing connection behavior from the source environment. Outgoing connection behaviors will override the incoming connection behavior:
The connection behavior has three tabs:
- Details: This is where you define your connection behavior.
- Automations: Add different automations and quality gates to your connection behavior.
- Applied to: In this tab you can find information about the environment or pipeline connection the quality gate you are building will be applied to.
Now that you have an idea about what a connection behavior is, move on to the next sections to dig deeper and learn how to build a connection behavior.
Relevant Fields on a Connection Behavior
Let’s take a look at some relevant fields you can find on the connection behavior Details tab:
- Promotion Execution: In this field you can define how you want your user stories to be promoted to the next environment in your pipeline. You can promote them manually or automate or schedule the promotion.
- Promotion Criteria: This field is only visible if you have selected an automated or scheduled promotion in the Promotion Execution picklist field. Here you can define the criteria for those user stories that can be automatically promoted. You can filter by different fields available on the User Story record such as the Status field.
E.g. You can specify that only user stories that are completed can be automatically promoted from dev1 to UAT: copado__Status__c = 'Completed'.
- Scheduled Promotion US Group Size: This field is only available for scheduled promotions and enables you to customize the batch size for promotions. A batch size of 1 means that each user story will be deployed individually. This takes a longer time in total, but means that any deployment errors will be clearly associated with a particular story. Choosing a larger batch size allows you to group many user stories to make the deployment happen more quickly.
- Execute promotions in parallel: Scheduled promotions and back-promotions are executed by Copado by means of URL Callout steps, each promotion being executed by one URL callout. If you want these URL Callout steps to be executed in parallel, you can select this checkbox:
- If the checkbox is selected, the URL Callout step will be set to Perform Callout and continue with deployment.
- If the checkbox is not selected, the step will be set to Perform callout and pause Step.
This option can be very useful if you are working with a user story group size of 1. If a user story fails to be deployed, and you have selected the option to execute promotions in parallel, Copado will continue to deploy the other user stories.
- User Story Status After Promotion: If you want the status of your user stories to be updated once they have been promoted, you can define the new status here.
In the Back-Promotion Details section you can find fields such as Back-Promotion Execution, Back-Promotion Criteria, Execute back-promotions in parallel and Scheduled Back-Promotion US Group Size which behave in the same way as their counterparts in the Promotion Details section:
Now that you have an overview of the main fields on the Connection Behavior record and their use, navigate to the next section to learn how to build a connection behavior.
How to Create a Connection Behavior
A connection behavior can be defined once and reused in many different places. To create a connection behavior, follow the steps below:
- Navigate to the Connection Behavior tab and click on New. Alternatively, from the Pipeline Configuration page, click on the shield icon on an environment:
- You will be taken to the connection behavior configuration screen. Give your connection behavior a name and add a description, if desired.
- Choose an option from the drop-down menu in the Promotion Execution field. The available options are: Manual, Automated or Scheduled.
- Choose a back-promotion behavior from the Back-Promotion Execution field. The available options are: Manual, Automated or Scheduled.
- If you have chosen a scheduled promotion or a scheduled back-promotion, click on the Schedule Promotion or Schedule Back-Promotion link to specify the schedule.
- You can also customize the batch size for scheduled promotions or back-promotions in the Scheduled Promotion US Group Size.
- Add automations. Automations are only applied to deployments. Back-promotions do not run automations:
You can add as many automations as needed to your connection behavior. Keep on reading for more information about the different automations you can include in your connection behavior.
An automation defines a set of tests that will run as part of a continuous delivery process to ensure quality by identifying failures prior to deploying. The automation allows you to check a particular group of changes to decide whether it should be allowed to be deployed or not. There are different types of automations that can be applied to a connection behavior:
To create an automation, follow the steps below:
- Navigate to the Automations tab in the Connection Behavior record and click on New.
- Specify a name for the automation.
- Select the metadata group you want the automation to be applied to.
- Then, specify which type of quality gate or automation this is. You can choose from the following types:
- Different types of automations have different relevant options. For example, in the case of Apex tests you can specify a test level such as Run Local Tests.
For more detailed information about how each of these automations is executed when user stories get deployed to an upper environment, please check out the article Quality Gates in Copado Continuous Delivery.
Metadata Items and Groups
A metadata item is a representation of a Salesforce metadata type. A metadata group is simply a collection of metadata items. You can specify whether this includes all metadata of that type, or only metadata that matches a particular pattern. You can specify patterns such as Starts With and Contains to match the API name (aka the developer name) of the metadata item. For example, you can have a metadata Item that matches metadata with type “ApexClass” and a name that starts with “Sales”.
To create a metadata group, follow the steps below:
- Navigate to the Metadata Groups tab and click on New.
- Give your metadata group a relevant name and provide a description, if desired.
- Navigate to the Metadata Items section and click on New to add a new metadata item to your group:
- Select a metadata type from the drop-down menu and click on Save.
You can add as many metadata items to your group as you need.
Once you have defined your metadata group, you can create an automation and link it to the metadata group you have just created.