# Build a package from Version Control

{% hint style="info" %}
The **CI JOBS** screen is best viewed when the zoom is set to **80%** on your Chrome/Firefox browser.
{% endhint %}

## Overview <a href="#overview" id="overview"></a>

Convert and package your version-control files to [Salesforce Metadata](https://www.autorabit.com/blog/how-salesforce-metadata-affects-compliance/) components based on a **Start Revision.** You can also configure an ALM project and sprint to include only revisions tied to a user story and its status.

## Procedure <a href="#procedure" id="procedure"></a>

1. Log in to your ARM account.
2. From the top navigation pane, navigate to **Create New >** [**New CI Job**](https://knowledgebase.autorabit.com/~/revisions/4D085eRCQQOD5ETlONn0/product-guides/arm/arm-features/automation-and-ci/ci-job-history).

   <figure><img src="https://1912836914-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F9vAxMuDrkUkB4OXlH9CL%2Fuploads%2F0Wb6xpUDqwrbq13YuZTh%2Fimage.png?alt=media&#x26;token=07654566-6978-4dbf-9b81-42c576f5aee7" alt="New CI Job button"><figcaption><p>New CI Job button</p></figcaption></figure>
3. Choose the tile: **Package from** [**Version Control**](https://www.autorabit.com/blog/do-i-really-need-salesforce-version-control/).

   <figure><img src="https://1912836914-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F9vAxMuDrkUkB4OXlH9CL%2Fuploads%2Fc74DeaIuBicuapu57wnq%2Fimage.png?alt=media&#x26;token=f11ef707-c1be-4eb7-80f9-a8c176336721" alt="Package from Version Control tile"><figcaption><p>Package from Version Control tile</p></figcaption></figure>
4. Enter a descriptive **Job name**.
5. Add a brief **Description**.
6. (Optional) Choose a **Group** to organize the job, or click **`+`** to create one.
7. The configuration page is divided into sections explained below.

### Build <a href="#build" id="build"></a>

1. Select your [**Version Control**](https://www.autorabit.com/blog/7-tips-for-salesforce-version-control-integration/) **system** – ARM supports Git, SVN, and TFS.
2. Choose the **Repository** and **Branch**.
3. Under **Build Using**, pick one option:
   * **Baseline Revision** – Enter a revision manually or click **Edit** (![edit icon](https://1912836914-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F9vAxMuDrkUkB4OXlH9CL%2Fuploads%2F04JGVa1laQMvL6GbvdV3%2Fimage.png?alt=media\&token=70954fd5-436d-4dd1-914a-da9786dc0fc1)) to select it from a list.

     <figure><img src="https://1912836914-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F9vAxMuDrkUkB4OXlH9CL%2Fuploads%2FwuCpI9T3Aqp4fQ3o4kvX%2Fimage.png?alt=media&#x26;token=6532356c-d683-4797-bc5e-a6b5356d8824" alt="Select baseline revision"><figcaption><p>Select baseline revision</p></figcaption></figure>

     <figure><img src="https://1912836914-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F9vAxMuDrkUkB4OXlH9CL%2Fuploads%2FxVmHnEyJfVBEAAyRfJ2F%2Fimage.png?alt=media&#x26;token=15859ff5-91de-44b7-a397-47dc368f2287" alt="Baseline revision pop-up"><figcaption><p>Baseline revision pop-up</p></figcaption></figure>

{% hint style="info" %}
Important Notes:

1. For the first CI job, you must choose a **Baseline Revision**.
2. **Get Latest HEAD** points to the last commit in the current branch.
   {% endhint %}

* **Time Range** – Specify a period so ARM fetches only revisions in that window.

  <figure><img src="https://1912836914-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F9vAxMuDrkUkB4OXlH9CL%2Fuploads%2F0AQqyMCKakd1yM9EMgDp%2Fimage.png?alt=media&#x26;token=282e96aa-a063-485e-819a-50ae67cd5e5a" alt="Time-range selector"><figcaption><p>Time-range selector</p></figcaption></figure>

#### Additional options in the Build section

1. **Status Check API** – Check the status of APIs running for the CI job.
2. [**Pull Request**](https://knowledgebase.autorabit.com/~/revisions/4D085eRCQQOD5ETlONn0/product-guides/arm/arm-features/version-control/external-pull-request) – Create a pull request for this job.
3. [**Merge Request**](https://knowledgebase.autorabit.com/~/revisions/4D085eRCQQOD5ETlONn0/product-guides/arm/arm-features/version-control/ez-merge/merge-requests) – Create a merge request for this job.
4. **Map ALM Project** – Configure ALM (e.g., Jira) work-item statuses to include in the build.

{% hint style="warning" %}
**Important note**: **Build Using – Baseline Revision/Time Range** and **Trigger Build on Commit** are unavailable when **Map ALM Project** is selected.
{% endhint %}

5. **Trigger Build on Commit** – Launch a build whenever changes are committed to the branch.
   * **Process commit revision via hook only** – Visible only for Git-type repos. When enabled, the build packages changes from the commit revision received via webhook up to the branch head, ensuring no commits are skipped.

{% hint style="warning" %}

<pre class="language-markup" data-overflow="wrap"><code class="lang-markup"><strong>Note: If you commit both _nCino record-based config_ and _Salesforce metadata_ files to the same branch, certain Git systems may trigger unnecessary builds. This happens when the **Build on commit** option is enabled and changes occur only in an irrelevant folder.
</strong><strong> 
</strong></code></pre>

{% endhint %}

6. **Incremental Build** – Fetch only metadata changed since the last successful deployment, dramatically reducing build time.

{% hint style="info" %}
**Important note**: Incremental Build also works when validating **Deployment Jobs**.
{% endhint %}

7. **Prepare Destructive Changes** – Delete unwanted metadata from the destination org before deployment.
8. **Run Static Analysis Report** – Identify code-quality issues before production.

   <figure><img src="https://1912836914-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F9vAxMuDrkUkB4OXlH9CL%2Fuploads%2FoOQL5pQuuAPD549u2XHM%2Fimage.png?alt=media&#x26;token=598feaf9-5f1b-4ba4-a27f-9dc5cb63d01f" alt="Static analysis options panel"><figcaption><p>Static analysis options panel</p></figcaption></figure>

   * **Apex PMD / Checkmarx** – Set criteria such as date range and **Priority**. If the priority threshold is not met, the build is marked unstable.

     <figure><img src="https://1912836914-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F9vAxMuDrkUkB4OXlH9CL%2Fuploads%2FlgMnBq7L7KtXAcH6lnuR%2Fimage.png?alt=media&#x26;token=8a11512a-6257-41d2-aabb-f4e9070f5644" alt="Criteria for Apex PMD and Checkmarx"><figcaption><p>Criteria for Apex PMD and Checkmarx</p></figcaption></figure>
   * **CodeScan / SonarQube** – Choose to scan all metadata or only newly added components, then set a **Priority**.

     <figure><img src="https://1912836914-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F9vAxMuDrkUkB4OXlH9CL%2Fuploads%2FX4khtO0tsy9G8qwk6dmt%2Fimage.png?alt=media&#x26;token=a16819cc-bd5f-49ca-8e0c-ad41e2930256" alt="Criteria for CodeScan and SonarQube"><figcaption><p>Criteria for CodeScan and SonarQube</p></figcaption></figure>

     * **Run on all supported metadata types** – Scan every retrieved component.
     * **Run on newly added supported metadata types** – Scan only newly added components.
     * **Run on all supported metadata types from the full source** – Scan the entire branch.

       <figure><img src="https://1912836914-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F9vAxMuDrkUkB4OXlH9CL%2Fuploads%2F5I6m08mESuiDLbK7zPjv%2Fimage.png?alt=media&#x26;token=8dc5eca1-18ea-4820-ac79-301109ba1c1a" alt="Scope options for supported metadata types"><figcaption><p>Scope options for supported metadata types</p></figcaption></figure>

     For details on running **Static Code Analysis in CI jobs**, see [this guide](https://knowledgebase.autorabit.com/~/revisions/4D085eRCQQOD5ETlONn0/product-guides/arm/arm-administration/registration/static-code-analysis-in-ci-cd).
9. **Additional Profile Packaging Options**
   * **Remove Login IP Ranges** – Omit IP-range restrictions from profiles.
   * **Remove System and User Permissions** – Omit profile permissions from deployment.
10. **Exclude Metadata Types** – Skip metadata you don’t need in the build.

{% hint style="info" %}
{% code overflow="wrap" %}

```
**Important note**: To set exclusions globally, open **My Account > My Salesforce Settings**, choose **Exclude metadata types**, and select the types to skip.
```

{% endcode %}
{% endhint %}

### Notifications <a href="#notifications" id="notifications"></a>

Send email notifications on build success or failure.

<figure><img src="https://1912836914-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F9vAxMuDrkUkB4OXlH9CL%2Fuploads%2FPHcCQdF5N7wmjRBI79x2%2Fimage.png?alt=media&#x26;token=45d9eddd-4dd4-4943-8f56-e9520aa21566" alt="Notification recipient list"><figcaption><p>Notification recipient list</p></figcaption></figure>

### Schedule <a href="#schedule" id="schedule"></a>

* **Daily** – Run every day at the chosen time or interval.
* **Weekly** – Run on selected day(s) and time.
* **No schedule** – Save the job and trigger it manually.

For credential-usage details across CI job types, see the [FAQ](https://knowledgebase.autorabit.com/~/revisions/4D085eRCQQOD5ETlONn0/product-guides/arm/troubleshoot/arm-faqs/ci-jobs).

### What Next? <a href="#what-next" id="what-next"></a>

After saving the job, ARM redirects you to the [CI Job Results](https://knowledgebase.autorabit.com/~/revisions/4D085eRCQQOD5ETlONn0/product-guides/arm/arm-features/automation-and-ci/ci-job-history) page, where you can trigger the first build.
