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

Draft
wants to merge 8 commits into
base: main
Choose a base branch
from
Draft
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
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](./configuration-job.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](./configuration/source-code.md)

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

* [ConfigMaps & Secrets](./configuration/config-maps-and-secrets/README.md)

* [ConfigMaps](./configuration/config-maps-and-secrets/configmaps.md)

* [Secrets](./configuration/config-maps-and-secrets/secrets.md)

* [Environments Override](./configuration/environment-overrides.md)

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

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

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

This file was deleted.

9 changes: 9 additions & 0 deletions docs/user-guide/jobs/configurations/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# 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](/jobs/configuration/source-code.md)
2. Creating and configuring the job pipeline through [Workflow Editor](/jobs/configuration/workflow-editor.md).
3. Defining [ConfigMaps](/jobs/configuration/config-maps-and-secrets/configmaps.md) & [Secrets](/jobs/configuration/config-maps-and-secrets/secrets.md), and [Environment Overrides](/jobs/configuration/environment-overrides.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.
149 changes: 149 additions & 0 deletions docs/user-guide/jobs/configurations/configmap-secret/configmap-job
Original file line number Diff line number Diff line change
@@ -0,0 +1,149 @@
# 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

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

<!-- ![Figure 1: Application's 'Configurations' Page](https://devtron-public-asset.s3.us-east-2.amazonaws.com/images/creating-application/config-maps/appconfig-page.jpg) -->

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

<!-- ![Figure 2: Adding ConfigMap](https://devtron-public-asset.s3.us-east-2.amazonaws.com/images/creating-application/config-maps/config-map.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.

4. **Data Type** - Choose between the following data types:
* [Kubernetes ConfigMap](#kubernetes-configmap): Select the Data Type as Kubernetes ConfigMap, if you wish to create and use the ConfigMap using Devtron.

* [Kubernetes External ConfigMap](#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.

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.

### Mount data as environment variables

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

#### For Kubernetes ConfigMap

If you have selected Data type as `Kubernetes ConfigMap` 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.

<!-- Image -->

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

{% embed url="https://www.youtube.com/watch?v=QfJqX6KM2lU" %}

#### 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.

### Mount data as Data Volume
<!-- **Create ConfigMap from File** -->
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 4: Selecting Data Volume Option](https://devtron-public-asset.s3.us-east-2.amazonaws.com/images/creating-application/config-maps/cm-data-volume.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.

### 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.

{% 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.

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

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).

![Figure 5: Adding File Content](https://devtron-public-asset.s3.us-east-2.amazonaws.com/images/creating-application/config-maps/filecontent-cm.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.

7. You may [perform a dry run](#perform-a-dry-run) before clicking **Save**.

8. Select **Save** to create a ConfigMap.
---

## Perform a Dry Run

Before saving your configured ConfigMap, you can use the **Dry Run** option (as shown below) to preview the final Kubernetes manifest.

This feature helps you verify your configurations, detect issues, and ensure correctness.

![Figure 6: Performing a Dry Run](https://devtron-public-asset.s3.us-east-2.amazonaws.com/images/creating-application/config-maps/dry-run-cm.gif)

Your configurations will appear in the left pane, while the right pane will display a section named `Manifest generated from merged` showing the computed Kubernetes manifest.

---

## Update ConfigMap

1. Click your ConfigMap available inside the list of **ConfigMaps** inside **Base Configurations**.
2. Modify its values.
3. Click **Update**.

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

![Figure 7: Updating Existing ConfigMap](https://devtron-public-asset.s3.us-east-2.amazonaws.com/images/creating-application/config-maps/update_configmap.jpg)

---

## Delete ConfigMap

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 dialogbox.

![Figure 8: Deleting ConfigMap](https://devtron-public-asset.s3.us-east-2.amazonaws.com/images/creating-application/config-maps/delete_configmap.jpg)

---
Loading