ThomasVitale / cloud-native-spring-in-action

🍃 Code samples and projects from the book "Cloud Native Spring in Action - With Spring Boot and Kubernetes" (Manning)
https://www.manning.com/books/cloud-native-spring-in-action
Apache License 2.0
426 stars 257 forks source link

Issues with Tiltfile #35

Closed sewah2012 closed 1 year ago

sewah2012 commented 1 year ago

Hi, there seems to be an issues with the tilt file in the custom_build part.

The output of the $EXPRECTED_REF seems not to comply with the image name expected for the the OCI image being built with buildPack and as such throws this exception:

STEP 1/3 — Building Custom Build: [config-service] Custom Build: Injecting Environment Variables EXPECTED_REF=config-service:tilt-build-1676992767 EXPECTED_IMAGE=library/config-service EXPECTED_TAG=tilt-build-1676992767 DOCKER_CERT_PATH=C:\Users\emmsewah.minikube\certs DOCKER_HOST=tcp://127.0.0.1:49181 DOCKER_TLS_VERIFY=1 MINIKUBE_ACTIVE_DOCKERD=polar Running cmd: gradlew bootBuildImage --imageName $EXPECTED_REF Starting a Gradle Daemon, 2 busy and 1 incompatible and 1 stopped Daemons could not be reused, use --status for details

Task :compileJava UP-TO-DATE Task :processResources UP-TO-DATE Task :classes UP-TO-DATE Task :resolveMainClassName UP-TO-DATE Task :bootJar UP-TO-DATE Task :bootBuildImage FAILED

FAILURE: Build failed with an exception.

BUILD FAILED in 7s 5 actionable tasks: 1 executed, 4 up-to-date gradlew bootBuildImage --imageName $EXPECTED_REF exited with exit code 1

Build Failed: Custom build "gradlew bootBuildImage --imageName $EXPECTED_REF" failed: exit status 1

ThomasVitale commented 1 year ago

@sewah2012 thanks for reporting this issue. In the book I assume all the examples are run via the Windows Subsystem for Linux, but with small changes you can also run them directly on Windows. I started a new guide with some tips. I hope it will be useful. Any feedback would be much appreciated, thank you!

In particular, if you want to run Tilt from Windows directly, a couple of changes are required to the Tiltfile:

  1. replace ./gradlew with gradlew to run Gradlew from the BAT script
  2. replace $EXPECTED_REF with %EXPECTED_REF% to get the value for this environment variable using the Windows syntax.
custom_build(
    ref = 'catalog-service',
    command = 'gradlew bootBuildImage --imageName %EXPECTED_REF%',
    deps = ['build.gradle', 'src']
)