0

I have the following step that is being executed.

- name: 'gradle:6.8.3-jdk11'
    entrypoint: 'gradle'
    args: [ 'integration-test']

The integration test fails because there is no mysql server running within. Locally I execute my integration test by spinning up a mysql container with docker. However I am unsure how to do this with cloudbuild.yaml.

I need to use the gradle image here but also the mysql image having a running mysql container.

In Bitbucket I can solve this by providing 'services' where I am able to choose services to run in company with the steps.

I scraped the documentation without any findings: https://cloud.google.com/build/docs/build-config#structure_of_a_build_config_file

xetra11
  • 7,671
  • 14
  • 84
  • 159
  • I am not sure if this is possible. You might have to containerize your application by starting from the Gradle image, coping the source code, creating the database and run the integration tests. [Gradle and Docker (multi-stage builds)](https://codefresh.io/docs/docs/learn-by-example/java/gradle/) – marian.vladoi Mar 10 '21 at 16:07

1 Answers1

1

To avoid the need of bootstrapping a mysql container around my gradle environment I decided to migrate to https://www.testcontainers.org/modules/databases/mysql/

This left me using the gradle image and at the same time run proper integration tests with whiteboxed database connections

xetra11
  • 7,671
  • 14
  • 84
  • 159