Skip to content
Merged
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
172 changes: 172 additions & 0 deletions docs/content/docs/reference/components/jenkins.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,172 @@
---
title: "Jenkins"
description: "Jenkins is leading open source automation server, Jenkins provides hundreds of plugins to support building, deploying and automating any project."
---


Categories: Developer Tools


Type: jenkins/v1

<hr />



## Connections

Version: 1


### basic_auth

#### Properties

| Name | Label | Type | Description | Required |
|:---------------:|:--------------:|:------------:|:-------------------:|:--------:|
| username | Username | STRING | Jenkins username. | true |
| password | API Token | STRING | Jenkins API token. | true |
| baseUri | Base URI | STRING | Complete base URI of your jenkins server. | true |





<hr />


## Actions


### Create Job
Name: createJob

`Creates a new job.`

#### Properties

| Name | Label | Type | Description | Required |
|:---------------:|:--------------:|:------------:|:-------------------:|:--------:|
| name | Name | STRING | Name of the job. | true |
| configXml | Config XML | STRING | Content of the config.xml file. | true |

#### Example JSON Structure
```json
{
"label" : "Create Job",
"name" : "createJob",
"parameters" : {
"name" : "",
"configXml" : ""
},
"type" : "jenkins/v1/createJob"
}
```

#### Output

This action does not produce any output.





## Triggers


### New Job Status Notification
Name: newJobStatusNotification

`Triggers when job statuses are changed.`

Type: STATIC_WEBHOOK


#### Output



Type: OBJECT


#### Properties

| Name | Type | Description |
|:------------:|:------------:|:-------------------:|
| name | STRING | Name of the Jenkins job. |
| display_name | STRING | Display name of the Jenkins job. |
| url | STRING | URL of the Jenkins job. |
| build | OBJECT <details> <summary> Properties </summary> &#123;STRING\(full_url), INTEGER\(number), INTEGER\(queue_id), NUMBER\(timestamp), INTEGER\(duration), STRING\(phase), STRING\(url), &#123;[]\(changes), []\(culprits)&#125;\(scm), STRING\(log), STRING\(notes), &#123;&#125;\(artifacts)&#125; </details> | Jenkins job build. |




#### JSON Example
```json
{
"label" : "New Job Status Notification",
"name" : "newJobStatusNotification",
"type" : "jenkins/v1/newJobStatusNotification"
}
```


<hr />


## What to do if your action is not listed here?

If this component doesn't have the action you need, you can use **Custom Action** to create your own. Custom Actions empower you to define HTTP requests tailored to your specific requirements, allowing for greater flexibility in integrating with external services or APIs.

To create a Custom Action, simply specify the desired HTTP method, path, and any necessary parameters. This way, you can extend the functionality of your component beyond the predefined actions, ensuring that you can meet all your integration needs effectively.

<hr />

# Additional Instructions

## Connection Setup

### Create Jenkins API Token

1. Click on **Manage Jenkins** icon.
2. Click on **Users**.
3. Click this icon on the user you want to create the API token for.
4. Click on **Security**.
5. Click on **Add new token**.
6. Enter name of the token and then click on **Generate**.
7. Copy token, you will not be able to see the whole token again.
8. Click on **Done**.

<div style={{ position: 'relative', height:0, width: '100%', overflow: 'hidden', zIndex: 99999, boxSizing: 'border-box', paddingBottom: 'calc(50.05219207% + 32px)'}}>
<iframe src="https://www.guidejar.com/embed/152dd033-4f42-4501-88cc-e6a5a4a2d4e2?type=1&controls=on" width="100%" height="100%" style={{height:'100%', position:'absolute', inset:0}} allowfullscreen frameborder="0"></iframe>
</div>

## Trigger Setup

### Enable Notification Plugin

