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

chore: Update GitHub actions CI #90

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
71 changes: 21 additions & 50 deletions .github/workflows/kubernetes.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,24 +23,28 @@ on:
- main
- 1.6.x
- 1.8.x
- 1.10.x
push:
branches:
- main
- 1.6.x
- 1.8.x
- 1.10.x

jobs:
test:
runs-on: ubuntu-latest
env:
CAMEL_K_VERSION: 1.8.2
YAKS_VERSION: 0.10.0
CAMEL_K_VERSION: 1.10.4
YAKS_VERSION: 0.15.1
YAKS_IMAGE_NAME: "docker.io/citrusframework/yaks"
YAKS_RUN_OPTIONS: "--timeout=15m"
KUBECTL_WAIT_TIMEOUT: "180s"
KNATIVE_SERVING_VERSION: v1.9.4
KNATIVE_EVENTING_VERSION: v1.9.7
KNATIVE_KOURIER_VERSION: v1.9.2
steps:
- name: Checkout code
uses: actions/checkout@v2
uses: actions/checkout@v3
- name: Cleanup
run: |
ls -lart
Expand All @@ -59,62 +63,29 @@ jobs:

echo "Final status:"
df -h
- name: Set up JDK 11
uses: AdoptOpenJDK/install-jdk@v1
- name: Set up JDK
uses: actions/setup-java@v3
with:
version: "11"
java-version: '11'
distribution: 'temurin'
- name: Kind Cluster
uses: container-tools/kind-action@v1
uses: container-tools/kind-action@v2.0.1
with:
version: v0.11.0
node_image: kindest/node:v1.21.1@sha256:fae9a58f17f18f06aeac9772ca8b5ac680ebbed985e266f711d936e91d113bad
version: v0.17.0
node_image: kindest/node:v1.28.0@sha256:9f3ff58f19dcf1a0611d11e8ac989fdb30a28f40f236f59f0bea31fb956ccf5c
knative_serving: ${{ env.KNATIVE_SERVING_VERSION }}
knative_eventing: ${{ env.KNATIVE_EVENTING_VERSION }}
knative_kourier: ${{ env.KNATIVE_KOURIER_VERSION }}
- name: Info
run: |
kubectl version
kubectl cluster-info
kubectl describe nodes
- name: Install Knative
run: |
# Prerequisites
sudo wget https://github.com/mikefarah/yq/releases/download/v4.9.6/yq_linux_amd64 -O /usr/bin/yq && sudo chmod +x /usr/bin/yq

export SERVING_VERSION=v0.23.1
export EVENTING_VERSION=v0.23.2
export KOURIER_VERSION=v0.23.0

# Serving
kubectl apply --filename https://github.com/knative/serving/releases/download/$SERVING_VERSION/serving-crds.yaml
curl -L -s https://github.com/knative/serving/releases/download/$SERVING_VERSION/serving-core.yaml | head -n -1 | yq e 'del(.spec.template.spec.containers[].resources)' - | kubectl apply -f -

# Kourier
kubectl apply --filename https://github.com/knative/net-kourier/releases/download/$KOURIER_VERSION/kourier.yaml
kubectl patch configmap/config-network \
--namespace knative-serving \
--type merge \
--patch '{"data":{"ingress.class":"kourier.ingress.networking.knative.dev"}}'

# Eventing
kubectl apply --filename https://github.com/knative/eventing/releases/download/$EVENTING_VERSION/eventing-crds.yaml
curl -L -s https://github.com/knative/eventing/releases/download/$EVENTING_VERSION/eventing-core.yaml | head -n -1 | yq e 'del(.spec.template.spec.containers[].resources)' - | kubectl apply -f -

# Eventing channels
curl -L -s https://github.com/knative/eventing/releases/download/$EVENTING_VERSION/in-memory-channel.yaml | head -n -1 | yq e 'del(.spec.template.spec.containers[].resources)' - | kubectl apply -f -

