Skip to content

Compose Dev Services should not add wait strategies for ignored containers #49219

@michelkaeser

Description

@michelkaeser

Describe the bug

ComposeProject adds waiting strategies for all services defined in the Dev services compose even if they are ignored (io.quarkus.devservices.compose.ignore: true). Such services should not be waited for.

Motivation are "initialization" services that are meant to run and then exit aka not stay running.

Expected behavior

Ignored services do not have a waiting strategy added.

Actual behavior

Waiting strategy is added causing a failure during start-up.

ERROR [io.qua.dep.dev.IsolatedDevModeMain] (main) Failed to start quarkus: java.lang.RuntimeException: io.quarkus.builder.BuildException: Build failure: Build failed due to errors
        [error]: Build step io.quarkus.devservices.deployment.compose.ComposeDevServicesProcessor#config threw an exception: java.lang.IllegalStateException: Services named [run-and-exit] do not exist, but wait conditions have been defined for them.
        at io.quarkus.devservices.deployment.compose.ComposeProject.discoverServiceInstances(ComposeProject.java:293)
        at io.quarkus.devservices.deployment.compose.ComposeProject.start(ComposeProject.java:178)
        at io.quarkus.devservices.deployment.compose.ComposeDevServicesProcessor.startCompose(ComposeDevServicesProcessor.java:254)
        at io.quarkus.devservices.deployment.compose.ComposeDevServicesProcessor.config(ComposeDevServicesProcessor.java:122)
        at java.base/java.lang.invoke.MethodHandle.invokeWithArguments(MethodHandle.java:735)
        at io.quarkus.deployment.ExtensionLoader$3.execute(ExtensionLoader.java:856)
        at io.quarkus.builder.BuildContext.run(BuildContext.java:255)
        at org.jboss.threads.ContextHandler$1.runWith(ContextHandler.java:18)
        at org.jboss.threads.EnhancedQueueExecutor$Task.doRunWith(EnhancedQueueExecutor.java:2651)
        at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2630)
        at org.jboss.threads.EnhancedQueueExecutor.runThreadBody(EnhancedQueueExecutor.java:1622)
        at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1589)
        at java.base/java.lang.Thread.run(Thread.java:1447)
        at org.jboss.threads.JBossThread.run(JBossThread.java:501)

        at io.quarkus.runner.bootstrap.AugmentActionImpl.runAugment(AugmentActionImpl.java:372)
        at io.quarkus.runner.bootstrap.AugmentActionImpl.createInitialRuntimeApplication(AugmentActionImpl.java:289)
        at io.quarkus.runner.bootstrap.AugmentActionImpl.createInitialRuntimeApplication(AugmentActionImpl.java:61)
        at io.quarkus.deployment.dev.IsolatedDevModeMain.firstStart(IsolatedDevModeMain.java:89)
        at io.quarkus.deployment.dev.IsolatedDevModeMain.accept(IsolatedDevModeMain.java:432)
        at io.quarkus.deployment.dev.IsolatedDevModeMain.accept(IsolatedDevModeMain.java:55)
        at io.quarkus.bootstrap.app.CuratedApplication.runInCl(CuratedApplication.java:143)
        at io.quarkus.bootstrap.app.CuratedApplication.runInAugmentClassLoader(CuratedApplication.java:98)
        at io.quarkus.deployment.dev.DevModeMain.start(DevModeMain.java:107)
        at io.quarkus.deployment.dev.DevModeMain.main(DevModeMain.java:70)
Caused by: io.quarkus.builder.BuildException: Build failure: Build failed due to errors
        [error]: Build step io.quarkus.devservices.deployment.compose.ComposeDevServicesProcessor#config threw an exception: java.lang.IllegalStateException: Services named [run-and-exit] do not exist, but wait conditions have been defined for them.
        at io.quarkus.devservices.deployment.compose.ComposeProject.discoverServiceInstances(ComposeProject.java:293)
        at io.quarkus.devservices.deployment.compose.ComposeProject.start(ComposeProject.java:178)
        at io.quarkus.devservices.deployment.compose.ComposeDevServicesProcessor.startCompose(ComposeDevServicesProcessor.java:254)
        at io.quarkus.devservices.deployment.compose.ComposeDevServicesProcessor.config(ComposeDevServicesProcessor.java:122)
        at java.base/java.lang.invoke.MethodHandle.invokeWithArguments(MethodHandle.java:735)
        at io.quarkus.deployment.ExtensionLoader$3.execute(ExtensionLoader.java:856)
        at io.quarkus.builder.BuildContext.run(BuildContext.java:255)
        at org.jboss.threads.ContextHandler$1.runWith(ContextHandler.java:18)
        at org.jboss.threads.EnhancedQueueExecutor$Task.doRunWith(EnhancedQueueExecutor.java:2651)
        at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2630)
        at org.jboss.threads.EnhancedQueueExecutor.runThreadBody(EnhancedQueueExecutor.java:1622)
        at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1589)
        at java.base/java.lang.Thread.run(Thread.java:1447)
        at org.jboss.threads.JBossThread.run(JBossThread.java:501)

How to Reproduce?

Minimal compose.yaml to reproduce:

services:

  run-and-exit:
    image: hello-world
    labels:
      io.quarkus.devservices.compose.ignore: true

  db:
    image: postgres
    depends_on:
      run-and-exit:
        condition: service_completed_successfully

Output of uname -a or ver

No response

Output of java -version

No response

Quarkus version or git rev

3.23.4

Build tool (ie. output of mvnw --version or gradlew --version)

No response

Additional information

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions