From 7bf48fbbcec22e103cbe5982fac737c5fedccc26 Mon Sep 17 00:00:00 2001 From: Andrea Cosentino Date: Wed, 22 Dec 2021 15:14:32 +0100 Subject: [PATCH 1/5] Added Github Tag Source Kamelet --- kamelets/github-tag-source.kamelet.yaml | 73 +++++++++++++++++++++++++ 1 file changed, 73 insertions(+) create mode 100644 kamelets/github-tag-source.kamelet.yaml diff --git a/kamelets/github-tag-source.kamelet.yaml b/kamelets/github-tag-source.kamelet.yaml new file mode 100644 index 000000000..c29f24d50 --- /dev/null +++ b/kamelets/github-tag-source.kamelet.yaml @@ -0,0 +1,73 @@ +# --------------------------------------------------------------------------- +# 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: github-tag-source + 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,PHN2ZyB3aWR0aD0iMTAyNCIgaGVpZ2h0PSIxMDI0IiB2aWV3Qm94PSIwIDAgMTAyNCAxMDI0IiBmaWxsPSJub25lIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPgo8cGF0aCBmaWxsLXJ1bGU9ImV2ZW5vZGQiIGNsaXAtcnVsZT0iZXZlbm9kZCIgZD0iTTggMEMzLjU4IDAgMCAzLjU4IDAgOEMwIDExLjU0IDIuMjkgMTQuNTMgNS40NyAxNS41OUM1Ljg3IDE1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camel.apache.org/kamelet.type: "source" +spec: + definition: + title: "Github Tag Source" + description: |- + Receive Tags From a Github Repository. + required: + - repoName + - repoOwner + - oauthToken + type: object + properties: + repoName: + title: Repository Name + description: The Github Repository name + type: string + repoOwner: + title: Repository Owner + description: The repository owner + type: string + oauthToken: + title: OAuth Token + description: Oauth token + type: string + format: password + x-descriptors: + - urn:alm:descriptor:com.tectonic.ui:password + - urn:camel:group:credentials + types: + out: + mediaType: application/json + dependencies: + - "camel:jackson" + - "camel:github" + - "camel:kamelet" + flow: + from: + uri: "github://tag" + parameters: + repoName: "{{repoName}}" + repoOwner: "{{repoOwner}}" + oauthToken: "{{oauthToken}}" + steps: + - marshal: + json: {} + - to: "kamelet:sink" From 9b161374ce7bbce36f451948cf3b22d2df821de6 Mon Sep 17 00:00:00 2001 From: Andrea Cosentino Date: Wed, 22 Dec 2021 15:14:48 +0100 Subject: [PATCH 2/5] Added Github Tag Source Kamelet --- .../kamelets/github-tag-source.kamelet.yaml | 73 +++++++++++++++++++ 1 file changed, 73 insertions(+) create mode 100644 library/camel-kamelets/src/main/resources/kamelets/github-tag-source.kamelet.yaml diff --git a/library/camel-kamelets/src/main/resources/kamelets/github-tag-source.kamelet.yaml b/library/camel-kamelets/src/main/resources/kamelets/github-tag-source.kamelet.yaml new file mode 100644 index 000000000..c29f24d50 --- /dev/null +++ b/library/camel-kamelets/src/main/resources/kamelets/github-tag-source.kamelet.yaml @@ -0,0 +1,73 @@ +# --------------------------------------------------------------------------- +# 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: github-tag-source + 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,PHN2ZyB3aWR0aD0iMTAyNCIgaGVpZ2h0PSIxMDI0IiB2aWV3Qm94PSIwIDAgMTAyNCAxMDI0IiBmaWxsPSJub25lIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPgo8cGF0aCBmaWxsLXJ1bGU9ImV2ZW5vZGQiIGNsaXAtcnVsZT0iZXZlbm9kZCIgZD0iTTggMEMzLjU4IDAgMCAzLjU4IDAgOEMwIDExLjU0IDIuMjkgMTQuNTMgNS40NyAxNS41OUM1Ljg3IDE1LjY2IDYuMDIgMTUuNDIgNi4wMiAxNS4yMUM2LjAyIDE1LjAyIDYuMDEgMTQuMzkgNi4wMSAxMy43MkM0IDE0LjA5IDMuNDggMTMuMjMgMy4zMiAxMi43OEMzLjIzIDEyLjU1IDIuODQgMTEuODQgMi41IDExLjY1QzIuMjIgMTEuNSAxLjgyIDExLjEzIDIuNDkgMTEuMTJDMy4xMiAxMS4xMSAzLjU3IDExLjcgMy43MiAxMS45NEM0LjQ0IDEzLjE1IDUuNTkgMTIuODEgNi4wNSAxMi42QzYuMTIgMTIuMDggNi4zMyAxMS43MyA2LjU2IDExLjUzQzQuNzggMTEuMzMgMi45MiAxMC42NCAyLjkyIDcuNThDMi45MiA2LjcxIDMuMjMgNS45OSAzLjc0IDUuNDNDMy42NiA1LjIzIDMuMzggNC40MSAzLjgyIDMuMzFDMy44MiAzLjMxIDQuNDkgMy4xIDYuMDIgNC4xM0M2LjY2IDMuOTUgNy4zNCAzLjg2IDguMDIgMy44NkM4LjcgMy44NiA5LjM4IDMuOTUgMTAuMDIgNC4xM0MxMS41NSAzLjA5IDEyLjIyIDMuMzEgMTIuMjIgMy4zMUMxMi42NiA0LjQxIDEyLjM4IDUuMjMgMTIuMyA1LjQzQzEyLjgxIDUuOTkgMTMuMTIgNi43IDEzLjEyIDcuNThDMTMuMTIgMTAuNjUgMTEuMjUgMTEuMzMgOS40NyAxMS41M0M5Ljc2IDExLjc4IDEwLjAxIDEyLjI2IDEwLjAxIDEzLjAxQzEwLjAxIDE0LjA4IDEwIDE0Ljk0IDEwIDE1LjIxQzEwIDE1LjQyIDEwLjE1IDE1LjY3IDEwLjU1IDE1LjU5QzEzLjcxIDE0LjUzIDE2IDExLjUzIDE2IDhDMTYgMy41OCAxMi40MiAwIDggMFoiIHRyYW5zZm9ybT0ic2NhbGUoNjQpIiBmaWxsPSIjMUIxRjIzIi8+Cjwvc3ZnPgo=" + camel.apache.org/provider: "Apache Software Foundation" + camel.apache.org/kamelet.group: "GitHub" + labels: + camel.apache.org/kamelet.type: "source" +spec: + definition: + title: "Github Tag Source" + description: |- + Receive Tags From a Github Repository. + required: + - repoName + - repoOwner + - oauthToken + type: object + properties: + repoName: + title: Repository Name + description: The Github Repository name + type: string + repoOwner: + title: Repository Owner + description: The repository owner + type: string + oauthToken: + title: OAuth Token + description: Oauth token + type: string + format: password + x-descriptors: + - urn:alm:descriptor:com.tectonic.ui:password + - urn:camel:group:credentials + types: + out: + mediaType: application/json + dependencies: + - "camel:jackson" + - "camel:github" + - "camel:kamelet" + flow: + from: + uri: "github://tag" + parameters: + repoName: "{{repoName}}" + repoOwner: "{{repoOwner}}" + oauthToken: "{{oauthToken}}" + steps: + - marshal: + json: {} + - to: "kamelet:sink" From 61b51a532eb2a3e76704b51a5a8dc8c3f10e7b15 Mon Sep 17 00:00:00 2001 From: Andrea Cosentino Date: Wed, 22 Dec 2021 15:15:08 +0100 Subject: [PATCH 3/5] Added Github Tag Source Kamelet --- docs/modules/ROOT/nav.adoc | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/modules/ROOT/nav.adoc b/docs/modules/ROOT/nav.adoc index cc33cb301..94912f2df 100644 --- a/docs/modules/ROOT/nav.adoc +++ b/docs/modules/ROOT/nav.adoc @@ -55,6 +55,7 @@ * xref:ROOT:ftps-source.adoc[image:kamelets/ftps-source.svg[] FTPS Source] * xref:ROOT:github-commit-source.adoc[image:kamelets/github-commit-source.svg[] Github Commit Source] * xref:ROOT:github-source.adoc[image:kamelets/github-source.svg[] Github Source] +* xref:ROOT:github-tag-source.adoc[image:kamelets/github-tag-source.svg[] Github Tag Source] * xref:ROOT:google-calendar-source.adoc[image:kamelets/google-calendar-source.svg[] Google Calendar Source] * xref:ROOT:google-functions-sink.adoc[image:kamelets/google-functions-sink.svg[] Google Functions Sink] * xref:ROOT:google-mail-source.adoc[image:kamelets/google-mail-source.svg[] Google Mail Source] From ab0985ec5bf8651dd8bb1a077cb698346a3f22bb Mon Sep 17 00:00:00 2001 From: Andrea Cosentino Date: Wed, 22 Dec 2021 15:15:16 +0100 Subject: [PATCH 4/5] Added Github Tag Source Kamelet - Docs --- .../images/kamelets/github-tag-source.svg | 3 + .../modules/ROOT/pages/github-tag-source.adoc | 153 ++++++++++++++++++ 2 files changed, 156 insertions(+) create mode 100644 docs/modules/ROOT/assets/images/kamelets/github-tag-source.svg create mode 100644 docs/modules/ROOT/pages/github-tag-source.adoc diff --git a/docs/modules/ROOT/assets/images/kamelets/github-tag-source.svg b/docs/modules/ROOT/assets/images/kamelets/github-tag-source.svg new file mode 100644 index 000000000..a8d117404 --- /dev/null +++ b/docs/modules/ROOT/assets/images/kamelets/github-tag-source.svg @@ -0,0 +1,3 @@ + + + diff --git a/docs/modules/ROOT/pages/github-tag-source.adoc b/docs/modules/ROOT/pages/github-tag-source.adoc new file mode 100644 index 000000000..ef0c6fb7a --- /dev/null +++ b/docs/modules/ROOT/pages/github-tag-source.adoc @@ -0,0 +1,153 @@ +// THIS FILE IS AUTOMATICALLY GENERATED: DO NOT EDIT + += image:kamelets/github-tag-source.svg[] Github Tag Source + +*Provided by: "Apache Software Foundation"* + +*Support Level for this Kamelet is: "Preview"* + +Receive Tags From a Github Repository. + +== Configuration Options + +The following table summarizes the configuration options available for the `github-tag-source` Kamelet: +[width="100%",cols="2,^2,3,^2,^2,^3",options="header"] +|=== +| Property| Name| Description| Type| Default| Example +| *oauthToken {empty}* *| OAuth Token| Oauth token| string| | +| *repoName {empty}* *| Repository Name| The Github Repository name| string| | +| *repoOwner {empty}* *| Repository Owner| The repository owner| string| | +|=== + +NOTE: Fields marked with an asterisk ({empty}*) are mandatory. + + +== Dependencies + +At runtime, the `github-tag-source` Kamelet relies upon the presence of the following dependencies: + +- camel:jackson +- camel:github +- camel:kamelet + +== Usage + +This section describes how you can use the `github-tag-source`. + +=== Knative Source + +You can use the `github-tag-source` Kamelet as a Knative source by binding it to a Knative object. + +.github-tag-source-binding.yaml +[source,yaml] +---- +apiVersion: camel.apache.org/v1alpha1 +kind: KameletBinding +metadata: + name: github-tag-source-binding +spec: + source: + ref: + kind: Kamelet + apiVersion: camel.apache.org/v1alpha1 + name: github-tag-source + properties: + oauthToken: "The OAuth Token" + repoName: "The Repository Name" + repoOwner: "The Repository Owner" + sink: + ref: + kind: Channel + apiVersion: messaging.knative.dev/v1 + name: mychannel + +---- + +==== *Prerequisite* + +You have xref:{camel-k-version}@camel-k::installation/installation.adoc[Camel K installed] on the cluster. + +==== *Procedure for using the cluster CLI* + +. Save the `github-tag-source-binding.yaml` file to your local drive, and then edit it as needed for your configuration. + +. Run the source by using the following command: ++ +[source,shell] +---- +kubectl apply -f github-tag-source-binding.yaml +---- + +==== *Procedure for using the Kamel CLI* + +Configure and run the source by using the following command: + +[source,shell] +---- +kamel bind github-tag-source -p "source.oauthToken=The OAuth Token" -p "source.repoName=The Repository Name" -p "source.repoOwner=The Repository Owner" channel:mychannel +---- + +This command creates the KameletBinding in the current namespace on the cluster. + +=== Kafka Source + +You can use the `github-tag-source` Kamelet as a Kafka source by binding it to a Kafka topic. + +.github-tag-source-binding.yaml +[source,yaml] +---- +apiVersion: camel.apache.org/v1alpha1 +kind: KameletBinding +metadata: + name: github-tag-source-binding +spec: + source: + ref: + kind: Kamelet + apiVersion: camel.apache.org/v1alpha1 + name: github-tag-source + properties: + oauthToken: "The OAuth Token" + repoName: "The Repository Name" + repoOwner: "The Repository Owner" + sink: + ref: + kind: KafkaTopic + apiVersion: kafka.strimzi.io/v1beta1 + name: my-topic + +---- + +==== *Prerequisites* + +* You've installed https://strimzi.io/[Strimzi]. +* You've created a topic named `my-topic` in the current namespace. +* You have xref:{camel-k-version}@camel-k::installation/installation.adoc[Camel K installed] on the cluster. + +==== *Procedure for using the cluster CLI* + +. Save the `github-tag-source-binding.yaml` file to your local drive, and then edit it as needed for your configuration. + +. Run the source by using the following command: ++ +[source,shell] +---- +kubectl apply -f github-tag-source-binding.yaml +---- + +==== *Procedure for using the Kamel CLI* + +Configure and run the source by using the following command: + +[source,shell] +---- +kamel bind github-tag-source -p "source.oauthToken=The OAuth Token" -p "source.repoName=The Repository Name" -p "source.repoOwner=The Repository Owner" kafka.strimzi.io/v1beta1:KafkaTopic:my-topic +---- + +This command creates the KameletBinding in the current namespace on the cluster. + +== Kamelet source file + +https://github.com/apache/camel-kamelets/blob/main/kamelets/github-tag-source.kamelet.yaml + +// THIS FILE IS AUTOMATICALLY GENERATED: DO NOT EDIT From 466b600fbd7a3f63b4dea5288b3e08ae8d4ebc18 Mon Sep 17 00:00:00 2001 From: Andrea Cosentino Date: Wed, 22 Dec 2021 15:15:24 +0100 Subject: [PATCH 5/5] Added Github Tag Source Kamelet - Templates --- .../camel-k/github-tag-source-binding.yaml | 20 +++++++++++++++++++ .../core/github-tag-source-binding.yaml | 11 ++++++++++ 2 files changed, 31 insertions(+) create mode 100644 templates/bindings/camel-k/github-tag-source-binding.yaml create mode 100644 templates/bindings/core/github-tag-source-binding.yaml diff --git a/templates/bindings/camel-k/github-tag-source-binding.yaml b/templates/bindings/camel-k/github-tag-source-binding.yaml new file mode 100644 index 000000000..6536d796e --- /dev/null +++ b/templates/bindings/camel-k/github-tag-source-binding.yaml @@ -0,0 +1,20 @@ +apiVersion: camel.apache.org/v1alpha1 +kind: KameletBinding +metadata: + name: github-tag-source-binding +spec: + source: + ref: + kind: Kamelet + apiVersion: camel.apache.org/v1alpha1 + name: github-tag-source + properties: + oauthToken: "The OAuth Token" + repoName: "The Repository Name" + repoOwner: "The Repository Owner" + sink: + ref: + kind: KafkaTopic + apiVersion: kafka.strimzi.io/v1beta1 + name: my-topic + \ No newline at end of file diff --git a/templates/bindings/core/github-tag-source-binding.yaml b/templates/bindings/core/github-tag-source-binding.yaml new file mode 100644 index 000000000..b6e32f888 --- /dev/null +++ b/templates/bindings/core/github-tag-source-binding.yaml @@ -0,0 +1,11 @@ +- route: + from: + uri: "kamelet:github-tag-source" + parameters: + oauthToken: "The OAuth Token" + repoName: "The Repository Name" + repoOwner: "The Repository Owner" + steps: + - to: + uri: "log:info" + \ No newline at end of file