Creating a CI process

Updated 2 weeks ago by Copado Solutions

How to Create a CI Process

Prerequisites
  • A validated org credential for the org you are currently in.
  • A validated org credential for the org you want to deploy to.
  • A validated Git repository within Copado.
Steps
  1. Open the Continuous Integration tab.
  2. Click on New and name the CI flow, e.g. 'My First CI'.
  3. 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 a valid username and password.
  4. Choose a destination Salesforce org.
  5. Choose the files you want to get deployed:
    1. Deploy all Files: Every time the CI is executed, all files in the repository will be deployed/validated to the destination org.
    2. Deploy only Committed Files: Only the files modified/created within the Git push, including one or more commits, will be deployed to the destination org.
  6. Check Only: When selected, Copado will only perform a validation and no changes will be made in the destination org.
  7. Run All Tests: When selected, all Apex tests will be executed in the destination org.
  8. Active: If selected, the CI is executable. When deactivated, any request for execution will be rejected.
  9. Choose pre and post deployment jobs. Pre and post deployment jobs are Copado deployment records.
    You can define a deployment that will run before and after the CI deployment. This pre/post deployment can be use for different actions such as running Apex tests, running Selenium tests, running source code scans, making a Git backup of your code, etc. Please take a look at the article URL Callouts + Webhooks API to learn more.
  10. Webhooks: Copado can receive webhooks from major Git vendors, including GitHub, Bitbucket, Gitlab, Stash, or any other vendor which is compatible with those previously mentioned. If Copado does not support your Git server, let us know and we can find a way to make it work.
    Each CI will have its own webhook URL. Copado will use an API key to identify the Copado user. Each user has his/her own API key, therefore the 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, since your API key will be linked to your Copado user exclusively.
    In order to set up and automate the creation and running of deployments when a push is received by your Git repository, you will need to do the following:
    1. Go to your Git repository setup page and find the hooks or webhooks section.
      1. Bitbucket: choose the 'POST' option, paste the Copado webhook URL.
      2. GitHub: paste the Copado webhook URL under payload URL, choose the type as 'application/json' and the option 'Just push event'.
      3. GitLab and Stash are also supported. Similar configuration steps are required to create a webhook, as mentioned above.
  11. Running a CI manually: If you are not using webhooks, when clicking on Run Continuous Integration, 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 checks out the repository and deploys the latest status of your Git repository.
  12. Reviewing a deployment: You can quickly access the deployment status from the Build Tasks record or navigate to the deployment by clicking on its name for further details. The deployment can be rerun at any time, you can add more steps, clone it, etc. All deployments are named with a 'CI:' prefix to help you differentiate these from other deployments.


How did we do?