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

Add ConfiguredValueModifier extension point for plugins #2252

Merged
merged 3 commits into from
Jun 3, 2022

Conversation

mcred
Copy link
Contributor

@mcred mcred commented Dec 3, 2021

Environment: All OS

Liquibase Version: 4.6.1 +

Liquibase Integration & Version: CLI

Pull Request Type

  • Bug fix (non-breaking change which fixes an issue.)
  • Enhancement/New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Description

Extensions should be able to modify the value of a property directly based on a loaded priority. Example: the value for a url in the properties file could be a placeholder and the extension should replace that value during runtime.

Testing

I was not able to get all of the unit tests to pass prior to developing this plugin, but the additional tests for ConfiguredValueTest pass and the existing tests for that class continue to pass.

Screen Shot 2021-12-03 at 2 08 52 PM

Fast Track PR Acceptance Checklist:

Need Help?

Come chat with us on our discord channel

@mcred mcred changed the title Add ConfiguratedValueModifier extension point for plugins Add ConfiguredValueModifier extension point for plugins Dec 3, 2021
@mcred mcred requested a review from nvoxland December 6, 2021 14:38
@kataggart kataggart added this to To Do in Conditioning++ via automation Jan 12, 2022
@mcred mcred force-pushed the feature/configured-value-modifier branch from 7e6d934 to b95ae64 Compare February 17, 2022 16:20
Signed-off-by: Derek Smart <derek@grindaga.com>
@mcred mcred force-pushed the feature/configured-value-modifier branch from b95ae64 to b59e0cb Compare February 17, 2022 19:28
@mcred
Copy link
Contributor Author

mcred commented Feb 17, 2022

Rebased and updated test:

[INFO] Reactor Summary for liquibase 0-SNAPSHOT:
[INFO] 
[INFO] liquibase .......................................... SUCCESS [  0.985 s]
[INFO] liquibase-core ..................................... SUCCESS [01:06 min]
[INFO] liquibase-cli ...................................... SUCCESS [  2.595 s]
[INFO] liquibase-maven-plugin ............................. SUCCESS [  4.959 s]
[INFO] liquibase-cdi ...................................... SUCCESS [  5.388 s]
[INFO] liquibase-extension-testing ........................ SUCCESS [  2.865 s]
[INFO] liquibase-integration-tests ........................ SUCCESS [ 41.217 s]
[INFO] liquibase-dist ..................................... SUCCESS [  0.060 s]
[INFO] liquibase-extension-examples ....................... SUCCESS [  0.252 s]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  02:04 min
[INFO] Finished at: 2022-02-17T14:28:05-05:00
[INFO] ------------------------------------------------------------------------

@nvoxland nvoxland changed the base branch from master to 1_9 May 27, 2022 18:12
@nvoxland nvoxland changed the base branch from 1_9 to master May 27, 2022 18:12
@nvoxland nvoxland added SafeToBuild Indicates that a particular PR contains changes which are safe to build using GitHub actions autocandidate labels May 27, 2022
Copy link
Contributor

@nvoxland nvoxland left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I made some changes to your original PR:

  • I moved the logic of applying the modifier into LiquibiseConfiguration which is the more "root" spot. That should make it be applied everywhere better
  • I renamed ConfiguredValueModifier's getPriority() method to getOrder() since it's not really the "replacing" logic we use for plugins but an "order" like in CommandStep. Related to that, I made the factory not implement PluginFactory since it's not using the normal plugin replacement logic.
  • I made ConfiguredValueModifier's logic be based around being another "override" spot vs. replacing values. I think that will work better with the tracking and logic we have around "nested" values.

@github-actions
Copy link

Unit Test Results

  4 512 files  ±  0    4 512 suites  ±0   31m 55s ⏱️ -34s
  4 423 tests +  4    4 209 ✔️ +  8     214 💤  - 4  0 ±0 
52 356 runs  +48  47 348 ✔️ +52  5 008 💤  - 4  0 ±0 

Results for commit 89e7a29. ± Comparison against base commit 4ab687b.

@liquibase liquibase deleted a comment from andre15silva May 27, 2022
@nvoxland
Copy link
Contributor

nvoxland commented May 27, 2022

Notes and test results:

Things to be aware of

  • The failing functional tests are unrelated to this change
  • This adds a new extension point that 3rd parties can take advantage of. We are not currently using it in the liquibase code beyond the automated tests that were added

Things to worry about

  • Nothing

Copy link
Contributor

@XDelphiGrl XDelphiGrl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR allows Liquibase extensions to modify configuration values based on a ordering (or priority) set by the extension.

  • Code used by extension developers; no impact on Liquibase users beyond those using extensions that take advantage of this enhancement.
  • New unit tests added.
  • No additional testing required.

APPROVED

Functional Tests
Passing Test Harness Execution
NOTE: Test failures in the functional test suite are due to mismatch in expected console output and actual console output for the checks feature. These are unrelated to the changes in this PR and can be disregarded.

@nvoxland nvoxland merged commit cb043b3 into liquibase:master Jun 3, 2022
Conditioning++ automation moved this from To Do to Done Jun 3, 2022
@kataggart kataggart added this to the NEXT milestone Jun 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
autocandidate DocNeeded enabler Extensions IntegrationCLI SafeToBuild Indicates that a particular PR contains changes which are safe to build using GitHub actions TypeEnhancement ver4.6.1
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

None yet

5 participants