Skip to content

Commit 31327de

Browse files
authored
Update ch09-cicd.adoc
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.
1 parent 12b50ab commit 31327de

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

developer-tools/java/chapters/ch09-cicd.adoc

+6-6
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ image::docker-ci-cd-03.png[]
6464
cd sample
6565
6666
# Generates the images
67-
sudo /var/jenkins_home/tools/hudson.tasks.Maven_MavenInstallation/maven/bin/mvn clean install -Papp-docker-image
67+
sudo -E /var/jenkins_home/tools/hudson.tasks.Maven_MavenInstallation/maven/bin/mvn clean install -Papp-docker-image
6868
6969
# Starts the mongo service. The -p option allows multiple builds to run at the same time,
7070
# since we can start multiple instances of the containers
@@ -74,14 +74,14 @@ sudo docker-compose -p app-$BUILD_NUMBER --file src/test/resources/docker-compos
7474
sleep 30
7575
7676
# Run the application
77-
sudo docker-compose -p app-$BUILD_NUMBER --file src/test/resources/docker-compose.yml \
77+
sudo -E docker-compose -p app-$BUILD_NUMBER --file src/test/resources/docker-compose.yml \
7878
run mongo-docker-demo \
79-
java -jar /maven/jar/mongo-docker-demo-1.0-SNAPSHOT-jar-with-dependencies.jar mongo
79+
java --add-opens=java.base/java.lang=ALL-UNNAMED -jar /maven/jar/mongo-docker-demo-1.0-SNAPSHOT-jar-with-dependencies.jar mongo
8080
8181
# Run the integration tests
82-
sudo docker-compose -p app-$BUILD_NUMBER --file src/test/resources/docker-compose.yml \
82+
sudo -E docker-compose -p app-$BUILD_NUMBER --file src/test/resources/docker-compose.yml \
8383
run mongo-docker-demo-tests \
84-
mvn -f /maven/code/pom.xml -Dmaven.repo.local=/m2/repository \
84+
mvn -e JAVA_TOOL_OPTIONS="--add-opens=java.base/java.lang=ALL-UNNAMED" -f /maven/code/pom.xml -Dmaven.repo.local=/m2/repository \
8585
-Pintegration-test verify
8686
----
8787
+
@@ -98,7 +98,7 @@ image::docker-ci-cd-05.png[]
9898
[source, text]
9999
----
100100
cd sample
101-
sudo docker-compose -p app-$BUILD_NUMBER --file src/test/resources/docker-compose.yml down
101+
sudo -E docker-compose -p app-$BUILD_NUMBER --file src/test/resources/docker-compose.yml down
102102
----
103103
+
104104
. 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.

0 commit comments

Comments
 (0)