Skip to content

Support original file name for config file #8988

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

Closed

Conversation

shahbour
Copy link
Contributor

#Support original file name even if it is a symbolic link for conf file . this is needed if systemd or init.d is pointing to a symbolic link file instead of the original fat jar stackoverflow.

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Apr 25, 2017
@wilkinsona
Copy link
Member

Thanks for the PR. Can you please take a look at the launch script's integration tests and add one that fails without this change and passes with it?

@wilkinsona wilkinsona added the status: waiting-for-feedback We need additional information before we can continue label May 13, 2017
@shahbour
Copy link
Contributor Author

i am trying to do the test, but before i start i was not able to run current test.
I did install docker as requested on my ubuntu but then when i run the verify it stuck

shahbour@ali-Lenovo:~/IdeaProjects/spring-boot/spring-boot-integration-tests/spring-boot-launch-script-tests$  export DOCKER_URL=unix:///var/run/docker.sock
shahbour@ali-Lenovo:~/IdeaProjects/spring-boot/spring-boot-integration-tests/spring-boot-launch-script-tests$ mvn -Pdocker clean verify | more
[INFO] Scanning for projects...
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building Spring Boot Launch Script Integration Tests 2.0.0.BUILD-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] --- maven-clean-plugin:3.0.0:clean (default-clean) @ spring-boot-launch-script-tests ---
[INFO] Deleting /home/shahbour/IdeaProjects/spring-boot/spring-boot-integration-tests/spring-boot-launch-script-tests/target
[INFO] 
[INFO] --- maven-checkstyle-plugin:2.17:check (checkstyle-validation) @ spring-boot-launch-script-tests ---
[INFO] Starting audit...
Audit done.
[INFO] 
[INFO] --- maven-enforcer-plugin:1.4:enforce (enforce-rules) @ spring-boot-launch-script-tests ---
[INFO] 
[INFO] --- maven-resources-plugin:3.0.1:resources (default-resources) @ spring-boot-launch-script-tests ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /home/shahbour/IdeaProjects/spring-boot/spring-boot-integration-tests/spring-boot-launch-script-tests/src/main/resources
[INFO] 
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ spring-boot-launch-script-tests ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 2 source files to /home/shahbour/IdeaProjects/spring-boot/spring-boot-integration-tests/spring-boot-launch-script-tests/target/classes
[INFO] 
[INFO] --- maven-resources-plugin:3.0.1:testResources (default-testResources) @ spring-boot-launch-script-tests ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 25 resources
[INFO] 
[INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) @ spring-boot-launch-script-tests ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 1 source file to /home/shahbour/IdeaProjects/spring-boot/spring-boot-integration-tests/spring-boot-launch-script-tests/target/test-classes
[INFO] 
[INFO] --- maven-surefire-plugin:2.18.1:test (default-test) @ spring-boot-launch-script-tests ---
[INFO] 
[INFO] --- animal-sniffer-maven-plugin:1.15:check (enforce-java-8) @ spring-boot-launch-script-tests ---
[INFO] Checking unresolved references to org.codehaus.mojo.signature:java18:1.0
[INFO] 
[INFO] --- maven-jar-plugin:3.0.2:jar (default-jar) @ spring-boot-launch-script-tests ---
[INFO] Building jar: /home/shahbour/IdeaProjects/spring-boot/spring-boot-integration-tests/spring-boot-launch-script-tests/target/spring-boot-launch-script-tests-2.0.0.BUILD-SNAPSHOT.jar
[INFO] 
[INFO] --- maven-source-plugin:3.0.1:jar-no-fork (attach-sources) @ spring-boot-launch-script-tests ---
[INFO] Building jar: /home/shahbour/IdeaProjects/spring-boot/spring-boot-integration-tests/spring-boot-launch-script-tests/target/spring-boot-launch-script-tests-2.0.0.BUILD-SNAPSHOT-sour
ces.jar
[INFO] 
[INFO] --- spring-boot-maven-plugin:2.0.0.BUILD-SNAPSHOT:repackage (default) @ spring-boot-launch-script-tests ---
[INFO] 
[INFO] --- maven-failsafe-plugin:2.18:integration-test (default) @ spring-boot-launch-script-tests ---
[INFO] Failsafe report directory: /home/shahbour/IdeaProjects/spring-boot/spring-boot-integration-tests/spring-boot-launch-script-tests/target/failsafe-reports

-------------------------------------------------------
 T E S T S
-------------------------------------------------------
Running org.springframework.boot.launchscript.SysVinitLaunchScriptIT

Any help , i could not figure out where it is getting stuck

@wilkinsona
Copy link
Member

You probably just need to wait a while. The first time those tests run they can take a really long time as it downloads everything it needs to build the Docker images.

@shahbour
Copy link
Contributor Author

i did the changes to the test files , but i am not able to test them with my updated script.

I thought i need to build spring-boot-maven-plugin , so it got the new script on doing test .

but it is failing like below

