salesforce/rules_spring

Support launching the Spring Boot application in the background with bazel run

Closed this issue · 0 comments

The maven plugin has both run and start goals.

  • run is a blocking operation
  • start is a non-blocking operation, it starts the application in the background and returns immediately

https://docs.spring.io/spring-boot/docs/current/maven-plugin/reference/htmlsingle/#goals-start

The non-blocking operation is useful on its own, but seems to have been motivated by integration tests.

  • start application
  • run tests
  • stop application

We should support the same feature in the bazel run feature.

  • Allow the BUILD file to specify the backgrounding behavior as an attribute on the springboot rule
  • Allow the user to set an env variable in the same shell that will execute bazel run to control it
  • If either the BUILD file attribute, or the env variable, are true, then start the app in the background
  • We need to persist the PID of the process in a file when we do this, so that an integration test can kill the process in the end.
  • Capture the application stdout/stderr output to a file