This is an automated email from the ASF dual-hosted git repository. claudio4j pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/camel-kamelets.git
The following commit(s) were added to refs/heads/main by this push: new fe958c86 Support personal authentication to jira (#1530) fe958c86 is described below commit fe958c866ae29dd93887ec38298bd8ca1b32a5fb Author: Claudio Miranda <clau...@claudius.com.br> AuthorDate: Fri Jul 7 15:32:54 2023 -0300 Support personal authentication to jira (#1530) - Fix https://github.com/apache/camel-kamelets/issues/1529 - In case the maven plugin fails to a unknown parameter, list all available endpoint parameters --- kamelets/jira-add-comment-sink.kamelet.yaml | 17 ++++++++++++----- kamelets/jira-add-issue-sink.kamelet.yaml | 17 ++++++++++++----- kamelets/jira-source.kamelet.yaml | 18 +++++++++++++----- kamelets/jira-transition-issue-sink.kamelet.yaml | 17 ++++++++++++----- kamelets/jira-update-issue-sink.kamelet.yaml | 17 ++++++++++++----- .../kamelets/jira-add-comment-sink.kamelet.yaml | 17 ++++++++++++----- .../kamelets/jira-add-issue-sink.kamelet.yaml | 17 ++++++++++++----- .../main/resources/kamelets/jira-source.kamelet.yaml | 18 +++++++++++++----- .../kamelets/jira-transition-issue-sink.kamelet.yaml | 17 ++++++++++++----- .../kamelets/jira-update-issue-sink.kamelet.yaml | 17 ++++++++++++----- .../kamelets/maven/plugin/ValidateKameletsMojo.java | 12 ++++++++---- 11 files changed, 130 insertions(+), 54 deletions(-) diff --git a/kamelets/jira-add-comment-sink.kamelet.yaml b/kamelets/jira-add-comment-sink.kamelet.yaml index 3adaf695..22d7e51c 100644 --- a/kamelets/jira-add-comment-sink.kamelet.yaml +++ b/kamelets/jira-add-comment-sink.kamelet.yaml @@ -39,10 +39,10 @@ spec: The comment is set in the body of the message. + To authenticate a username/password or personal token must be defined. We recommend to use personal token as it is a safer way to get access to Jira. + required: - jiraUrl - - username - - password type: object properties: jiraUrl: @@ -58,12 +58,18 @@ spec: - urn:camel:group:credentials password: title: Password - description: The password or the API Token to access Jira + description: The password to access Jira type: string format: password x-descriptors: - urn:alm:descriptor:com.tectonic.ui:password - urn:camel:group:credentials + personal-token: + title: Personal Token + description: Personal Token + type: string + x-descriptors: + - urn:camel:group:credentials types: in: mediaType: application/json @@ -88,5 +94,6 @@ spec: uri: "jira:AddComment" parameters: jiraUrl: "{{jiraUrl}}" - username: "{{username}}" - password: "{{password}}" + username: "{{?username}}" + password: "{{?password}}" + access-token: "{{?personal-token}}" diff --git a/kamelets/jira-add-issue-sink.kamelet.yaml b/kamelets/jira-add-issue-sink.kamelet.yaml index dce205e2..b4b9a405 100644 --- a/kamelets/jira-add-issue-sink.kamelet.yaml +++ b/kamelets/jira-add-issue-sink.kamelet.yaml @@ -51,10 +51,10 @@ spec: 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. + To authenticate a username/password or personal token must be defined. We recommend to use personal token as it is a safer way to get access to Jira. + required: - jiraUrl - - username - - password type: object properties: jiraUrl: @@ -70,12 +70,18 @@ spec: - urn:camel:group:credentials password: title: Password - description: The password or the API Token to access Jira + description: The password to access Jira type: string format: password x-descriptors: - urn:alm:descriptor:com.tectonic.ui:password - urn:camel:group:credentials + personal-token: + title: Personal Token + description: Personal Token + type: string + x-descriptors: + - urn:camel:group:credentials types: in: mediaType: application/json @@ -142,5 +148,6 @@ spec: uri: "jira:AddIssue" parameters: jiraUrl: "{{jiraUrl}}" - username: "{{username}}" - password: "{{password}}" + username: "{{?username}}" + password: "{{?password}}" + access-token: "{{?personal-token}}" diff --git a/kamelets/jira-source.kamelet.yaml b/kamelets/jira-source.kamelet.yaml index f531cbcd..9e4c15f9 100644 --- a/kamelets/jira-source.kamelet.yaml +++ b/kamelets/jira-source.kamelet.yaml @@ -32,10 +32,11 @@ spec: title: "Jira Source" description: |- Receive notifications about new issues from Jira. + + To authenticate a username/password or personal token must be defined. We recommend to use personal token as it is a safer way to get access to Jira. + required: - jiraUrl - - username - - password type: object properties: jiraUrl: @@ -51,12 +52,18 @@ spec: - urn:camel:group:credentials password: title: Password - description: The password or the API Token to access Jira. + description: The password to access Jira. type: string format: password x-descriptors: - urn:alm:descriptor:com.tectonic.ui:password - urn:camel:group:credentials + personal-token: + title: Personal Token + description: Personal Token + type: string + x-descriptors: + - urn:camel:group:credentials jql: title: JQL description: A query to filter issues. @@ -76,8 +83,9 @@ spec: uri: "jira:newIssues" parameters: jiraUrl: "{{jiraUrl}}" - username: "{{username}}" - password: "{{password}}" + username: "{{?username}}" + password: "{{?password}}" + accessToken: "{{?personal-token}}" jql: "{{jql}}" steps: - marshal: diff --git a/kamelets/jira-transition-issue-sink.kamelet.yaml b/kamelets/jira-transition-issue-sink.kamelet.yaml index 19d71fb7..be4a8841 100644 --- a/kamelets/jira-transition-issue-sink.kamelet.yaml +++ b/kamelets/jira-transition-issue-sink.kamelet.yaml @@ -41,10 +41,10 @@ spec: The comment of the transition is set in the body of the message. + To authenticate a username/password or personal token must be defined. We recommend to use personal token as it is a safer way to get access to Jira. + required: - jiraUrl - - username - - password type: object properties: jiraUrl: @@ -60,12 +60,18 @@ spec: - urn:camel:group:credentials password: title: Password - description: The password or the API Token to access Jira + description: The password to access Jira type: string format: password x-descriptors: - urn:alm:descriptor:com.tectonic.ui:password - urn:camel:group:credentials + personal-token: + title: Personal Token + description: Personal Token + type: string + x-descriptors: + - urn:camel:group:credentials types: in: mediaType: application/json @@ -97,5 +103,6 @@ spec: uri: "jira:transitionIssue" parameters: jiraUrl: "{{jiraUrl}}" - username: "{{username}}" - password: "{{password}}" + username: "{{?username}}" + password: "{{?password}}" + access-token: "{{?personal-token}}" diff --git a/kamelets/jira-update-issue-sink.kamelet.yaml b/kamelets/jira-update-issue-sink.kamelet.yaml index 590c3d80..3530ed79 100644 --- a/kamelets/jira-update-issue-sink.kamelet.yaml +++ b/kamelets/jira-update-issue-sink.kamelet.yaml @@ -51,10 +51,10 @@ spec: 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. + To authenticate a username/password or personal token must be defined. We recommend to use personal token as it is a safer way to get access to Jira. + required: - jiraUrl - - username - - password type: object properties: jiraUrl: @@ -70,12 +70,18 @@ spec: - urn:camel:group:credentials password: title: Password - description: The password or the API Token to access Jira + description: The password to access Jira type: string format: password x-descriptors: - urn:alm:descriptor:com.tectonic.ui:password - urn:camel:group:credentials + personal-token: + title: Personal Token + description: Personal Token + type: string + x-descriptors: + - urn:camel:group:credentials types: in: mediaType: application/json @@ -142,5 +148,6 @@ spec: uri: "jira:UpdateIssue" parameters: jiraUrl: "{{jiraUrl}}" - username: "{{username}}" - password: "{{password}}" + username: "{{?username}}" + password: "{{?password}}" + access-token: "{{?personal-token}}" diff --git a/library/camel-kamelets/src/main/resources/kamelets/jira-add-comment-sink.kamelet.yaml b/library/camel-kamelets/src/main/resources/kamelets/jira-add-comment-sink.kamelet.yaml index 3adaf695..22d7e51c 100644 --- a/library/camel-kamelets/src/main/resources/kamelets/jira-add-comment-sink.kamelet.yaml +++ b/library/camel-kamelets/src/main/resources/kamelets/jira-add-comment-sink.kamelet.yaml @@ -39,10 +39,10 @@ spec: The comment is set in the body of the message. + To authenticate a username/password or personal token must be defined. We recommend to use personal token as it is a safer way to get access to Jira. + required: - jiraUrl - - username - - password type: object properties: jiraUrl: @@ -58,12 +58,18 @@ spec: - urn:camel:group:credentials password: title: Password - description: The password or the API Token to access Jira + description: The password to access Jira type: string format: password x-descriptors: - urn:alm:descriptor:com.tectonic.ui:password - urn:camel:group:credentials + personal-token: + title: Personal Token + description: Personal Token + type: string + x-descriptors: + - urn:camel:group:credentials types: in: mediaType: application/json @@ -88,5 +94,6 @@ spec: uri: "jira:AddComment" parameters: jiraUrl: "{{jiraUrl}}" - username: "{{username}}" - password: "{{password}}" + username: "{{?username}}" + password: "{{?password}}" + access-token: "{{?personal-token}}" diff --git a/library/camel-kamelets/src/main/resources/kamelets/jira-add-issue-sink.kamelet.yaml b/library/camel-kamelets/src/main/resources/kamelets/jira-add-issue-sink.kamelet.yaml index dce205e2..b4b9a405 100644 --- a/library/camel-kamelets/src/main/resources/kamelets/jira-add-issue-sink.kamelet.yaml +++ b/library/camel-kamelets/src/main/resources/kamelets/jira-add-issue-sink.kamelet.yaml @@ -51,10 +51,10 @@ spec: 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. + To authenticate a username/password or personal token must be defined. We recommend to use personal token as it is a safer way to get access to Jira. + required: - jiraUrl - - username - - password type: object properties: jiraUrl: @@ -70,12 +70,18 @@ spec: - urn:camel:group:credentials password: title: Password - description: The password or the API Token to access Jira + description: The password to access Jira type: string format: password x-descriptors: - urn:alm:descriptor:com.tectonic.ui:password - urn:camel:group:credentials + personal-token: + title: Personal Token + description: Personal Token + type: string + x-descriptors: + - urn:camel:group:credentials types: in: mediaType: application/json @@ -142,5 +148,6 @@ spec: uri: "jira:AddIssue" parameters: jiraUrl: "{{jiraUrl}}" - username: "{{username}}" - password: "{{password}}" + username: "{{?username}}" + password: "{{?password}}" + access-token: "{{?personal-token}}" diff --git a/library/camel-kamelets/src/main/resources/kamelets/jira-source.kamelet.yaml b/library/camel-kamelets/src/main/resources/kamelets/jira-source.kamelet.yaml index f531cbcd..9e4c15f9 100644 --- a/library/camel-kamelets/src/main/resources/kamelets/jira-source.kamelet.yaml +++ b/library/camel-kamelets/src/main/resources/kamelets/jira-source.kamelet.yaml @@ -32,10 +32,11 @@ spec: title: "Jira Source" description: |- Receive notifications about new issues from Jira. + + To authenticate a username/password or personal token must be defined. We recommend to use personal token as it is a safer way to get access to Jira. + required: - jiraUrl - - username - - password type: object properties: jiraUrl: @@ -51,12 +52,18 @@ spec: - urn:camel:group:credentials password: title: Password - description: The password or the API Token to access Jira. + description: The password to access Jira. type: string format: password x-descriptors: - urn:alm:descriptor:com.tectonic.ui:password - urn:camel:group:credentials + personal-token: + title: Personal Token + description: Personal Token + type: string + x-descriptors: + - urn:camel:group:credentials jql: title: JQL description: A query to filter issues. @@ -76,8 +83,9 @@ spec: uri: "jira:newIssues" parameters: jiraUrl: "{{jiraUrl}}" - username: "{{username}}" - password: "{{password}}" + username: "{{?username}}" + password: "{{?password}}" + accessToken: "{{?personal-token}}" jql: "{{jql}}" steps: - marshal: diff --git a/library/camel-kamelets/src/main/resources/kamelets/jira-transition-issue-sink.kamelet.yaml b/library/camel-kamelets/src/main/resources/kamelets/jira-transition-issue-sink.kamelet.yaml index 19d71fb7..be4a8841 100644 --- a/library/camel-kamelets/src/main/resources/kamelets/jira-transition-issue-sink.kamelet.yaml +++ b/library/camel-kamelets/src/main/resources/kamelets/jira-transition-issue-sink.kamelet.yaml @@ -41,10 +41,10 @@ spec: The comment of the transition is set in the body of the message. + To authenticate a username/password or personal token must be defined. We recommend to use personal token as it is a safer way to get access to Jira. + required: - jiraUrl - - username - - password type: object properties: jiraUrl: @@ -60,12 +60,18 @@ spec: - urn:camel:group:credentials password: title: Password - description: The password or the API Token to access Jira + description: The password to access Jira type: string format: password x-descriptors: - urn:alm:descriptor:com.tectonic.ui:password - urn:camel:group:credentials + personal-token: + title: Personal Token + description: Personal Token + type: string + x-descriptors: + - urn:camel:group:credentials types: in: mediaType: application/json @@ -97,5 +103,6 @@ spec: uri: "jira:transitionIssue" parameters: jiraUrl: "{{jiraUrl}}" - username: "{{username}}" - password: "{{password}}" + username: "{{?username}}" + password: "{{?password}}" + access-token: "{{?personal-token}}" diff --git a/library/camel-kamelets/src/main/resources/kamelets/jira-update-issue-sink.kamelet.yaml b/library/camel-kamelets/src/main/resources/kamelets/jira-update-issue-sink.kamelet.yaml index 590c3d80..3530ed79 100644 --- a/library/camel-kamelets/src/main/resources/kamelets/jira-update-issue-sink.kamelet.yaml +++ b/library/camel-kamelets/src/main/resources/kamelets/jira-update-issue-sink.kamelet.yaml @@ -51,10 +51,10 @@ spec: 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. + To authenticate a username/password or personal token must be defined. We recommend to use personal token as it is a safer way to get access to Jira. + required: - jiraUrl - - username - - password type: object properties: jiraUrl: @@ -70,12 +70,18 @@ spec: - urn:camel:group:credentials password: title: Password - description: The password or the API Token to access Jira + description: The password to access Jira type: string format: password x-descriptors: - urn:alm:descriptor:com.tectonic.ui:password - urn:camel:group:credentials + personal-token: + title: Personal Token + description: Personal Token + type: string + x-descriptors: + - urn:camel:group:credentials types: in: mediaType: application/json @@ -142,5 +148,6 @@ spec: uri: "jira:UpdateIssue" parameters: jiraUrl: "{{jiraUrl}}" - username: "{{username}}" - password: "{{password}}" + username: "{{?username}}" + password: "{{?password}}" + access-token: "{{?personal-token}}" diff --git a/library/kamelets-maven-plugin/src/main/java/org/apache/camel/kamelets/maven/plugin/ValidateKameletsMojo.java b/library/kamelets-maven-plugin/src/main/java/org/apache/camel/kamelets/maven/plugin/ValidateKameletsMojo.java index efab1b69..370df12e 100644 --- a/library/kamelets-maven-plugin/src/main/java/org/apache/camel/kamelets/maven/plugin/ValidateKameletsMojo.java +++ b/library/kamelets-maven-plugin/src/main/java/org/apache/camel/kamelets/maven/plugin/ValidateKameletsMojo.java @@ -17,10 +17,11 @@ package org.apache.camel.kamelets.maven.plugin; import java.io.File; -import java.util.*; +import java.util.Arrays; +import java.util.List; +import java.util.Map; import java.util.function.Predicate; import java.util.stream.Collectors; - import org.apache.camel.catalog.DefaultCamelCatalog; import org.apache.camel.kamelets.catalog.KameletsCatalog; import org.apache.camel.tooling.model.ComponentModel; @@ -63,8 +64,7 @@ public class ValidateKameletsMojo extends AbstractMojo { KameletsCatalog catalog = new KameletsCatalog(); DefaultCamelCatalog cc = new DefaultCamelCatalog(); List<String> names = catalog.getKameletsName(); - for (String name: - names) { + for (String name: names) { Map<String, Object> kd = catalog.getKameletTemplate(name); Map<String,Object> f = (Map) kd.get("from"); Map<String,Object> p = (Map) f.get("parameters"); @@ -100,7 +100,10 @@ public class ValidateKameletsMojo extends AbstractMojo { List<String> ceInternal = ce.stream() .map(ComponentModel.EndpointOptionModel::getName) + .sorted() .collect(Collectors.toList()); + StringBuilder availableParams = new StringBuilder(); + ceInternal.forEach(_param -> availableParams.append(_param).append(" ")); for (Map.Entry<String, Object> entry : p.entrySet()) { if (!entry.getKey().equals("period") && (!name.equals("set-kafka-key-action") && !name.equals("sftp-source") && !name.equals("kafka-ssl-source") && !name.equals("timer-source") && !name.equals("cron-source") && !name.equals("fhir-source") && !name.equals("beer-source") && !name.equals("cassandra-source") && !name.equals("cassandra-sink"))) { if (!ceInternal.contains(entry.getKey())) { @@ -108,6 +111,7 @@ public class ValidateKameletsMojo extends AbstractMojo { getLog().error("Scheme Name: " + cleanName); getLog().error("Parameter: " + entry.getKey()); getLog().error("The parameter " + entry.getKey() + " doesn't exist in the endpoint options of " + cleanName + " component"); + getLog().error("Available endpoint options: " + availableParams); if (failOnError) { throw new MojoExecutionException("The Kamelets Validation failed. See logs for more information." + "\n"); }