# Eventing broker
curl -L -s https://github.com/knative/eventing/releases/download/$EVENTING_VERSION/mt-channel-broker.yaml | head -n -1 | yq e 'del(.spec.template.spec.containers[].resources)' - | kubectl apply -f -

# Eventing sugar controller for injection
kubectl apply -f https://github.com/knative/eventing/releases/download/$EVENTING_VERSION/eventing-sugar-controller.yaml

# Wait for installation completed
echo "Waiting for all pods to be ready in kourier-system"
kubectl wait --for=condition=Ready pod --all -n kourier-system --timeout=$KUBECTL_WAIT_TIMEOUT
echo "Waiting for all pods to be ready in knative-serving"
kubectl wait --for=condition=Ready pod --all -n knative-serving --timeout=$KUBECTL_WAIT_TIMEOUT
echo "Waiting for all pods to be ready in knative-eventing"
kubectl wait --for=condition=Ready pod --all -n knative-eventing --timeout=$KUBECTL_WAIT_TIMEOUT
kubectl apply -f https://github.com/knative/serving/releases/download/knative-${{ env.KNATIVE_SERVING_VERSION }}/serving-default-domain.yaml
- name: Camel K Tools
uses: container-tools/camel-k-action@v1
uses: container-tools/camel-k-action@v1.0.3
with:
version: v${{ env.CAMEL_K_VERSION }}
- name: Install Camel K
Expand All @@ -126,7 +97,7 @@ jobs:

kamel install
- name: YAKS tools
uses: citrusframework/yaks-install-action@v1.0
uses: citrusframework/yaks-install-action@v1.1
with:
version: v${{ env.YAKS_VERSION }}
- name: Install YAKS
Expand Down
Binary file modified docs/Diagram.png
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 infra/messaging/broker/instances/addresses/alarms.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ spec:
addressName: alarms
queueName: alarms
routingType: anycast
removeFromBrokerOnDelete: true
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ spec:
addressName: notifications
queueName: notifications
routingType: anycast
removeFromBrokerOnDelete: true
4 changes: 2 additions & 2 deletions infra/messaging/broker/instances/amq-broker-instance.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ metadata:
namespace: event-streaming-messaging-broker
spec:
acceptors:
- name: artemis_acceptor
- name: artemis-acceptor
protocols: 'artemis,core,openwire'
port: 61616
sslEnabled: false
- name: amqp_acceptor
- name: amqp-acceptor
protocols: amqp
port: 5672
sslEnabled: false
Expand Down
4 changes: 2 additions & 2 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ instruct the operator to deploy a broker according to the configuration.
You need to create the `event-streaming-messaging-broker` project from the OpenShift web console or by executing the command `oc new-project event-streaming-messaging-broker` on a terminal window.

Now, we can go to the OpenShift 4.x WebConsole page, use the OperatorHub menu item on the left hand side menu and use it to find and install **"Red Hat Integration - AMQ Broker"**.
This will install the operator and may take a couple minutes to install.
This will install the operator and may take a couple of minutes to install.

### Installing OpenShift Serverless

