Skip to content

docs: jobs revamp #62

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 18 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions docs/SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,11 +103,18 @@
* [Application Metrics](user-guide/creating-application/app-metrics.md)
* [Overview](user-guide/creating-application/overview.md)
* [Jobs](user-guide/jobs/README.md)
* [What is job?](user-guide/jobs/what-is-job.md)
* [Create a new job](user-guide/jobs/create-job.md)
* [Configurations](user-guide/jobs/configuration-job.md)
* [Workflow Editor](user-guide/jobs/workflow-editor-job.md)
* [Configurations](user-guide/jobs/configurations/README.md)
* [Source Code](user-guide/jobs/configurations/source-code-job.md)
* [Workflow Editor](user-guide/jobs/configurations/workflow-editor-job.md)
* [ConfigMaps & Secrets](user-guide/jobs/configurations/configmap-secret/README.md)
* [ConfigMaps](user-guide/jobs/configurations/configmap-secret/configmap-job.md)
* [Secrets](user-guide/jobs/configurations/configmap-secret/secret-job.md)
* [Environment Overrides](user-guide/jobs/configurations/environment-override-job.md)
* [Trigger Job](user-guide/jobs/triggering-job.md)
* [Overview](user-guide/jobs/overview-job.md)
* [Run History](user-guide/jobs/run-history-job.md)
* [Job Overview](user-guide/jobs/overview-job.md)
* [Application Groups](user-guide/application-groups.md)
* [Software Distribution Hub](user-guide/software-distribution-hub/README.md)
* [Tenants](user-guide/software-distribution-hub/tenants.md)
Expand Down
26 changes: 19 additions & 7 deletions docs/user-guide/jobs/README.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,30 @@
# Jobs