Script1.groovy: 21: unable to resolve class Verify.WarArchiveVerification 
 @ line 21, column 38.
   new Verify.WarArchiveVerification(f) {
[INFO] -------------------------------------------------
[INFO] Build Summary:
[INFO]   Passed: 16, Failed: 22, Errors: 0, Skipped: 0
[INFO] -------------------------------------------------
[ERROR] The following builds failed:
[ERROR] *  build-info/pom.xml
[ERROR] *  build-info-additional-properties/pom.xml
[ERROR] *  build-info-cutom-file/pom.xml
[ERROR] *  jar/pom.xml
[ERROR] *  jar-attach-disabled/pom.xml
[ERROR] *  jar-create-dir/pom.xml
[ERROR] *  jar-custom-dir/pom.xml
[ERROR] *  jar-custom-launcher/pom.xml
[ERROR] *  jar-exclude-artifact/pom.xml
[ERROR] *  jar-exclude-entry/pom.xml
[ERROR] *  jar-exclude-group/pom.xml
[ERROR] *  jar-executable/pom.xml
[ERROR] *  jar-lib-name-conflict/pom.xml
[ERROR] *  jar-non-executable/pom.xml
[ERROR] *  jar-system-scope/pom.xml
[ERROR] *  jar-system-scope-default/pom.xml
[ERROR] *  jar-test-scope/pom.xml
[ERROR] *  jar-with-unpack/pom.xml
[ERROR] *  prop/pom.xml
[ERROR] *  war/pom.xml
[ERROR] *  war-reactor/pom.xml
[ERROR] *  war-with-unpack/pom.xml

i tried to update to latest spring-boot code but seems it is a mess now as i had all changed in this branch :(.

Can you help on what is needed so i force running the tests indicated above to use the new script i am suggesting ?

@shahbour
Copy link
Contributor Author

i was trying to build the maven-plugin from its folder , but when i used ./mvnw clean install -pl spring-boot-tools/spring-boot-maven-plugin -Pdefault,full the build did work .

Should i do another PR as this one got mixed up

@snicoll
Copy link
Member

snicoll commented May 31, 2017

@shabour you should rebase your executable_config_file to a fresh copy of master (our master not your fork) and then push force on your branch. This will update this PR (no need to create another one).

…ckoverflow.com/questions/43584510/conf-file-for-spring-boot-application](config file) this is needed if your systemd or init.d is pointing to a symbolic link file instead of the original fat jar
@shahbour shahbour force-pushed the executable_config_file branch from 8548ee6 to 86a7d93 Compare May 31, 2017 07:45
@shahbour
Copy link
Contributor Author

@snicoll wow thanks for the tip

@shahbour
Copy link
Contributor Author

shahbour commented Jun 1, 2017

I need help in checking out what is the problem , when doing the commands manually the script do work perfectly but on automated tests it is failing

Tests run: 2, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 42.223 sec <<< FAILURE! - in org.springframework.boot.launchscript.SysVinitLaunchScriptIT
launchWithSingleJavaOpt[Ubuntu xenial-20160914](org.springframework.boot.launchscript.SysVinitLaunchScriptIT)  Time elapsed: 33.931 sec  <<< FAILURE!
java.lang.AssertionError: 
Expecting:
 <"Started [50]
">
to contain:
 <"Launched"> 
        at org.springframework.boot.launchscript.SysVinitLaunchScriptIT.doLaunch(SysVinitLaunchScriptIT.java:227)
        at org.springframework.boot.launchscript.SysVinitLaunchScriptIT.launchWithSingleJavaOpt(SysVinitLaunchScriptIT.java:194)

I commented out removing the container but i am not getting any good info from log

Launchedgp@gp:~$ docker container logs determined_jones 
Started [50]
gp@gp:~$ docker container logs determined_jones 
Started [50]

any tip on how to check what is going on ?

@wilkinsona
Copy link
Member

You should be able to get some more information from the app's log file

@shahbour
Copy link
Contributor Author

shahbour commented Jun 1, 2017

I am new to docker , i should get this from docker container right ?

@wilkinsona
Copy link
Member

Yes, that's right

shahbour added 2 commits June 2, 2017 00:16
…symbolic link except if it contain init.d

Add test to check the configuration file when having double link
@shahbour
Copy link
Contributor Author

shahbour commented Jun 1, 2017

The reason it was failing on tests was because I am testing using systemd while in tests it is init.d which is a yet another link.
Currently it is working with both and i did a new test for it , further on my machine i did all the tests by changing install_service to have double link so all tests were done but for the final version i just added a new test.

Note : My tests were only done only on ubuntu images as centos was not passing the build . it was not able to download oracle java

@philwebb philwebb removed the status: waiting-for-feedback We need additional information before we can continue label Jun 2, 2017
@shahbour
Copy link
Contributor Author

shahbour commented Jun 29, 2017

Any thing still missing or need to be done on this PR @wilkinsona

@wilkinsona
Copy link
Member

@shahbour No, nothing more is needed at this stage other than me carving out some time to review and hopefully merge it. Thank you for all your efforts thus far.

@philwebb philwebb added priority: normal type: enhancement A general enhancement and removed status: waiting-for-triage An issue we've not yet triaged labels Jul 6, 2017
@philwebb philwebb modified the milestones: 2.0.0.M3, 2.0.0.M4 Jul 6, 2017
@philwebb
Copy link
Member

philwebb commented Jul 6, 2017

@wilkinsona I've tentatively targeted this to 2.0, if you think 1.5.x is better feel free to change.

@wilkinsona wilkinsona added this to the 2.0.0.M5 milestone Jul 28, 2017
@wilkinsona wilkinsona removed this from the 2.0.0.M4 milestone Jul 28, 2017
@wilkinsona wilkinsona self-assigned this Sep 26, 2017
wilkinsona added a commit that referenced this pull request Sep 26, 2017
* gh-8988:
  Polish "Find .conf file next to symlink to jar that's using the launch script"
  Find .conf file next to symlink to jar that's using the launch script
@wilkinsona
Copy link
Member

Thanks very much for the PR, @shahbour. Particularly for taking the time to also add the integration test. I've merged the changes into master.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: enhancement A general enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants