Create a CI process
Create a CI process
To create a Continuous Integration you will need:
- a validated org credential for the org that you are currently in
- a validated org credential for the org that you want to deploy to
- a validated Git repository within Copado
To create a Continuous Integration:
- Click on the tab, “Continuous Integration”. If you can’t find this tab, customize your tabs and make sure that is part of your selection of tabs for the “Copado” application.
- Press New and name the CI flow e.g. “My First CI”.
- Choose a source Git Repository. If you haven’t created one yet, please create one first. To create a Git repository you only need the HTTP URL of the git file and valid username and password.
- Choose a target Salesforce org.
- Choose which files to be deployed
- All files: every time the CI is executed all files in the repository will be deployed/validated into the target org.
- Only committed files: only files modified/created within the Git push, including one or more commits, will be deployed to the target org.
- Check Only: when selected, Copado will only perform a Validation and no changes will be made on the target org.
- Run all test: when selected, all apex test will be executed on the target org.
- Active: if selected the CI is executable, when deactivated any request for execution will be rejected.
- Choose pre and post deployment jobs. Pre and post deployment jobs are Copado deployment records. You are able to define a deployment that will run before and after the CI deployment. This pre/post deployment can be use for different actions, like running apex tests, running selenium tests, running source code scan, make git backup of your code, etc. Please take a look to this article to learn more.
- Web hooks: Copado can receive web hooks from major Git vendors, including GitHub, Bitbucket, Gitlab, Stash, or any other vendor which is compatible with the previously mentioned. If Copado does not support your Git server, let us know and we can find away to make it work. Each CI will have its own web hook URL. Copado will use an API key to identify the Copado user. Each user has his/her own API key, so deployments performed with that API key will be created under the user’s name. The API key can be renewed at any time from the “Account Summary” tab. Use the “Show Hook URL” button to copy the URL for a particular CI record and for the current user. Make sure that you have created and authenticated your Copado user as in the 1st step of this guide, as your API key will be linked to your Copado user exclusively. In order to setup and automate the creating and running of deployments when a push is received by your Git repository, you will need to do the following:
- Go to your Git repository setup page, find the hooks or web hooks section.
- Bitbucket: choose the “POST” option, paste the Copado web hook URL.
- GitHub: paste the Copado web hook URL under payload URL, choose type as “application/json” and “Just push event” option.
- GitLab and Stash are also supported. Similar configuration steps are required to create a webhook as mentioned above.
- Running a CI manually: If you are not using web hooks, when pressing the “Run Continuous Integration” button, Copado will create a Build Task and process the latest commit. This option is only recommended in combination with the “Deploy all files” option, so that Copado checkouts the repo and deploys the latest status of your Git repository.
- Reviewing a deployment: you can quickly access the Deployment status from the Build task record, or you can navigate to the deployment by clicking on its name for further details. The deployment can be re-run at any time, you can add more steps, clone it, etc. All deployments are named with a prefix “CI:” to help you differentiate these from other deployments.