Skip to content

Commit

Permalink
Update ch09-cicd.adoc
Browse files Browse the repository at this point in the history
The current settings (scripts) did not work in my environment. The commands are executed as sudo, then somewhat environment vriables aren't passed. So it seems to be added `-E` option. And according to jdk version change, jvm option `--add-opens=java.base/java.lang=ALL-UNNAMED` also needs to be added.

Additionally, the environment variables `JAVA_HOME`, `PATH` need to be added to Jenkins System Configuraion, as I issued docker#528.
  • Loading branch information
ecormaksin committed Jul 3, 2021
1 parent 12b50ab commit 31327de
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions developer-tools/java/chapters/ch09-cicd.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ image::docker-ci-cd-03.png[]
cd sample
# Generates the images
sudo /var/jenkins_home/tools/hudson.tasks.Maven_MavenInstallation/maven/bin/mvn clean install -Papp-docker-image
sudo -E /var/jenkins_home/tools/hudson.tasks.Maven_MavenInstallation/maven/bin/mvn clean install -Papp-docker-image
# Starts the mongo service. The -p option allows multiple builds to run at the same time,
# since we can start multiple instances of the containers
Expand All @@ -74,14 +74,14 @@ sudo docker-compose -p app-$BUILD_NUMBER --file src/test/resources/docker-compos
sleep 30
# Run the application
sudo docker-compose -p app-$BUILD_NUMBER --file src/test/resources/docker-compose.yml \
sudo -E docker-compose -p app-$BUILD_NUMBER --file src/test/resources/docker-compose.yml \
run mongo-docker-demo \
java -jar /maven/jar/mongo-docker-demo-1.0-SNAPSHOT-jar-with-dependencies.jar mongo
java --add-opens=java.base/java.lang=ALL-UNNAMED -jar /maven/jar/mongo-docker-demo-1.0-SNAPSHOT-jar-with-dependencies.jar mongo
# Run the integration tests
sudo docker-compose -p app-$BUILD_NUMBER --file src/test/resources/docker-compose.yml \
sudo -E docker-compose -p app-$BUILD_NUMBER --file src/test/resources/docker-compose.yml \
run mongo-docker-demo-tests \
mvn -f /maven/code/pom.xml -Dmaven.repo.local=/m2/repository \
mvn -e JAVA_TOOL_OPTIONS="--add-opens=java.base/java.lang=ALL-UNNAMED" -f /maven/code/pom.xml -Dmaven.repo.local=/m2/repository \
-Pintegration-test verify
----
+
Expand All @@ -98,7 +98,7 @@ image::docker-ci-cd-05.png[]
[source, text]
----
cd sample
sudo docker-compose -p app-$BUILD_NUMBER --file src/test/resources/docker-compose.yml down
sudo -E docker-compose -p app-$BUILD_NUMBER --file src/test/resources/docker-compose.yml down
----
+
. Uncheck the `Execute script only if build succeeds` and `Execute script only if build fails` options, so this script will run always when the build ends. This way, we make sure to always stop the services.
Expand Down

0 comments on commit 31327de

Please sign in to comment.