Expand Down Expand Up @@ -89,7 +89,7 @@ The system consumes data from sources such as OpenAQ API (an open API that is us
USGS Earthquake Hazards Program, etc to consume data about hazards and present information about them and warn the user
when certain incidents happen.

![Diagram](https://raw.githubusercontent.com/openshift-integration/camel-k-example-event-streaming/master/docs/Diagram.png)
![Diagram](https://raw.githubusercontent.com/openshift-integration/camel-k-example-event-streaming/main/docs/Diagram.png)

## 1. Creating the AMQ Streams Cluster

Expand Down
8 changes: 5 additions & 3 deletions test/application-test.properties
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,11 @@ kafka.bootstrap.server.port=9092
kafka.bootstrap.address=${kafka.bootstrap.server.host}:${kafka.bootstrap.server.port}

# Bridge message broker configuration
messaging.broker.url.amqp=amqp://broker-hdls-svc:5672
messaging.broker.url=tcp://broker-hdls-svc:61616
quarkus.qpid-jms.url=amqp://broker-hdls-svc:5672
messaging.broker.host=artemis-broker-hdls-svc
messaging.broker.port=61616
messaging.broker.url.amqp=amqp://${messaging.broker.host}:5672
messaging.broker.url=tcp://${messaging.broker.host}:61616
quarkus.qpid-jms.url=amqp://${messaging.broker.host}:5672

# Auth
users.allowed=user1,user2,user3
10 changes: 5 additions & 5 deletions test/bridges/CrimeBridge.feature
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
@require('org.apache.activemq:artemis-jms-client:2.11.0')
Feature: Crime bridge test

Background:
Expand All @@ -24,13 +23,14 @@ Feature: Crime bridge test

Scenario: Run CrimeBridge Camel K integration
Given Camel K integration property file application-test.properties
Then load Camel K integration CrimeBridge.java
When load Camel K integration CrimeBridge.java
Then Camel K integration crime-bridge should be running
And Camel K integration crime-bridge should print Installed features

Scenario: Alerts ends in JMS queue:alarms
Given jms destination: alarms
And variable location is "citrus:randomString(10)"
And jms selector: location='${location}'
And Camel K integration crime-bridge is running
When send Kafka message with body
"""
{
Expand All @@ -44,7 +44,7 @@ Feature: Crime bridge test
"location": "${location}"
}
}
"""
"""
Then expect JMS message with body
"""
{
Expand All @@ -71,7 +71,7 @@ Feature: Crime bridge test
"location": "${location}"
}
}
"""
"""
Then expect JMS message with body
"""
{
Expand Down
6 changes: 3 additions & 3 deletions test/bridges/EarthquakeBridge.feature
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
@require('org.apache.activemq:artemis-jms-client:2.11.0')
Feature: Earthquake bridge test

Background:
Expand All @@ -24,12 +23,13 @@ Feature: Earthquake bridge test

Scenario: Run EarthquakeBridge Camel K integration
Given Camel K integration property file application-test.properties
Then load Camel K integration EarthquakeBridge.java
When load Camel K integration EarthquakeBridge.java
Then Camel K integration earthquake-bridge should be running
And Camel K integration earthquake-bridge should print Installed features

Scenario: Alerts ends in JMS queue:alarms and queue:notifications
Given variable title is "citrus:randomString(10)"
And jms selector: title='${title}'
And Camel K integration earthquake-bridge should be running
When send Kafka message with body
"""
{
Expand Down
11 changes: 5 additions & 6 deletions test/bridges/HealthBridge.feature
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
@require('org.apache.activemq:artemis-jms-client:2.11.0')
Feature: Health bridge test

Background:
Expand All @@ -24,13 +23,14 @@ Feature: Health bridge test

Scenario: Run HealthBridge Camel K integration
Given Camel K integration property file application-test.properties
Then load Camel K integration HealthBridge.java
When load Camel K integration HealthBridge.java
Then Camel K integration health-bridge should be running
And Camel K integration health-bridge should print Installed features

Scenario: Alerts ends in JMS queue:alarms
Given jms destination: alarms
And variable location is "citrus:randomString(10)"
And jms selector: location='${location}'
And Camel K integration health-bridge is running
When send Kafka message with body
"""
{
Expand All @@ -44,7 +44,7 @@ Feature: Health bridge test
"location": "${location}"
}
}
"""
"""
Then expect JMS message with body
"""
{
Expand All @@ -57,7 +57,6 @@ Feature: Health bridge test
Given jms destination: notifications
And variable location is "citrus:randomString(10)"
And jms selector: location='${location}'
And Camel K integration health-bridge is running
When send Kafka message with body
"""
{
Expand All @@ -71,7 +70,7 @@ Feature: Health bridge test
"location": "${location}"
}
}
"""
"""
Then expect JMS message with body
"""
{
Expand Down
9 changes: 4 additions & 5 deletions test/bridges/PollutionBridge.feature
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
@require('org.apache.activemq:artemis-jms-client:2.11.0')
Feature: Pollution bridge test

Background:
Expand All @@ -24,13 +23,14 @@ Feature: Pollution bridge test

Scenario: Run PollutionBridge Camel K integration
Given Camel K integration property file application-test.properties
Then load Camel K integration PollutionBridge.java
When load Camel K integration PollutionBridge.java
Then Camel K integration pollution-bridge should be running
And Camel K integration pollution-bridge should print Installed features

Scenario: Short term alerts ends in JMS queue:alarms
Given jms destination: alarms
And variable uniqueCity is "citrus:randomString(10)"
And jms selector: city='${uniqueCity}'
And Camel K integration pollution-bridge is running
When send Kafka message with body
"""
{
Expand All @@ -49,7 +49,7 @@ Feature: Pollution bridge test
"country": "CN",
"city": "${uniqueCity}"
}
"""
"""
Then expect JMS message with body
"""
{
Expand All @@ -62,7 +62,6 @@ Feature: Pollution bridge test
Given jms destination: notifications
And variable uniqueCity is "citrus:randomString(10)"
And jms selector: city='${uniqueCity}'
And Camel K integration pollution-bridge is running
When send Kafka message with body
"""
{
Expand Down
10 changes: 10 additions & 0 deletions test/bridges/yaks-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,16 @@ config:
value: false
- name: YAKS_CAMELK_SUPPORT_VARIABLES_IN_SOURCES
value: false
settings:
loggers:
- name: INTEGRATION_STATUS
level: INFO
- name: INTEGRATION_LOGS
level: INFO
dependencies:
- groupId: org.apache.activemq
artifactId: artemis-jms-client
version: 2.21.0
resources:
- ../../CrimeBridge.java
- ../../EarthquakeBridge.java
Expand Down
7 changes: 6 additions & 1 deletion test/consumers/OpenAQConsumer.feature
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,19 @@ Feature: OpenAQ consumer test
And expect Kafka message with body
"""
{
"locationId": "@assertThat(nullValue())@",
"location": "@assertThat(notNullValue())@",
"parameter": "@assertThat(notNullValue())@",
"date": "@assertThat(notNullValue())@",
"value": "@assertThat(notNullValue())@",
"unit": "@assertThat(notNullValue())@",
"coordinates": "@assertThat(notNullValue())@",
"country": "@assertThat(notNullValue())@",
"city": "@assertThat(notNullValue())@"
"city": "@assertThat(notNullValue())@",
"isMobile": "@assertThat(nullValue())@",
"isAnalysis": "@assertThat(nullValue())@",
"entity": "@assertThat(nullValue())@",
"sensorType": "@assertThat(nullValue())@"
}
"""

Expand Down
1 change: 1 addition & 0 deletions test/infra/activemq-address.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ spec:
addressName: ${activemq.address}
queueName: ${activemq.address}
routingType: anycast
removeFromBrokerOnDelete: true
23 changes: 23 additions & 0 deletions test/infra/amq-broker-instance.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
apiVersion: broker.amq.io/v1beta1
kind: ActiveMQArtemis
metadata:
name: artemis-broker
spec:
acceptors:
- name: artemis-acceptor
protocols: 'artemis,core,openwire'
port: 61616
sslEnabled: false
- name: amqp-acceptor
protocols: amqp
port: 5672
sslEnabled: false
deploymentPlan:
size: 1
persistenceEnabled: false
requireLogin: false
messageMigration: false
managementRBACEnabled: true
journalType: nio
jolokiaAgentEnabled: false
image: placeholder
Loading
Loading