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

[DevServices] TestContainers registry configuration #22642

Open
Xendar opened this issue Jan 5, 2022 · 2 comments
Open

[DevServices] TestContainers registry configuration #22642

Xendar opened this issue Jan 5, 2022 · 2 comments
Labels

Comments

@Xendar
Copy link

Xendar commented Jan 5, 2022

Description

Hello,

I am currently working on putting in place a database in my project, and I am planning to leverage on DevServices great feature for having my local DB fired up upon a quarkus:dev/quarkusDev on my local Desktop.
It works fine for now, but I have a constraint: We have a private registry from which we need to pull the Docker images.

So I have 2 use cases to manage:

  1. The mariadb image
  2. the testcontainers/ryuk image

For 1., going through the documentation I can simply override the image in my application.yml file:

quarkus:
  datasource:
    db-kind: mariadb
    devservices:
      image-name: mycompany.com/my-registry/mariadb:10.5.9

Pros: Nice & easy!
Cons: In case the MariaDB image version is updated internally by Quarkus, then I won't benefit from this 😢


For 2., going through the TestContainers documentation, the recommended way is to leverage on the image name suibstitution to automatically prefix any image with the provided private registry

I tried to use first the environment variable TESTCONTAINERS_HUB_IMAGE_NAME_PREFIX setup, but I was not able somehow to make it available to the Gradle quarkusDev task, I feel like this is not possible today. This is working though with the Maven plugin with the standard confifuration/environmentVariables element.
So I looked at the other way by creating a testcontainers.properties file. The file is usually put in the src/test/resources, but to make it work for DevServices I had to put it in the src/main/resources instead

Pros: I really like the idea of applying a prefix instead of overriding the whole image definition!
Cons: I end up having a configuration file used for development in my production jar

Implementation ideas

  1. On Quarkus side, what about putting in place the concept of image name substitution, as having a private registry is quite a common case?
  2. Adding the capability in the Gradle plugin to inject environment/system variables to the quarkusDev task
  3. Ideally, having a way to store configuration files dedicated to DevServices outside of src/main/resources?
@Xendar Xendar added the kind/enhancement New feature or request label Jan 5, 2022
@quarkus-bot
Copy link

quarkus-bot bot commented Jan 5, 2022

/cc @stuartwdouglas

@Eng-Fouad
Copy link
Contributor

See #32662

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

No branches or pull requests

2 participants