1. Click this icon.
2. Click on **Plugins**.
3. Click on **Available plugins**.
4. Search for **notification**.
5. Click on **Notification** from **Tikal Knowledge**. [Notification plugin link](https://plugins.jenkins.io/notification/)
6. Click here.
7. Click on **Install**.
8. Wait for everything to finish downloading.
9. Click on **Go back to the top page**.

<div style={{ position: 'relative', height:0, width: '100%', overflow: 'hidden', zIndex: 99999, boxSizing: 'border-box', paddingBottom: 'calc(50.05219207% + 32px)'}}>
<iframe src="https://www.guidejar.com/embed/ef274d47-9a11-4394-afde-2b93679f73b2?type=1&controls=on" width="100%" height="100%" style={{height:'100%', position:'absolute', inset:0}} allowfullscreen frameborder="0"></iframe>
</div>

### Trigger URL Setup

1. Select Jenkins job to which you want to connect the trigger to.
2. Click this **Configure**.
3. Click on **Add Endpoint**.
4. Paste Webhook URL. See [Deploy documentation](https://docs.bytechef.io/automation/deploy) on how to get Webhook URL.
5. Click on **Save**.

<div style={{ position: 'relative', height:0, width: '100%', overflow: 'hidden', zIndex: 99999, boxSizing: 'border-box', paddingBottom: 'calc(50.05219207% + 32px)'}}>
<iframe src="https://www.guidejar.com/embed/41f291bd-ac7c-4cec-af6b-c5922be20ac0?type=1&controls=on" width="100%" height="100%" style={{height:'100%', position:'absolute', inset:0}} allowfullscreen frameborder="0"></iframe>
</div>
1 change: 1 addition & 0 deletions server/apps/server-app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,7 @@ dependencies {
implementation(project(":server:libs:modules:components:infobip"))
implementation(project(":server:libs:modules:components:insightly"))
implementation(project(":server:libs:modules:components:intercom"))
implementation(project(":server:libs:modules:components:jenkins"))
implementation(project(":server:libs:modules:components:jira"))
implementation(project(":server:libs:modules:components:jotform"))
implementation(project(":server:libs:modules:components:json-file"))
Expand Down
1 change: 1 addition & 0 deletions server/ee/apps/worker-app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,7 @@ dependencies {
implementation(project(":server:libs:modules:components:infobip"))
implementation(project(":server:libs:modules:components:insightly"))
implementation(project(":server:libs:modules:components:intercom"))
implementation(project(":server:libs:modules:components:jenkins"))
implementation(project(":server:libs:modules:components:jira"))
implementation(project(":server:libs:modules:components:jotform"))
implementation(project(":server:libs:modules:components:json-file"))
Expand Down
2 changes: 2 additions & 0 deletions server/libs/modules/components/jenkins/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
version="1.0"

Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
/*
* Copyright 2025 ByteChef
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package com.bytechef.component.jenkins;

import static com.bytechef.component.definition.ComponentDsl.component;
import static com.bytechef.component.definition.ComponentDsl.tool;

import com.bytechef.component.ComponentHandler;
import com.bytechef.component.definition.ComponentCategory;
import com.bytechef.component.definition.ComponentDefinition;
import com.bytechef.component.jenkins.action.JenkinsCreateJobAction;
import com.bytechef.component.jenkins.connection.JenkinsConnection;
import com.bytechef.component.jenkins.trigger.JenkinsNewJobStatusNotificationTrigger;
import com.google.auto.service.AutoService;

/**
* @author Nikolina Spehar
*/
@AutoService(ComponentHandler.class)
public class JenkinsComponentHandler implements ComponentHandler {

private static final ComponentDefinition COMPONENT_DEFINITION = component("jenkins")
.title("Jenkins")
.description(
"Jenkins is leading open source automation server, Jenkins provides hundreds of plugins to support " +
"building, deploying and automating any project.")
.icon("path:assets/jenkins.svg")
.categories(ComponentCategory.DEVELOPER_TOOLS)
.actions(JenkinsCreateJobAction.ACTION_DEFINITION)
.clusterElements(tool(JenkinsCreateJobAction.ACTION_DEFINITION))
.connection(JenkinsConnection.CONNECTION_DEFINITION)
.triggers(JenkinsNewJobStatusNotificationTrigger.TRIGGER_DEFINITION)
.customAction(true);

@Override
public ComponentDefinition getDefinition() {
return COMPONENT_DEFINITION;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
/*
* Copyright 2025 ByteChef
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package com.bytechef.component.jenkins.action;

import static com.bytechef.component.definition.ComponentDsl.action;
import static com.bytechef.component.definition.ComponentDsl.string;
import static com.bytechef.component.jenkins.constant.JenkinsConstants.CONFIG_XML;
import static com.bytechef.component.jenkins.constant.JenkinsConstants.NAME;

import com.bytechef.component.definition.ComponentDsl.ModifiableActionDefinition;
import com.bytechef.component.definition.Context;
import com.bytechef.component.definition.Context.Http.Body;
import com.bytechef.component.definition.Parameters;

/**
* @author Nikolina Spehar
*/
public class JenkinsCreateJobAction {

public static final ModifiableActionDefinition ACTION_DEFINITION = action("createJob")
.title("Create Job")
.description("Creates a new job.")
.properties(
string(NAME)
.label("Name")
.description("Name of the job.")
.required(true),
string(CONFIG_XML)
.label("Config XML")
.description("Content of the config.xml file.")
.required(true))
.perform(JenkinsCreateJobAction::perform);

private JenkinsCreateJobAction() {
}

public static Object perform(Parameters inputParameters, Parameters connectionParameters, Context context) {
context.http(http -> http.post("/createItem"))
.header("Content-Type", "application/xml")
.queryParameter(NAME, inputParameters.getRequiredString(NAME))
.body(Body.of(inputParameters.getRequiredString(CONFIG_XML), "application/xml"))
.execute();

return null;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
/*
* Copyright 2025 ByteChef
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package com.bytechef.component.jenkins.connection;

import static com.bytechef.component.definition.Authorization.PASSWORD;
import static com.bytechef.component.definition.Authorization.USERNAME;
import static com.bytechef.component.definition.ComponentDsl.authorization;
import static com.bytechef.component.definition.ComponentDsl.connection;
import static com.bytechef.component.definition.ComponentDsl.string;
import static com.bytechef.component.jenkins.constant.JenkinsConstants.BASE_URI;

import com.bytechef.component.definition.Authorization.AuthorizationType;
import com.bytechef.component.definition.ComponentDsl.ModifiableConnectionDefinition;

/**
* @author Nikolina Spehar
*/
public class JenkinsConnection {

public static final ModifiableConnectionDefinition CONNECTION_DEFINITION = connection()
.baseUri((connectionParameters, context) -> connectionParameters.getRequiredString(BASE_URI))
.authorizations(
authorization(AuthorizationType.BASIC_AUTH)
.properties(
string(USERNAME)
.label("Username")
.description("Jenkins username.")
.required(true),
string(PASSWORD)
.label("API Token")
.description("Jenkins API token.")
.required(true),
string(BASE_URI)
.label("Base URI")
.description("Complete base URI of your jenkins server.")
.required(true)));

private JenkinsConnection() {
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/*
* Copyright 2025 ByteChef
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package com.bytechef.component.jenkins.constant;

/**
* @author Nikolina Spehar
*/
public class JenkinsConstants {

public static final String BASE_URI = "baseUri";
public static final String CONFIG_XML = "configXml";
public static final String NAME = "name";

private JenkinsConstants() {
}
}
Loading