Configure Your Environment for CircleCI

Before integrating your existing CircleCI framework, configure your Dev Hub org and CircleCI project.
  1. Set up your GitHub repository with CircleCI. You can follow the sign-up steps on the CircleCI website to access your code on GitHub.
  2. Install the Salesforce CLI, if you haven’t already.
  3. Follow Authorize an Org Using the JWT Flow for your Dev Hub org, if you haven’t already.
  4. Encrypt your server key.
    1. First, generate a key and initialization vector (iv) to encrypt your server.key file locally. CircleCI uses the key and iv to decrypt your server key in the build environment.

      Run the following command in the directory containing your server.key file. For the <passphrase> value, enter a word of your own choosing to create a unique key.

      openssl enc -aes-256-cbc -k <passphrase> -P -md sha1 -nosalt

      The key and iv value display in the output.

      key=****24B2
      iv =****DA58
    2. Note the key and iv values, you need them later.
    3. Encrypt the server.key file using the newly generated key and iv values. Run the following command in the directory containing your server.key file, replacing <key> and <iv> with the values from the previous step.
      openssl enc -nosalt -aes-256-cbc -in server.key -out server.key.enc -base64 -K <key> -iv <iv>

      Use the key and iv values only once, and don't use them to encrypt more than the server.key. While you can reuse this pair to encrypt other things, it is considered a security violation to do so.

      Note

      You generate a new key and iv value every time you run the command in step a. In other words, you can't regenerate the same pair. If you lose these values you must generate new ones and encrypt again.

Next, you’ll store the key, iv, and contents of server.key.enc as protected environment variables in the CircleCI UI. These values are considered secret, so take the appropriate precautions to protect them.