Creating a CI process

Updated 3 months ago by Copado Solutions

How to Create a CI Process

  • A validated credential for the org you are currently in.
  • A validated credential for the org you want to deploy to.
  • A validated Git repository within Copado.
  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. Select a branch.
  5. Choose a destination Salesforce org.
  6. Choose an option for the files you want to deploy:
    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.
  7. Check Only: When selected, Copado performs only a validation and no changes are made in the destination org.
  8. Run All Tests: When selected, all Apex tests are executed in the destination org.
  9. Active: If selected, the CI is executable. If deactivated, any request for execution will be rejected.
  10. 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 used 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.
  11. Webhooks: Copado can receive webhooks from major Git vendors, including GitHub, Bitbucket, GitLab, 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 has 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 first 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 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 is also supported. Similar configuration steps are required to create a webhook, as mentioned above.
  12. Running a CI manually: If you are not using webhooks when clicking on Run Continuous Integration, Copado creates a build task and processes 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.
  13. 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?