Skip to content

Commit

Permalink
Add Jira sink (#951)
Browse files Browse the repository at this point in the history
* Added Jira Sink - Add Issue kamelet

* Added Jira Sink - Add Comment kamelet

* Added Jira Sink - Update Issue kamelet

* Added Jira Sink - Transition Issue kamelet
  • Loading branch information
claudio4j committed Jun 28, 2022
1 parent 08dae17 commit d63e6e1
Show file tree
Hide file tree
Showing 23 changed files with 1,777 additions and 180 deletions.
4 changes: 4 additions & 0 deletions docs/modules/ROOT/nav.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,11 @@
* xref:insert-field-action.adoc[]
* xref:insert-header-action.adoc[]
* xref:is-tombstone-filter-action.adoc[]
* xref:jira-add-comment-sink.adoc[]
* xref:jira-add-issue-sink.adoc[]
* xref:jira-source.adoc[]
* xref:jira-transition-issue-sink.adoc[]
* xref:jira-update-issue-sink.adoc[]
* xref:jms-amqp-10-sink.adoc[]
* xref:jms-amqp-10-source.adoc[]
* xref:jms-apache-activemq-sink.adoc[]
Expand Down
91 changes: 91 additions & 0 deletions kamelets/jira-add-comment-sink.kamelet.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
# ---------------------------------------------------------------------------
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You 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
#
# http://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.
# ---------------------------------------------------------------------------
apiVersion: camel.apache.org/v1alpha1
kind: Kamelet
metadata:
name: jira-add-comment-sink
annotations:
camel.apache.org/kamelet.support.level: "Preview"
camel.apache.org/catalog.version: "main-SNAPSHOT"
camel.apache.org/kamelet.icon: "data:image/svg+xml;base64,PD94bWwgdm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BDMy43NTM5MTM2MmUtMTUsMTUzLjE0MTkyIDI0Ljg0OTE5MTMsMTc3Ljk5MTExMSA1NS41MDIyMjIyLDE3Ny45OTExMTEgTDc4LjIyMjIyMjIsMTc3Ljk5MTExMSBMNzguMjIyMjIyMiwxOTkuODU3Nzc4IEM3OC4yNDE3NjcsMjMwLjQ1NTMyIDEwMy4wMjAyODUsMjU1LjI2NTY0NyAxMzMuNjE3Nzc4LDI1NS4zMjQ0NDQgTDEzMy42MTc3NzgsMTMzLjE1NTU1NiBDMTMzLjYxNzc3OCwxMjcuMjY0NTE4IDEyOC44NDIxNDgsMTIyLjQ4ODg4OSAxMjIuOTUxMTExLDEyMi40ODg4ODkgWiIgZmlsbD0idXJsKCNsaW5lYXJHcmFkaWVudC0yKSI+PC9wYXRoPgoJCTwvZz4KPC9zdmc+Cg=="
camel.apache.org/provider: "Apache Software Foundation"
camel.apache.org/kamelet.group: "JIRA"
labels:
camel.apache.org/kamelet.type: "sink"
spec:
definition:
title: "Jira Add Comment Sink"
description: |-
Add a new comment to an existing issue in Jira.
The Kamelet expects the following headers to be set:
- `issueKey` / `ce-issueKey`: as the issue code.
The comment is set in the body of the message.
required:
- jiraUrl
- username
- password
type: object
properties:
jiraUrl:
title: Jira URL
description: The URL of your instance of Jira
type: string
example: http://my_jira.com:8081
username:
title: Username
description: The username to access Jira
type: string
x-descriptors:
- urn:camel:group:credentials
password:
title: Password
description: The password or the API Token to access Jira
type: string
format: password
x-descriptors:
- urn:alm:descriptor:com.tectonic.ui:password
- urn:camel:group:credentials
types:
in:
mediaType: application/json
dependencies:
- "camel:core"
- "camel:jackson"
- "camel:jira"
- "camel:kamelet"
- "mvn:com.fasterxml.jackson.datatype:jackson-datatype-joda:2.12.5"
template:
from:
uri: "kamelet:source"
steps:
- choice:
when:
- simple: "${header[ce-issueKey]}"
steps:
- set-header:
name: issueKey
simple: "${header[ce-issueKey]}"
- to:
uri: "jira:AddComment"
parameters:
jiraUrl: "{{jiraUrl}}"
username: "{{username}}"
password: "{{password}}"
145 changes: 145 additions & 0 deletions kamelets/jira-add-issue-sink.kamelet.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,145 @@
# ---------------------------------------------------------------------------
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You 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
#
# http://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.
# ---------------------------------------------------------------------------
apiVersion: camel.apache.org/v1alpha1
kind: Kamelet
metadata:
name: jira-add-issue-sink
annotations:
camel.apache.org/kamelet.support.level: "Preview"
camel.apache.org/catalog.version: "main-SNAPSHOT"
camel.apache.org/kamelet.icon: "data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPHN2ZyB3aWR0aD0iMjU2cHgiIGhlaWdodD0iMjU2cHgiIHZpZXdCb3g9IjAgMCAyNTYgMjU2IiB2ZXJzaW9uPSIxLjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHByZXNlcnZlQXNwZWN0UmF0aW89InhNaWRZTWlkIj4KICAgIDxkZWZzPgogICAgICAgIDxsaW5lYXJHcmFkaWVudCB4MT0iOTguMDMwODY3NSUiIHkxPSIwLjE2MDU5OTU3MiUiIHgyPSI1OC44ODc3MDYyJSIgeTI9IjQwLjc2NTUyNDYlIiBpZD0ibGluZWFyR3JhZGllbnQtMSI+CiAgICAgICAgICAgIDxzdG9wIHN0b3AtY29sb3I9IiMwMDUyQ0MiIG9mZnNldD0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kamelet.type: "sink"
spec:
definition:
title: "Jira Add Issue Sink"
description: |-
Add a new issue to Jira.
The Kamelet expects the following headers to be set:
- `projectKey` / `ce-projectKey`: as the Jira project key.
- `issueTypeName` / `ce-issueTypeName`: as the name of the issue type (example: Bug, Enhancement).
- `issueSummary` / `ce-issueSummary`: as the title or summary of the issue.
- `issueAssignee` / `ce-issueAssignee`: as the user assigned to the issue (Optional).
- `issuePriorityName` / `ce-issuePriorityName`: as the priority name of the issue (example: Critical, Blocker, Trivial) (Optional).
- `issueComponents` / `ce-issueComponents`: as list of string with the valid component names (Optional).
- `issueDescription` / `ce-issueDescription`: as the issue description (Optional).
The issue description can be set from the body of the message or the `issueDescription`/`ce-issueDescription` in the header, however the body takes precedence.
required:
- jiraUrl
- username
- password
type: object
properties:
jiraUrl:
title: Jira URL
description: The URL of your instance of Jira
type: string
example: http://my_jira.com:8081
username:
title: Username
description: The username to access Jira
type: string
x-descriptors:
- urn:camel:group:credentials
password:
title: Password
description: The password or the API Token to access Jira
type: string
format: password
x-descriptors:
- urn:alm:descriptor:com.tectonic.ui:password
- urn:camel:group:credentials
types:
in:
mediaType: application/json
dependencies:
- "camel:core"
- "camel:jackson"
- "camel:jira"
- "camel:kamelet"
- "mvn:com.fasterxml.jackson.datatype:jackson-datatype-joda:2.12.5"
template:
from:
uri: "kamelet:source"
steps:
- choice:
when:
- simple: "${header[ce-projectKey]}"
steps:
- set-header:
name: projectKey
simple: "${header[ce-projectKey]}"
- choice:
when:
- simple: "${header[ce-issueTypeName]}"
steps:
- set-header:
name: issueTypeName
simple: "${header[ce-issueTypeName]}"
- choice:
when:
- simple: "${header[ce-issueSummary]}"
steps:
- set-header:
name: issueSummary
simple: "${header[ce-issueSummary]}"
- choice:
when:
- simple: "${header[ce-issueAssignee]}"
steps:
- set-header:
name: issueAssignee
simple: "${header[ce-issueAssignee]}"
- choice:
when:
- simple: "${header[ce-issuePriorityName]}"
steps:
- set-header:
name: issuePriorityName
simple: "${header[ce-issuePriorityName]}"
- choice:
when:
- simple: "${header[ce-issueComponents]}"
steps:
- set-header:
name: issueComponents
simple: "${header[ce-issueComponents]}"
- choice:
when:
- simple: "${header[ce-issueDescription]}"
steps:
- set-header:
name: issueDescription
simple: "${header[ce-issueDescription]}"
- to:
uri: "jira:AddIssue"
parameters:
jiraUrl: "{{jiraUrl}}"
username: "{{username}}"
password: "{{password}}"
6 changes: 3 additions & 3 deletions kamelets/jira-source.kamelet.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ spec:
- urn:camel:group:credentials
password:
title: Password
description: The password to access Jira
description: The password or the API Token to access Jira
type: string
format: password
x-descriptors:
Expand All @@ -61,7 +61,7 @@ spec:
description: A query to filter issues
type: string
example: project=MyProject

types:
out:
mediaType: application/json
Expand All @@ -80,7 +80,7 @@ spec:
jql: "{{jql}}"
steps:
- marshal:
json:
json:
library: Jackson
module-class-names: com.fasterxml.jackson.datatype.joda.JodaModule
- to: "kamelet:sink"
Loading

0 comments on commit d63e6e1

Please sign in to comment.