Edit a CI Pipeline Codebase Configuration

Updated 1 month ago by Manish Jaiswal

This topic provides settings for Codebase configuration in Harness CIE.

You can configure the Codebase in Harness CIE at the beginning of setting up a new Pipeline, or later in a Stage using the Codebase button. Codebase lets you set up a Harness connector to your repo containing the code you want to build and test in your Pipeline. Harness will clone your code from the specified repo in the Harness Git connector and use it in the execution Stage of your Pipeline. You need to set up the Codebase once, and it is used throughout the Pipeline.

You can modify your CI Codebase any time by clicking the Codebase button in the right panel that appears after you set up the CI stage. 

The following steps will help you modify the Codebase of your source code in Harness CIE.

In this topic:

Before You Begin

Step 1: Configure Codebase

Connectors allow Harness to connect to your Git repos to clone your Codebase. 

Option 1: Add a New Codebase

You can add Codebase to your new CI Pipeline as well as an existing Pipeline that doesn’t have a Codebase yet. 

In this step, you will create Codebase for a new Pipeline in Harness CIE.

  1. Goto Pipeline Studio, click Add Stage, and then click Build.
  2. Enter a unique name for your CI stage.
  3. In Configure Codebase, in Connector, click Select Connector.
  4. Click New Connector.
  5. Follow the instructions in Add a Git Repo to create a new Git repo connector for your Codebase.

Option 2: Modify an Existing Codebase

In this step, you will modify an existing Codebase in Harness CIE.

  1. Select a Pipeline, in Pipeline Studio, click Codebase.
  1. In Configure Codebase, in Connector, click Select Connector.
  2. Select any available connector under your role group Projects, Organizations, or in your Account.

  1. Modify the selected Git connector. Refer to Git Setting Reference to set up a Git Repo Connector.

Step 2: Enter Repository Name

If you selected Git Repository as the URL Type in your Git repo connector, the repo name will be displayed automatically.

If you selected Git Account as the URL Type in your Git repo connector, you will be prompted to provide a repo name. 

In the following GitHub connector example, Account is selected as the URL Type, and a repo name (CI-How-Tos) is added to the Test Repository.

Click Continue. The configured connector will be listed.

Advanced (Optional)

Click Advanced (Optional) to review additional Codebase configuration.

Depth

Depth is the number of commits that you want to clone from your Git repo.

Depth is set to 1 by default for manual triggers. For triggers other than the manual trigger, you need to set the depth number.

For details, see https://git-scm.com/docs/git-clone.

SSL Verify

Select an option to verify your Git SSL certification.

If set to True, it verifies your Git SSL certificate.

If set to False, your Git SSL certificate verification is skipped.

Pull Request Clone Strategy

Select a pull request clone strategy.

  • Merge Commit

Merges the source branch of the pull request to the target branch.

  • Source Branch

Clones only the source branch of the pull request.

Set Container Resources

Maximum resources limit values for the resources used by the container at runtime.

  • Limit Memory

Maximum memory that the container can use.

You can express memory as an integer value with one of these suffixes: G, M, Gi, Mi.

  • Limit CPU

See Resource units in Kubernetes.

Limit the number of cores that the container can use.

Limits for CPU resources are measured in CPU units.

Fractional requests are allowed. The expression 0.1 is equivalent to the expression 100m, which can be read as one hundred millicpu.

If cloning your Codebase takes more time than expected, try these configurations for cloning your codebase:
1. Increase the Limit Memory of Git clone to 1 Gi.
2. Use Source Branch clone strategy instead of Merge Commit. Source branch clones only the pull request branch.
3. Specify Depth to 1.

Step 3: Save and View Your Connector

Click Save to use the connector in your Pipeline. Your Codebase is now configured successfully. Harness will use the configured repo in the Codebase to clone your source code and to test and build your Pipeline.

You can also view the list of your saved connectors in Connectors under Project Setup.

Configure-As-Code: YAML

You can also use the following YAML snippet to set up the Codebase configuration in CIE.

ci:
codebase:
connectorRef:
repoName:
build:
depth:
sslVerify:
prCloneStrategy:

See Also


Please Provide Feedback