# Jenkins

## What is Jenkins?

Jenkins is an open-source Continuous Integration server developed in Java that helps automate parts of the software development process. It supports the full development lifecycle, including:

* Building
* Testing
* Documenting
* Deploying

***

## How to Trigger a Jenkins Job in CI/CD

You can configure Jenkins to trigger jobs automatically after a successful deployment in a CI job within AutoRABIT.

### Steps:

1. Go to the **New CI Job** screen.

   ![New CI Job](https://1912836914-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F9vAxMuDrkUkB4OXlH9CL%2Fuploads%2FUY3HW25UxJZLQJveQDql%2Fimage.png?alt=media\&token=0bbe57c3-4aa0-4ced-ba62-810885dd9896)
2. Choose a CI Job type from:
   * Deploy SFDX source from Version Control
   * Deploy from Salesforce Org
   * Deploy from Salesforce Org with a Version Control backup
   * Deploy from Version Control
   * Install an Unlocked Package from a Version Control Branch
3. Navigate to the **Deploy** section.
4. Check **On Successful Deployment** to enable post-deployment actions.
5. Check **Trigger Jenkins Job** to enable Jenkins job execution upon success.

   ![Trigger Jenkins](https://1912836914-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F9vAxMuDrkUkB4OXlH9CL%2Fuploads%2Fs4WduoUNjJCvHe8zB5K5%2Fimage.png?alt=media\&token=ffc29823-0dfd-4198-8583-9dc0aef31242)
6. Fill in the required fields:
   * **URL:** Full Jenkins server URL\
     \&#xNAN;*Example:* `http://localhost:8080` or `http://<hostname>:8080`

     ![Jenkins URL](https://1912836914-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F9vAxMuDrkUkB4OXlH9CL%2Fuploads%2FRxNEi9XnWWv06cVFdwGw%2Fimage.png?alt=media\&token=e6a991ef-2dc6-4dc9-9ddb-1f6d67b8b24c)
   * **Job Name:** Name of the Jenkins project (e.g., `HelloWorld`)

     ![Job Name](https://1912836914-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F9vAxMuDrkUkB4OXlH9CL%2Fuploads%2FgvpGIBvO0pfFGl1Zd2U8%2Fimage.png?alt=media\&token=2c77e51d-f97b-483a-8dc3-4c6d2396a110)
   * **Job URL:** Relative job path\
     \&#xNAN;*Example:* `job/HelloWorld`

     ![Job URL](https://1912836914-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F9vAxMuDrkUkB4OXlH9CL%2Fuploads%2F3AhGyottmRP6jgle22m6%2Fimage.png?alt=media\&token=1a9721c1-98ab-4e4e-8271-81885f80d121)
   * **User ID:** Jenkins user triggering the job

     ![User ID](https://1912836914-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F9vAxMuDrkUkB4OXlH9CL%2Fuploads%2FLmx9qbaZ9PjbXNiQyMMo%2Fimage.png?alt=media\&token=c3b7d125-4b4b-4983-b44a-9b5b9ae47e1c)
   * **API Token:** Found under **Profile > Configure** in Jenkins

     ![API Token](https://1912836914-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F9vAxMuDrkUkB4OXlH9CL%2Fuploads%2FIcKN9H3hEMk36zjlpXaT%2Fimage.png?alt=media\&token=50bcca76-ff2e-4c1b-99ed-ecf03f8092c4)
   * **Build Parameters (Optional):** Define build parameters and values. To add multiple parameters, click the plus `+` icon.

     ![Parameters](https://1912836914-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F9vAxMuDrkUkB4OXlH9CL%2Fuploads%2FubfWgRHhDFgxWg7PNHwZ%2Fimage.png?alt=media\&token=782e7266-9cd1-4ef7-9623-7d28f2ba3943)

***

{% hint style="info" %}

#### Important Note:

Ensure Jenkins allows URL parameter injection.

Steps:

1. Go to your Jenkins project configuration.
2. In the **General** section, enable **This project is parameterized**.
3. Click **Add Parameter** and choose your parameter type.
4. Set the parameter name and default values.
5. Click **Save**.

Your Jenkins job can now accept and process parameters passed from AutoRABIT.
{% endhint %}
