Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Github Tag Source Kamelet #656

Merged
merged 5 commits into from
Dec 22, 2021
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions docs/modules/ROOT/nav.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
153 changes: 153 additions & 0 deletions docs/modules/ROOT/pages/github-tag-source.adoc
Original file line number Diff line number Diff line change
@@ -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
73 changes: 73 additions & 0 deletions kamelets/github-tag-source.kamelet.yaml
Original file line number Diff line number Diff line change
@@ -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,PHN2ZyB3aWR0aD0iMTAyNCIgaGVpZ2h0PSIxMDI0IiB2aWV3Qm94PSIwIDAgMTAyNCAxMDI0IiBmaWxsPSJub25lI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LjU1IDE1LjU5QzEzLjcxIDE0LjUzIDE2IDExLjUzIDE2IDhDMTYgMy41OCAxMi40MiAwIDggMFoiIHRyYW5zZm9ybT0ic2NhbGUoNjQpIiBmaWxsPSIjMUIxRjIzIi8+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"
Original file line number Diff line number Diff line change
@@ -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,PHN2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jAxIDEzLjAxQzEwLjAxIDE0LjA4IDEwIDE0Ljk0IDEwIDE1LjIxQzEwIDE1LjQyIDEwLjE1IDE1LjY3IDEwLjU1IDE1LjU5QzEzLjcxIDE0LjUzIDE2IDExLjUzIDE2IDhDMTYgMy41OCAxMi40MiAwIDggMFoiIHRyYW5zZm9ybT0ic2NhbGUoNjQpIiBmaWxsPSIjMUIxRjIzIi8+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"
20 changes: 20 additions & 0 deletions templates/bindings/camel-k/github-tag-source-binding.yaml
Original file line number Diff line number Diff line change
@@ -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

11 changes: 11 additions & 0 deletions templates/bindings/core/github-tag-source-binding.yaml
Original file line number Diff line number Diff line change
@@ -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"