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

CLI no longer reading defaultsFile from classpath #1893

Merged
merged 2 commits into from Aug 31, 2021
Merged

CLI no longer reading defaultsFile from classpath #1893

merged 2 commits into from Aug 31, 2021

Conversation

nvoxland
Copy link
Contributor

@nvoxland nvoxland commented Jun 7, 2021

Fixes #1892


Dev Handoff Notes (Internal Use)

Links

Testing

Dev Verification

(did not save output at the time)

Test Requirements (Liquibase Internal QA)

Manual Tests

:: SETUP ::

This test requires a non-executable Jar containing the liquibase.properties and changelog file. We will create this Jar and add it to the Java classpath when we run Liquibase. Use the attached changelog during the setup steps and also when running the tests.

  • Put your properties file, database driver and the the liquibase/lib directory in one directory.
    • This makes the command line easier to write/read without having a bunch of long paths.
    • The attached changelog is fairly generic, although the createView may fail to deploy if you are not running on Postgres.
  • Create the Liquibase resources Jar
    • Include only the changelog and the properties file.
    • jar cvf liquibase-stuff.jar liquibase.properties postgres_community_changelog.xml
  • Put the liquibase.jar in the same directory as the liquibase-stuff.jar

Verify liquibase update reads properties and changelog within liquibase-stuff.jar.

  • java -cp "liquibase.jar;lib/*;liquibase-stuff.jar;postgresql-42.2.5.jar" liquibase.integration.commandline.Main --logLevel=info update
  • Successful output from 3.5.3 is attached; it should look similar in the fix build.

Automated Tests

No new functional tests required for this fix; the PR submitter created an integration test: testParseDefaultPropertyFilesFromResources. I love seeing tests!!

┆Issue is synchronized with this Jira Story by Unito

@nvoxland nvoxland added this to To Do in Conditioning++ via automation Jun 7, 2021
@nvoxland nvoxland moved this from To Do to Code Review in Conditioning++ Jun 7, 2021
@nvoxland nvoxland requested a review from suryaaki2 June 7, 2021 20:45
@suryaaki2 suryaaki2 moved this from Code Review to Ready for Handoff (In JIRA) in Conditioning++ Jun 18, 2021
@sync-by-unito
Copy link

sync-by-unito bot commented Aug 30, 2021

➤ Erzsebet Carmean commented:

Executing this command works as expected with the fix:

java -cp "liquibase.jar;lib/*;liquibase-stuff.jar;postgresql-42.2.5.jar" liquibase.integration.commandline.LiquibaseCommandLine --logLevel=info update

Notes

  • The main classname is liquibase.integration.commandline.LiquibaseCommandLine in versions of liquibase 4.4.2 and newer. Older versions of Liquibase still use the main classname liquibase.integration.commandline.Main.
  • If you are running Liquibase with a secondary jar in automation, set the liquibase.headless:false or liquibase.hub.mode:off properties are set in the liquibase.properties file.
  • If you are running Liquibase with a secondary jar manually, you will be prompted to prompt to join Hub.
    • To join Hub, follow the prompts to create a new account.
    • Copy the Hub connection information out of the liquibase.properties file created in the runtime directory into your liquibase.properties that you include in your secondary jar.
    • In the Liquibase runtime directory, delete the liquibase.properties file created by Hub registration. If you do not remove this file, Liquibase will attempt to use the properties in it, which may cause subsequent executions of the command to fail with the --changelog-file missing required argument. This is because Liquibase uses the liquibase.properties file in the runtime directory instead of the properties file in the jar. Note that this is not caused by the same bug fixed by this PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

CLI no longer reading defaultsFile from classpath
2 participants