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

MODOAIPMH-433 - embedded-postgresql-maven-plugin -> docker-maven-plugin #301

Open
wants to merge 25 commits into
base: master
Choose a base branch
from

Conversation

khandramai
Copy link
Contributor

@khandramai khandramai commented Mar 17, 2023

MODOAIPMH-433 - Unable to build on ARM

Purpose

Support ARM architecture

Approach

Replace maven-embedded-postgres-client to docker-maven-plugin

TODOS and Open Questions

How to verify build on ARM architecture?

Learning

Pre-Merge Checklist:

Before merging this PR, please go through the following list and take appropriate actions.

  • Does this PR meet or exceed the expected quality standards?
    • Code coverage on new code is 80% or greater
    • Duplications on new code is 3% or less
    • Check logging
    • There are no major code smells or security issues
  • Does this introduce breaking changes?
    • Were any API paths or methods changed, added or removed?
    • Were there any schema changes?
    • Did any of the interface versions change?
    • Were permissions changed, added, or removed?
    • Are there new interface dependencies?
    • There are no breaking changes in this PR.

If there are breaking changes, please STOP and consider the following:

  • What other modules will these changes impact?
  • Do JIRAs exist to update the impacted modules?
    • If not, please create them
    • Do they contain the appropriate level of detail? Which endpoints/schemas changed, etc.
    • Do they have all they appropriate links to blocked/related issues?
  • Are the JIRAs under active development?
    • If not, contact the project's PO and make sure they're aware of the urgency.
  • Do PRs exist for these changes?
    • If so, have they been approved?

Ideally all of the PRs involved in breaking changes would be merged in the same day to avoid breaking the folio-testing environment. Communication is paramount if that is to be achieved, especially as the number of intermodule and inter-team dependencies increase.

While it's helpful for reviewers to help identify potential problems, ensuring that it's safe to merge is ultimately the responsibility of the PR assignee.

@khandramai khandramai self-assigned this Mar 17, 2023
pom.xml Outdated Show resolved Hide resolved
</configuration>
<groupId>io.fabric8</groupId>
<artifactId>docker-maven-plugin</artifactId>
<version>0.22.1</version>
<executions>
Copy link
Contributor

Choose a reason for hiding this comment

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

Before starting the database you need to clean up a left-over database from a previous run where a maven phase after prepare-database but before stop-database has failed:

          <execution>
            <id>stop-previous-database</id>
            <phase>generate-sources</phase>
            <goals>
              <goal>stop</goal>
            </goals>
          </execution>

pom.xml Outdated Show resolved Hide resolved
pom.xml Outdated Show resolved Hide resolved
@julianladisch julianladisch self-requested a review March 24, 2023 15:39
Comment on lines +163 to +165
<postgres.docker.env.POSTGRES_DB>localhost</postgres.docker.env.POSTGRES_DB>
<postgres.docker.envRun.POSTGRES_PASSWORD>postgres</postgres.docker.envRun.POSTGRES_PASSWORD>
<postgres.docker.envRun.POSTGRES_USER>postgres</postgres.docker.envRun.POSTGRES_USER>
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't see any usage of these variables. Can they be removed?

<postgres.docker.envRun.POSTGRES_PASSWORD>postgres</postgres.docker.envRun.POSTGRES_PASSWORD>
<postgres.docker.envRun.POSTGRES_USER>postgres</postgres.docker.envRun.POSTGRES_USER>
<postgres.docker.log.prefix>postgres</postgres.docker.log.prefix>
<postgres.docker.name>postgres:12.0</postgres.docker.name>
Copy link
Contributor

Choose a reason for hiding this comment

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

Can .0 be removed so that the latest version 12 release is used?

We don't want vulnerable components in the build.

pom.xml Outdated Show resolved Hide resolved
pom.xml Outdated Show resolved Hide resolved
pom.xml Outdated Show resolved Hide resolved
pom.xml Outdated Show resolved Hide resolved
pom.xml Outdated Show resolved Hide resolved
pom.xml Outdated Show resolved Hide resolved
@julianladisch julianladisch self-requested a review March 29, 2023 00:20
@khandramai
Copy link
Contributor Author

@julianladisch , thank you for assistance in CI configuration!

@NikitaSedyx
Copy link
Contributor

@julianladisch as we work with docker in docker, should DOCKER_HOST be defined to be sure socket is the same?

@julianladisch
Copy link
Contributor

testcontainers support starting another Docker container inside a Docker container in scenarios like Jenkins CI:
https://www.testcontainers.org/supported_docker_environment/continuous_integration/dind_patterns/
This requires to use the gateway, not localhost, as ip address when calling the container. testcontainers detects the gateway: https://github.com/testcontainers/testcontainers-java/blob/1.17.6/core/src/main/java/org/testcontainers/dockerclient/DockerClientConfigUtils.java

docker-maven-plugin doesn't support this. It is a known issue:
fabric8io/docker-maven-plugin#461
fabric8io/docker-maven-plugin#300
fabric8io/docker-maven-plugin#1527
docker-mven-plugin doesn't detect the gateway: https://github.com/fabric8io/docker-maven-plugin/blob/v0.42.0/src/main/java/io/fabric8/maven/docker/service/DockerAccessFactory.java#L95

@julianladisch
Copy link
Contributor

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

Successfully merging this pull request may close these issues.

4 participants