-
Notifications
You must be signed in to change notification settings - Fork 5
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
feat: add the script (from @cmoulliard) to execute rhte scenario automatically #48
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,119 @@ | ||
oc new-project test | ||
|
||
cd ~/Temp | ||
echo "########################" | ||
echo "#### Create Test project at this path: $(pwd)" | ||
echo "########################" | ||
mkdir test && cd test | ||
|
||
echo "########################" | ||
echo "#### Create Pom parent file" | ||
echo "########################" | ||
cat <<EOF > pom.xml | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
<groupId>me.fruitstand</groupId> | ||
<artifactId>parent</artifactId> | ||
<version>1.0.0-SNAPSHOT</version> | ||
<name>Spring Boot - Demo</name> | ||
<description>Spring Boot - Demo</description> | ||
<packaging>pom</packaging> | ||
<modules> | ||
<module>fruit-backend-sb</module> | ||
<module>fruit-client-sb</module> | ||
</modules> | ||
</project> | ||
EOF | ||
|
||
echo "########################" | ||
echo "#### Scaffold projects" | ||
echo "########################" | ||
|
||
hal component spring-boot \ | ||
-i fruit-backend-sb \ | ||
-g me.fruitsand \ | ||
-p me.fruitsand.demo \ | ||
-s 2.1.6.RELEASE \ | ||
-t crud \ | ||
-v 1.0.0-SNAPSHOT \ | ||
--supported=false \ | ||
fruit-backend-sb | ||
|
||
hal component spring-boot \ | ||
-i fruit-client-sb \ | ||
-g me.fruitsand \ | ||
-p me.fruitsand.demo \ | ||
-s 2.1.6.RELEASE \ | ||
-t client \ | ||
-v 1.0.0-SNAPSHOT \ | ||
--supported=false \ | ||
fruit-client-sb | ||
|
||
echo "########################" | ||
echo "#### Maven package" | ||
echo "########################" | ||
mvn package -f fruit-client-sb | ||
mvn package -f fruit-backend-sb -Pkubernetes | ||
|
||
echo "########################" | ||
echo "#### Create component" | ||
echo "########################" | ||
hal component create -c fruit-client-sb | ||
hal component create -c fruit-backend-sb | ||
|
||
echo "########################" | ||
echo "#### Create Capability" | ||
echo "########################" | ||
hal capability create -n postgres-db -g database -t postgres -v 10 -p DB_NAME=sample-db -p DB_PASSWORD=admin -p DB_USER=admin | ||
sleep 15s | ||
|
||
echo "########################" | ||
echo "#### Link" | ||
echo "########################" | ||
hal link create -n backend-to-db -t fruit-backend-sb -s postgres-db-config | ||
hal link create -n client-to-backend -t fruit-client-sb -e KUBERNETES_ENDPOINT_FRUIT=http://fruit-backend-sb:8080/api/fruits | ||
|
||
echo "########################" | ||
echo "#### Push" | ||
echo "########################" | ||
sleep 60s | ||
|
||
hal component push -c fruit-client-sb | ||
# PROJECT=fruit-client-sb | ||
# NAMESPACE=test | ||
# POD_ID=$(oc get pod -lapp=$PROJECT -n $NAMESPACE -o name | awk -F '/' '{print $2}') | ||
# oc cp $PROJECT/pom.xml $POD_ID:/usr/src/ -n $NAMESPACE | ||
# oc cp $PROJECT/src $POD_ID:/usr/src/ -n $NAMESPACE | ||
# oc exec $POD_ID -n $NAMESPACE /var/lib/supervisord/bin/supervisord ctl start build | ||
# oc exec $POD_ID -n $NAMESPACE /var/lib/supervisord/bin/supervisord ctl start run | ||
Comment on lines
+84
to
+90
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Remove the comments |
||
|
||
hal component push -c fruit-backend-sb | ||
# PROJECT=fruit-backend-sb | ||
# NAMESPACE=test | ||
# POD_ID=$(oc get pod -lapp=$PROJECT -n $NAMESPACE -o name | awk -F '/' '{print $2}') | ||
# oc cp $PROJECT/pom.xml $POD_ID:/usr/src/ -n $NAMESPACE | ||
# oc cp $PROJECT/src $POD_ID:/usr/src/ -n $NAMESPACE | ||
# oc exec $POD_ID -n $NAMESPACE /var/lib/supervisord/bin/supervisord ctl start build | ||
# oc exec $POD_ID -n $NAMESPACE /var/lib/supervisord/bin/supervisord ctl start run | ||
Comment on lines
+93
to
+99
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Remove the comments |
||
|
||
echo "########################" | ||
echo "#### Wait and call endpoint" | ||
echo "########################" | ||
sleep 120s | ||
BACKEND_URL=$(oc get routes/fruit-backend-sb --template={{.spec.host}}) | ||
http -s solarized POST "http://${BACKEND_URL}/api/fruits" name=Orange | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Add a comment top of the README file to explain that curl or httpie (depending which one is used) must be installed. !! Be carefull as this script will not test the endpoint to check if the output matches our expectation. Such step is part of the circleci end to end script used on halkyon operator |
||
http -s solarized POST "http://${BACKEND_URL}/api/fruits" name=Banana | ||
http -s solarized POST "http://${BACKEND_URL}/api/fruits" name=Pineapple | ||
http -s solarized POST "http://${BACKEND_URL}/api/fruits" name=Apple | ||
http -s solarized POST "http://${BACKEND_URL}/api/fruits" name=Pear | ||
|
||
FRONTEND_URL=$(oc get routes/fruit-client-sb --template={{.spec.host}}) | ||
http "http://${FRONTEND_URL}/api/client" -s solarized | ||
|
||
echo "########################" | ||
echo "#### Delete" | ||
echo "########################" | ||
oc delete all --all -n test | ||
cd .. && rm -rf test |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You need also kubedb. I suggest that you add the link about how to install halkyon from the halkyon project.
... where a Halkyon operator is installed
->where a Halkyon operator is installed - see doc = link