Skip to content

Commit

Permalink
Merge pull request #322 from christophd/chore/2.3.x/enable-gh-workflows
Browse files Browse the repository at this point in the history
chore: Enable GH actions workflows on 2.3.x branch
  • Loading branch information
christophd authored May 3, 2024
2 parents 0524fdf + 45fa4af commit 673ed81
Show file tree
Hide file tree
Showing 77 changed files with 506 additions and 332 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,29 +15,31 @@
# limitations under the License.
# ---------------------------------------------------------------------------

name: Kubernetes
name: E2E Tests

on:
pull_request:
branches:
- main
- kamelet-catalog-1.6
- release-2.3.x
push:
branches:
- main
- kamelet-catalog-1.6
- release-2.3.x

jobs:
test:
runs-on: ubuntu-latest
env:
YAKS_IMAGE_NAME: "docker.io/yaks/yaks"
YAKS_VERSION: "0.9.0-202202081449"
YAKS_IMAGE_NAME: "docker.io/citrusframework/yaks"
YAKS_VERSION: "0.19.1"
YAKS_RUN_OPTIONS: "--timeout=15m"
KUBECTL_WAIT_TIMEOUT: "180s"
steps:
- name: Checkout code
uses: actions/checkout@v2
uses: actions/checkout@v4
with:
persist-credentials: false
- name: Cleanup
run: |
ls -lart
Expand All @@ -56,41 +58,51 @@ jobs:
echo "Final status:"
df -h
- name: Set up JDK 11
uses: AdoptOpenJDK/install-jdk@v1
- name: Set up JDK
uses: actions/setup-java@v4
with:
version: "11"
distribution: 'temurin'
java-version: 17
cache: 'maven'
- name: Kind Cluster
uses: container-tools/kind-action@v1
uses: container-tools/kind-action@v2.0.4
with:
version: v0.11.0
node_image: kindest/node:v1.21.1@sha256:fae9a58f17f18f06aeac9772ca8b5ac680ebbed985e266f711d936e91d113bad
version: v0.22.0
node_image: kindest/node:v1.29.2@sha256:51a1434a5397193442f0be2a297b488b6c919ce8a3931be0ce822606ea5ca245
cpu: 3
- name: Info
run: |
kubectl version
kubectl cluster-info
kubectl describe nodes
- name: Camel K Tools
uses: container-tools/camel-k-action@v1
uses: container-tools/camel-k-action@v1.0.3
with:
version: v1.6.0
version: v2.3.0
- name: Set JitPack dependency coordinates
env:
HEAD_REF: ${{ github.head_ref }}
HEAD_REPO: ${{ github.event.pull_request.head.repo.full_name }}
run: |
echo "Set JitPack dependency coordinates to ${HEAD_REPO/\//.}:camel-kamelets-utils:${HEAD_REF//\//'~'}-SNAPSHOT"
export PROJECT_VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)
# Overwrite JitPack coordinates in the local Kamelets so the tests can use the utility classes in this branch or PR
find . -maxdepth 1 -name '*.kamelet.yaml' -exec sed -i "s/mvn:org.apache.camel.kamelets:camel-kamelets-utils:${PROJECT_VERSION}/github:${HEAD_REPO/\//.}:camel-kamelets-utils:${HEAD_REF//\//'~'}-SNAPSHOT/g" {} +
- name: Install Camel K
run: |
# Configure install options
export KAMEL_INSTALL_BUILD_PUBLISH_STRATEGY=Spectrum
export KAMEL_INSTALL_REGISTRY=$KIND_REGISTRY
export KAMEL_INSTALL_REGISTRY_INSECURE=true
kamel install -w
# TODO replaces the below statement with --operator-env-vars KAMEL_INSTALL_DEFAULT_KAMELETS=false
# when we use camel k 1.8.0
kubectl delete kamelets --all
kamel install --global --olm=false --operator-env-vars KAMEL_INSTALL_DEFAULT_KAMELETS=false -w
# Install the local kamelets
find . -maxdepth 1 -name '*.kamelet.yaml' -exec kubectl apply -f {} \;
- name: YAKS tools
uses: citrusframework/yaks-install-action@v1.0
with:
version: ${{ env.YAKS_VERSION }}
version: v${{ env.YAKS_VERSION }}
- name: Install YAKS
run: |
yaks install --operator-image $YAKS_IMAGE_NAME:$YAKS_VERSION
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,19 @@ name: Publish Website
on:
push:
branches:
- kamelet-catalog-1.4
- main
- main
- release-2.3.x
jobs:
publish-pages:
runs-on: ubuntu-latest
if: github.repository == 'openshift-integration/kamelet-catalog'
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4
with:
ref: kamelet-catalog-1.4
ref: release-2.3.x
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4
with:
ref: main
- name: Build
Expand Down
14 changes: 5 additions & 9 deletions .github/workflows/validate.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,7 @@ on:
pull_request:
branches:
- main
- kamelet-catalog-1.3
- kamelet-catalog-1.4
- kamelet-catalog-1.6
- release-2.3.x
paths-ignore:
- '**.adoc'
- 'KEYS'
Expand All @@ -32,9 +30,7 @@ on:
push:
branches:
- main
- kamelet-catalog-1.3
- kamelet-catalog-1.4
- kamelet-catalog-1.6
- release-2.3.x
paths-ignore:
- '**.adoc'
- 'KEYS'
Expand All @@ -46,11 +42,11 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
uses: actions/checkout@v4
- name: Install Go
uses: actions/setup-go@v1
uses: actions/setup-go@v5
with:
go-version: 1.15.x
go-version: 1.20.x
- name: Run Validator
run: |
echo "Running Kamelet validator..."
Expand Down
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,15 @@ If you are copying kamelets from upstream, you must change the following fields
camel.apache.org/catalog.version: "kamelet-catalog-1.6-SNAPSHOT"
camel.apache.org/provider: "Red Hat"
```
You can also add any closed source dependency to the Kamelet Binding, for example the MSSQL JDBC Driver `com.microsoft.sqlserver:mssql-jdbc:9.2.1.jre11`, see `sqlserver-sink.kamelet.yaml`.
You can also add any closed source dependency to the Pipe, for example the MSSQL JDBC Driver `com.microsoft.sqlserver:mssql-jdbc:9.2.1.jre11`, see `sqlserver-sink.kamelet.yaml`.

## Kamelet Binding Examples
## Pipe Examples

Binding examples are highly encouraged to be added under `templates/bindings/camel-k` directory for Kamelet Binding and `templates/bindings/core` for the YAML routes, when the developer wants to add custom logic to the example files.
Binding examples are highly encouraged to be added under `templates/bindings/camel-k` directory for Pipe and `templates/bindings/core` for the YAML routes, when the developer wants to add custom logic to the example files.

When the Kamelet Catalog documentation is generated, the examples in each Kamelet documentation page are automatically generated, but the generator code is not wise enough and it may generate a Kamelet Binding that doesn't work, requiring additional steps. In this case, the binding example should be added to the above mentioned directories, and in this case a `kamel bind` example command must be added as a comment in the first line, outlining the correct `kamel bind` usage.
When the Kamelet Catalog documentation is generated, the examples in each Kamelet documentation page are automatically generated, but the generator code is not wise enough and it may generate a Pipe that doesn't work, requiring additional steps. In this case, the binding example should be added to the above mentioned directories, and in this case a `kamel bind` example command must be added as a comment in the first line, outlining the correct `kamel bind` usage.

See `avro-deserialize-action-binding.yaml` for an example of a Kamelet Binding with additional steps or `jms-ibm-mq-sink-binding.yaml` for an example with several parameters in the `sink` section.
See `avro-deserialize-action-binding.yaml` for an example of a Pipe with additional steps or `jms-ibm-mq-sink-binding.yaml` for an example with several parameters in the `sink` section.


When the documentation mechanism runs, it will source this binding example into the kamelet documentation page as example.
12 changes: 6 additions & 6 deletions test/aws-kinesis/aws-kinesis-inmem-binding.feature
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ Feature: AWS-Kinesis Kamelet
| aws.kinesis.command | "create-stream", "--stream-name", "${camel.kamelet.aws-kinesis-source.aws-kinesis-credentials.stream}", "--shard-count", "1" |
When load Kubernetes resource aws-kinesis-client.yaml

Given load KameletBinding aws-kinesis-to-inmem.yaml
Then KameletBinding aws-kinesis-to-inmem should be available
Given load KameletBinding inmem-to-log.yaml
And KameletBinding inmem-to-log should be available
Given load Pipe aws-kinesis-to-inmem.yaml
Then Pipe aws-kinesis-to-inmem should be available
Given load Pipe inmem-to-log.yaml
And Pipe inmem-to-log should be available
And Camel K integration aws-kinesis-to-inmem is running
And Camel K integration inmem-to-log is running

Expand All @@ -37,5 +37,5 @@ Feature: AWS-Kinesis Kamelet
| aws.kinesis.clientName | aws-kinesis-client-citrus:randomString(10, LOWERCASE) |
| aws.kinesis.command | "delete-stream", "--stream-name", "${camel.kamelet.aws-kinesis-source.aws-kinesis-credentials.stream}" |
Then load Kubernetes resource aws-kinesis-client.yaml
Given delete KameletBinding inmem-to-log
Given delete KameletBinding aws-kinesis-to-inmem
Given delete Pipe inmem-to-log
Given delete Pipe aws-kinesis-to-inmem
4 changes: 2 additions & 2 deletions test/aws-kinesis/aws-kinesis-to-inmem.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
# ---------------------------------------------------------------------------

apiVersion: camel.apache.org/v1
kind: KameletBinding
kind: Pipe
metadata:
name: aws-kinesis-to-inmem
spec:
Expand All @@ -34,4 +34,4 @@ spec:
ref:
kind: InMemoryChannel
apiVersion: messaging.knative.dev/v1
name: messages
name: messages
4 changes: 2 additions & 2 deletions test/aws-kinesis/aws-kinesis-uri-binding.feature
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ Feature: AWS Kinesis Kamelet - binding to URI

Scenario: Create Camel K resources
Given Kamelet aws-kinesis-source is available
Given load KameletBinding aws-kinesis-uri-binding.yaml
Given KameletBinding aws-kinesis-uri-binding is available
Given load Pipe aws-kinesis-uri-binding.yaml
Given Pipe aws-kinesis-uri-binding is available
Given variable loginfo is "aws2-kinesis://${camel.kamelet.aws-kinesis-source.aws-kinesis-credentials.stream}"
Then Camel K integration aws-kinesis-uri-binding should print ${loginfo}

Expand Down
2 changes: 1 addition & 1 deletion test/aws-kinesis/aws-kinesis-uri-binding.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
# ---------------------------------------------------------------------------

apiVersion: camel.apache.org/v1
kind: KameletBinding
kind: Pipe
metadata:
name: aws-kinesis-uri-binding
spec:
Expand Down
5 changes: 5 additions & 0 deletions test/aws-kinesis/yaks-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,11 @@ config:
tags:
- "not @ignored"
settings:
loggers:
- name: INTEGRATION_STATUS
level: INFO
- name: INTEGRATION_LOGS
level: INFO
dependencies:
- groupId: org.apache.camel
artifactId: camel-aws2-kinesis
Expand Down
12 changes: 6 additions & 6 deletions test/aws-sqs/aws-sqs-inmem-binding.feature
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ Feature: AWS SQS Kamelet - binding to InMemoryChannel
| aws.sqs.command | "create-queue", "--queue-name", "${camel.kamelet.aws-sqs-source.aws-sqs-credentials.queueNameOrArn}" |
When load Kubernetes resource aws-sqs-client.yaml

Given load KameletBinding aws-sqs-to-inmem.yaml
Given load KameletBinding inmem-to-log.yaml
Then KameletBinding aws-sqs-to-inmem is available
And KameletBinding inmem-to-log should be available
Given load Pipe aws-sqs-to-inmem.yaml
Given load Pipe inmem-to-log.yaml
Then Pipe aws-sqs-to-inmem is available
And Pipe inmem-to-log should be available
Then Camel K integration aws-sqs-to-inmem is running
And Camel K integration inmem-to-log is running

Expand All @@ -31,8 +31,8 @@ Feature: AWS SQS Kamelet - binding to InMemoryChannel
Then Camel K integration inmem-to-log should print "${aws.sqs.message}"

Scenario: Remove Camel K resources
Given delete KameletBinding aws-sqs-to-inmem
Given delete KameletBinding inmem-to-log
Given delete Pipe aws-sqs-to-inmem
Given delete Pipe inmem-to-log

Scenario: Remove AWS SQS queue
Given variables
Expand Down
2 changes: 1 addition & 1 deletion test/aws-sqs/aws-sqs-to-inmem.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
# ---------------------------------------------------------------------------

apiVersion: camel.apache.org/v1
kind: KameletBinding
kind: Pipe
metadata:
name: aws-sqs-to-inmem
spec:
Expand Down
6 changes: 3 additions & 3 deletions test/aws-sqs/aws-sqs-uri-binding.feature
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ Feature: AWS SQS Kamelet - binding to URI

Scenario: Create Camel K resources
Given Kamelet aws-sqs-source is available
Given load KameletBinding aws-sqs-uri-binding.yaml
Given KameletBinding aws-sqs-uri-binding is available
Given load Pipe aws-sqs-uri-binding.yaml
Given Pipe aws-sqs-uri-binding is available
Given variable loginfo is "Installed features"
Then Camel K integration aws-sqs-uri-binding should print ${loginfo}

Expand All @@ -27,7 +27,7 @@ Feature: AWS SQS Kamelet - binding to URI
Then Camel K integration aws-sqs-uri-binding should print "${aws.sqs.message}"

Scenario: Remove Camel K resources
Given delete KameletBinding aws-sqs-uri-binding
Given delete Pipe aws-sqs-uri-binding
Given delete Camel K integration aws-sqs-uri-binding

Scenario: Remove AWS SQS queue
Expand Down
4 changes: 2 additions & 2 deletions test/aws-sqs/aws-sqs-uri-binding.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
# ---------------------------------------------------------------------------

apiVersion: camel.apache.org/v1
kind: KameletBinding
kind: Pipe
metadata:
name: aws-sqs-uri-binding
spec:
Expand All @@ -31,4 +31,4 @@ spec:
secretKey: ${camel.kamelet.aws-sqs-source.aws-sqs-credentials.secretKey}
region: ${camel.kamelet.aws-sqs-source.aws-sqs-credentials.region}
sink:
uri: log:info
uri: log:info
5 changes: 5 additions & 0 deletions test/aws-sqs/yaks-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,11 @@ config:
tags:
- "not @ignored"
settings:
loggers:
- name: INTEGRATION_STATUS
level: INFO
- name: INTEGRATION_LOGS
level: INFO
dependencies:
- groupId: org.apache.camel
artifactId: camel-aws2-sqs
Expand Down
8 changes: 4 additions & 4 deletions test/extract-field/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,24 +4,24 @@ This test verifies the Kamelet action defined in [extract-field-action.kamelet.y

## Objectives

The test verifies the extract field Kamelet action by creating a Kamelet binding that uses the action.
The test verifies the extract field Kamelet action by creating a Pipe that uses the action.
In the following the test provides a proper input to the binding and verifies the expected outcome on a Http service endpoint.

### Test Kamelet action

The test performs the following high level steps:

*Preparation*
- Create and start Http test service as a sink for the Kamelet binding
- Create and start Http test service as a sink for the Pipe
- Expose the service on a given target port

*Scenario*
- Configure and create the Kamelet binding that uses the action (timer-source to uri)
- Configure and create the Pipe that uses the action (timer-source to uri)
- Wait for the Camel K integration to start
- Verify that the binding has performed the Kamelet action as expected by verifying the Http service sink request data

*Cleanup*
- Delete the Kamelet binding
- Delete the Pipe
- Delete the test Http service

## Installation
Expand Down
Loading

0 comments on commit 673ed81

Please sign in to comment.