Job allows manual and automated execution of your source code. Job pipeline will not have CI/CD pipeline as the job is limited to your source code only. You can also configure [preset plugins](../creating-application/workflow/ci-build-pre-post-plugins.md#preset-plugins) in your job pipeline.
Devtron Jobs provide a streamlined way to execute specific tasks or set of tasks defined by the user within the user's application environment.

With job, you can execute your source code quickly and easily without going through CI/CD pipelines, which also optimize time.
To learn more about how Jobs work, see the below sections

![](https://devtron-public-asset.s3.us-east-2.amazonaws.com/images/create-job/jobs.jpg)

There are two main steps in executing Job:
* [What is Jobs](./what-is-job.md)

* [Configurations](configuration-job.md)
* [Creating a Job](./create-job.md)

* [Trigger Job](triggering-job.md)
* [Configurations](./configurations/README.md)

In the next section, we will learn on how to create, configure, trigger a job. You can also view the details on the [Overview](overview-job.md) tab and `Run History`.
* [Source Code](./configurations/source-code-job.md)

* [Workflow editor](./configurations/workflow-editor-job.md)

* [ConfigMaps & Secrets](./configurations/configmap-secret/README.md)

* [ConfigMaps](./configurations/configmap-secret/configmap-job.md)

* [Secrets](./configurations/configmap-secret/secret-job.md)

* [Environments Override](./configurations/environment-override-job.md)

* [Trigger Job ](./triggering-job.md)

* [Run History](./run-history-job.md)

* [Job Overview](./overview-job.md)
9 changes: 0 additions & 9 deletions docs/user-guide/jobs/configuration-job.md

This file was deleted.

11 changes: 11 additions & 0 deletions docs/user-guide/jobs/configurations/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Configuration

After you have created a Job, the next step is, to configure the job. This means specifying the source code and using the Workflow Editor to create and configure the job pipeline, which include defining tasks such as code scanning, vulnerability checks, or data migrations, and configuring the sequence in which these tasks should be executed.

In the following sections we will explore how you can configure your Job which includes,

1. Configuring the [Source Code](./source-code-job.md)

2. Creating and configuring the job pipeline through [Workflow Editor](./workflow-editor-job.md).

3. Defining [ConfigMaps](./configmap-secret/configmap-job.md) & [Secrets](./configmap-secret/secret-job.md), and [Environment Overrides](./environment-override-job.md) for the job.
10 changes: 10 additions & 0 deletions docs/user-guide/jobs/configurations/configmap-secret/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# ConfigMaps & Secrets
## ConfigMaps
A ConfigMap stores key-value pairs that your jobs can use as environment variables or mounted files. ConfigMaps are meant for non-sensitive data. Moreover, you can update configurations without modifying or rebuilding your container images, thus making the deployments more efficient.

To configure a ConfigMap for your job-pipeline, refer the [ConfigMaps](./configmap-job) section.

## Secrets
Secrets and ConfigMaps are both used to store configurations but there is one major difference between them: ConfigMap stores key-values in normal text format; whereas secrets store them in base64 encrypted form. Devtron hides the data of secrets for the normal users and it is only visible to the users having edit permission.

To configure a Secret for your job-pipeline, refer the [Secrets](./secret-job) section.
Original file line number Diff line number Diff line change
@@ -0,0 +1,197 @@
# ConfigMaps

A ConfigMap stores key-value pairs that your jobs can use as environment variables or mounted files. Unlike secrets, ConfigMaps are meant for non-sensitive data. Moreover, you can update configurations without modifying or rebuilding your container images, thus making the deployments more efficient.

---

## Add ConfigMap

{% hint style="warning" %}
### Who Can Perform This Action?
Users need to have **Admin role** or **Super Admin role**.
Refer the [User permissions](../global-configurations/authorization/user-access.md#roles-available-for-jobs).
{% endhint %}

1. Go to the **Configurations** → **ConfigMaps & Secrets**.

![Figure 1a: ConfigMaps & Secrets](https://devtron-public-asset.s3.us-east-2.amazonaws.com/images/create-job/configmap.jpg)

2. Click the **+** button next to **ConfigMaps**.

![Figure 1b: Create ConfigMap](https://devtron-public-asset.s3.us-east-2.amazonaws.com/images/create-job/configmap-add.jpg)

3. Enter a name for the ConfigMap (Once defined, name cannot be changed later).

In case, you are using a External Kubernetes ConfigMap, name should be exactly same as the as the name given using `kubectl create configmap <configmap-name> <data source>` command.

![Figure 1c: Enter ConfigMap name](https://devtron-public-asset.s3.us-east-2.amazonaws.com/images/create-job/configmap-name.jpg)

4. **Data Type** - Choose between the following data types:

* **Kubernetes ConfigMap**: Select the Data Type as Kubernetes ConfigMap, if you wish to create and use the ConfigMap using Devtron.

* **Kubernetes External ConfigMap**: Select the Data Type as Kubernetes External ConfigMap if you have already created a ConfigMap using the kubectl command and wants to use that in Devtron.

![Figure 1d: ConfigMap data type](https://devtron-public-asset.s3.us-east-2.amazonaws.com/images/create-job/configmap-data-type.jpg)

5. After selecting the data type, you can choose how to mount the data of your ConfigMap. Devtron allows you to mount ConfigMap Data in following ways <br><br> **Mount data as** - Select how you want to mount the ConfigMap:

* [**Environment Variable**](#mount-data-as-environment-variables) – Select this option if you want to inject Environment Variables in pods using ConfigMap.

* [**Data Volume**](#mount-data-as-data-volume) – Select this option, if you want to configure a Data Volume that is accessible to Containers running in a pod and provide a Volume mount path. Go to [Data Volume](#mount-data-as-data-valume) to know more.

![Figure 1e: Mount data as](https://devtron-public-asset.s3.us-east-2.amazonaws.com/images/create-job/configmap-mount-data.jpg)

### Mount data as environment variables

This will pass your ConfigMap data into your Job pod as environment variables, thus making the configurations values directly accessible by your job.

#### For Kubernetes ConfigMap

If you have selected Data type as `Kubernetes ConfigMap` and mount data as `Environment Variable` then, you also need to enter the required data (key-value pairs) in the **Data** field<br><br>Enter data in:

* **GUI mode** – User-friendly interface. Click **+Add** button and enter the **Key** and **Value** fields without quotes.

![Figure 2a: Enter data in 'GUI' mode](https://devtron-public-asset.s3.us-east-2.amazonaws.com/images/create-job/configmap-env-var-gui.jpg)

* **YAML mode** – Raw YAML for entering key-value pairs in the format **`key: value`**. Boolean and numeric values must be wrapped in double quotes.

![Figure 2b: Enter data in 'YAML' mode](https://devtron-public-asset.s3.us-east-2.amazonaws.com/images/create-job/configmap-env-var-yaml.jpg)

#### For Kubernetes External ConfigMap

If you have selected Data type as `Kubernetes External ConfigMap` then, no data is required as devtron will fetch the external ConfigMap data and use it to create a ConfigMap.

![Figure 3: Kubernetes External ConfigMap for 'Environment Variable'](https://devtron-public-asset.s3.us-east-2.amazonaws.com/images/create-job/configmap-data-external-env.jpg)

### Mount data as Data Volume

This option allows you to create a ConfigMap by passing the content of a file. The content could be a plain text, json, yaml, bash script, etc.

![Figure 4a: Mount Data as Data Volume](https://devtron-public-asset.s3.us-east-2.amazonaws.com/images/create-job/configmap-data-vol.jpg)

### Volume Mount Path

Enter the folder path where the data volume should be mounted for it to be accessible to the containers running in a pod. Your keys will be mounted as files to that volume.

![Figure 4b: Volume Mount Path](https://devtron-public-asset.s3.us-east-2.amazonaws.com/images/create-job/configmap-data-vol-mount-path.jpg)

### Set Sub Path

When mounting multiple files to the same location, you can use the **Set Sub Path** option to control how the files are handled. This setting allows you to control whether existing files are overwritten or preserved when mounting new files.

* If **Set Sub Path** is enabled, the system will preserve existing files in the [specified path](#volume-mount-path) and append the new file using the file name as a sub-path.

* If **Set Sub Path** is disabled (unchecked), the system will delete any files already present in the [specified path](#volume-mount-path) and then mount the new files.

![Figure 4b: Set Sub Path](https://devtron-public-asset.s3.us-east-2.amazonaws.com/images/create-job/configmap-data-vol-set-subpath.jpg)

{% hint style="info" %}
### Note
In case of Kubernetes ConfigMap, all keys will be mounted as files on the specified path.
In case of Kubernetes External ConfigMap, manually specify the keys which should be mounted as files.
{% endhint %}

### Set File Permission

The **Set File Permission** option applies permissions at the ConfigMap level, not to individual keys within the ConfigMap. Enabling this option will let you enter a 3-digit standard permission value to control access to the file.

![Figure 4c: Set File Permission](https://devtron-public-asset.s3.us-east-2.amazonaws.com/images/create-job/configmap-data-vol-set-file-per.jpg)

The 3-digit numeric value represents the permission settings for the file:

* **First digit**: Owner permissions (user).
* **Second digit**: Group permissions.
* **Third digit**: Other users' permissions.

| **Permission** | **Description** |
|----------------|------------------------------------------------|
| **r** (read) | Grants the ability to read the file. |
| **w** (write) | Grants the ability to modify the file. |
| **x** (execute)| Grants the ability to execute the file as a program. |

For example, **755** means:
* Owner can read, write, and execute (7),
* Group can read and execute (5),
* Others can read and execute (5).

### Data

#### For Kubernetes ConfigMap

If you have selected Data type as `Kubernetes ConfigMap` and mount data as `Data Volume` then, you also need to enter the required data (key-value pairs) in the **Data** field.

The key of the ConfigMap should be your filename and the value of the ConfigMap should be your file content. In the below example, you `file.json` is the key, and the json content is the value of that ConfigMap (below the pipe (**|**) symbol). This file will be created on your specified [volume mount path](#volume-mount-path).

Enter data in:

* **GUI mode** – User-friendly interface. Click **+Add** button and enter the **Key** and **Value** fields without quotes.

![Figure 5a: Enter data in 'GUI' mode](https://devtron-public-asset.s3.us-east-2.amazonaws.com/images/create-job/configmap-data-vol-gui.jpg)

* **YAML mode** – Raw YAML for entering key-value pairs in the format **`key: value`**. Boolean and numeric values must be wrapped in double quotes.

![Figure 5b: Enter data in 'YAML' mode](https://devtron-public-asset.s3.us-east-2.amazonaws.com/images/create-job/configmap-data-vol-yaml.jpg)

#### For Kubernetes External ConfigMap

If you have selected Data type as `Kubernetes External ConfigMap` then, no data is required as devtron will fetch the external ConfigMap along with any volumes attach with it and use it to create a ConfigMap.

![Figure 6a: Kubernetes External ConfigMap for 'Data Volume'](https://devtron-public-asset.s3.us-east-2.amazonaws.com/images/create-job/configmap-data-external-data-vol.jpg)

6. Select **Save** to create a ConfigMap.

---

## Update ConfigMap

{% hint style="warning" %}
### Who Can Perform This Action?
Users need to have **Admin role** or **Super Admin role**.
Refer the [User permissions](../global-configurations/authorization/user-access.md#roles-available-for-jobs).
{% endhint %}

1. Click your ConfigMap available inside the list of **ConfigMaps** inside **ConfigMaps & Secrets**.

2. Modify its values.

3. Click **Save Changes**.

![Figure 7a: Update ConfigMap](https://devtron-public-asset.s3.us-east-2.amazonaws.com/images/create-job/configmap-update.jpg)

{% hint style="warning" %}
### Note
You cannot change the name of a ConfigMap. Create a new ConfigMap instead.
{% endhint %}

---

## Delete ConfigMap

{% hint style="warning" %}
### Who Can Perform This Action?
Users need to have **Admin role** or **Super Admin role**.
Refer the [User permissions](../global-configurations/authorization/user-access.md#roles-available-for-jobs).
{% endhint %}

You may delete a ConfigMap if not in use anymore. Once a ConfigMap is deleted, it will not be used in future deployments.

1. Click your ConfigMap available inside the list of **ConfigMaps** inside **Base Configurations**.

2. On the right side, click the kebab menu (3 vertical dots).

3. Click **Delete**.

4. Confirm the deletion in the dialog box.

![Figure 8a: Delete ConfigMap](https://devtron-public-asset.s3.us-east-2.amazonaws.com/images/create-job/configmap-delete.jpg)

---

After configuring ConfigMaps

* Refer the [Secrets](./secret-job.md) section to configure secrets

* Refer the [Environment Override](../environment-override-job.md) section to configure Environment Overrides.

* Refer the [Trigger Job](../../triggering-job.md) section to trigger the job-pipeline.
Loading