|
| 1 | +# Devtron-Job-Trigger |
| 2 | + |
| 3 | +## Introduction |
| 4 | +The **Devtron Job Trigger** plugin enables you to trigger Devtron Jobs from your current application workflow. For example, by integrating this plugin at the pre-deployment stage of your application workflow, you can trigger jobs designed to run migration scripts in your database. This ensures that necessary migrations are executed before your application is deployed. |
| 5 | + |
| 6 | +### Prerequisites |
| 7 | +Before integrating the Devtron Job Trigger plugin, you need to properly configure the target Devtron Job to ensure smooth execution. |
| 8 | + |
| 9 | +--- |
| 10 | + |
| 11 | +## Steps |
| 12 | +1. Go to **Applications** → **Devtron Apps**. |
| 13 | +2. Click your application. |
| 14 | +3. Go to **App Configuration** → **Workflow Editor**. |
| 15 | +4. Click **New Workflow** and navigate to the **Build and Deploy from Source Code**. |
| 16 | +5. Fill the required fields in the **Create build pipeline** window and navigate to the **Create deployment pipeline**. |
| 17 | +6. Fill the required fields in the **Deployment Stage** window and navigate to the **Pre-Deployment stage**. |
| 18 | + |
| 19 | +{% hint style="warning" %} |
| 20 | +If you have already configured workflow, edit the deployment pipeline, and navigate to **Pre-Deployment stage**. |
| 21 | +{% endhint %} |
| 22 | + |
| 23 | +6. Under 'TASKS', click the **+ Add task** button. |
| 24 | +7. Select the **Devtron Job Trigger** plugin. |
| 25 | +8. Enter the following [user inputs](#user-inputs) with appropriate values. |
| 26 | +--- |
| 27 | + |
| 28 | +## User Inputs |
| 29 | + |
| 30 | +### Task Name |
| 31 | +Enter the name of your task |
| 32 | + |
| 33 | +e.g., `Triggers Devtron Job ` |
| 34 | + |
| 35 | +### Description |
| 36 | +Add a brief explanation of the task and the reason for choosing the plugin. Include information for someone else to understand the purpose of the task. |
| 37 | + |
| 38 | +e.g., `The Devtron Job Trigger plugin is integrated for triggering the Devtron Job.` |
| 39 | + |
| 40 | +### Input Variables |
| 41 | + |
| 42 | +| Variable | Format | Description | Sample Value | |
| 43 | +| ------------------------ | ------------ | ----------- | ------------ | |
| 44 | +| DevtronApiToken | STRING | Enter Devtron API token with required permissions. | abc123def456token789 | |
| 45 | +| DevtronEndpoint | STRING | Enter the URL of Devtron dashboard. | https://devtron.example.com | |
| 46 | +| DevtronJob | STRING | Enter the name or ID of Devtron Job to be triggered | plugin-test-job | |
| 47 | +| DevtronEnv | STRING | Enter the name or ID of the Environment where the job is to be triggered. If JobPipeline is given, ignore this field and do not assign any value | prod | |
| 48 | +| JobPipeline | STRING | Enter the name or ID of the Job pipeline to be triggered. If DevtronEnv is given, ignore this field and do not assign any value | hello-world | |
| 49 | +| GitCommitHash | STRING | Enter the commit hash from which the job is to be triggered. If not given then, will pick the latest | cf19e4fd348589kjhsdjn092nfse01d2234235sdsg | |
| 50 | +| StatusTimeoutSeconds | NUMBER | Enter the maximum time to wait for the job status | 120 | |
| 51 | + |
| 52 | +### Trigger/Skip Condition |
| 53 | +Here you can set conditions to execute or skip the task. You can select `Set trigger conditions` for the execution of a task or `Set skip conditions` to skip the task. |
| 54 | + |
| 55 | +### Output Variables |
| 56 | +Devtron Job Trigger will not be generating an output variable. |
| 57 | + |
| 58 | +Click **Update Pipeline**. |
| 59 | + |
| 60 | + |
| 61 | + |
0 commit comments