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 initial DevServices-like implementation #730

Merged
merged 2 commits into from
Jun 25, 2024
Merged

Add initial DevServices-like implementation #730

merged 2 commits into from
Jun 25, 2024

Conversation

nscuro
Copy link
Member

@nscuro nscuro commented Jun 14, 2024

Description

Adds a new dev-services Maven profile. It is intended to be used in conjunction with the Jetty plugin. A respective IntelliJ run configuration is included.

When enabled, PostgreSQL, Redpanda, and frontend containers will be launched automatically, and disposed when the application stops. Dependency-Track will be auto-configured to use the containers, no manual configuration required.

To avoid introducing runtime dependencies on test libraries for production builds, the logic uses reflection to interact with the testcontainers library.

Topics required by the API server will be created automatically. Database migrations are executed as usual.

The containers are not currently discoverable and re-usable by the Quarkus-based services. That capability is planned for a future iteration, see DependencyTrack/hyades#1188

With this functionality, it becomes easier to test features that do not rely on the other Hyades services (e.g. REST API related stuff), or frontend modifications. In those scenarios, using Docker Compose is no longer needed.

Addressed Issue

Relates to DependencyTrack/hyades#1188

Additional Details

To run from command line:

mvn -Penhance -Pdev-services jetty:run \
  -Dlogback.configurationFile=src/main/docker/logback.xml

Excluded from test coverage reporting since it's a dev-only functionality.

Checklist

  • I have read and understand the contributing guidelines
  • This PR fixes a defect, and I have provided tests to verify that the fix is effective
  • This PR implements an enhancement, and I have provided tests to verify that it works as intended
  • This PR introduces changes to the database model, and I have updated the migration changelog accordingly
  • This PR introduces new or alters existing behavior, and I have updated the documentation accordingly

@nscuro nscuro added enhancement New feature or request dx Issues related to developer experience (DX) labels Jun 14, 2024
@nscuro nscuro added this to the 5.5.0 milestone Jun 14, 2024
@nscuro nscuro force-pushed the dev-services-poc branch from 49da349 to 86a1be9 Compare June 14, 2024 22:33
Copy link

codacy-production bot commented Jun 14, 2024

Coverage summary from Codacy

See diff coverage on Codacy

Coverage variation Diff coverage
+0.01% (target: -1.00%) 100.00% (target: 70.00%)
Coverage variation details
Coverable lines Covered lines Coverage
Common ancestor commit (f82e86e) 20484 16718 81.61%
Head commit (0a1c5e6) 20490 (+6) 16724 (+6) 81.62% (+0.01%)

Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch: <coverage of head commit> - <coverage of common ancestor commit>

Diff coverage details
Coverable lines Covered lines Diff coverage
Pull request (#730) 13 13 100.00%

Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified: <covered lines added or modified>/<coverable lines added or modified> * 100%

See your quality gate settings    Change summary preferences


🚀 Don’t miss a bit, follow what’s new on Codacy.

Codacy stopped sending the deprecated coverage status on June 5th, 2024. Learn more

@nscuro nscuro force-pushed the dev-services-poc branch 4 times, most recently from 3733110 to dfa6d2e Compare June 16, 2024 13:50
Adds a new `dev-services` Maven profile. It is intended to be used in conjunction with the Jetty plugin. A respective IntelliJ run configuration is included.

When enabled, PostgreSQL and Redpanda containers will be launched automatically, and disposed when the application stops. Dependency-Track will be auto-configured to use the containers, no manual configuration required.

To avoid introducing runtime dependencies on test libraries for production builds, the logic uses reflection to interact with the `testcontainers` library.

Topics required by the API server will be created automatically. Database migrations are executed as usual.

The containers are not currently discoverable and re-usable by the Quarkus-based services. That capability is planned for a future iteration, see DependencyTrack/hyades#1188

With this functionality, it becomes easier to test features that do not rely on the other Hyades services (e.g. REST API related stuff), or frontend modifications. In those scenarios, using Docker Compose is no longer needed.

Signed-off-by: nscuro <[email protected]>
@nscuro nscuro force-pushed the dev-services-poc branch from dfa6d2e to a955e18 Compare June 20, 2024 19:40
@nscuro nscuro merged commit afe484a into main Jun 25, 2024
9 checks passed
@nscuro nscuro deleted the dev-services-poc branch June 25, 2024 09:29
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 25, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
dx Issues related to developer experience (DX) enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants