-
Notifications
You must be signed in to change notification settings - Fork 590
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
docs: Port Spring guide to use functions #7021
Conversation
I see the following error but I'm not able to find the cause: The MySQL properties are at https://github.com/spring-projects/spring-petclinic/blob/main/src/main/resources/application-mysql.properties |
```shell | ||
dagger install github.com/levlaz/daggerverse/mariadb@v0.2.1 | ||
dagger install github.com/jcsirot/daggerverse/java@250eb3e0f49da321cca2241fe1e1d017b4143a91 | ||
dagger install github.com/shykes/daggerverse/docker@3338120927f8e291c4780de691ef63a7c9d825c0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do we need Docker for? That seems really out of left field, I'd only expect to run Docker in Dagger in fringe situations (legacy compatibility, booth demos, etc).
Removed it locally, doesn't seem to affect anything 🤔
edit: oh, now that I fixed the DB thing below, it does indeed want Docker, nevermind! 🙏
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@vikram-dagger so I got it past the broken DB setup, but now it's failing in a few places because the docker
CLI isn't installed. Pausing there for now. Left inline comments covering my tracks.
To be honest if this example requires Docker it feels pretty distracting from the core focus of the doc (see my initial reaction). I wonder if we should just find a simpler example.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@vito thanks for your help on this, you made much more progress than I did! I'm fine with using a different Spring or other Java example. Do you have a suggestion, or should I try to find something online?
WithJdk("17"). | ||
WithMaven("3.9.5"). | ||
WithProject(source.WithoutDirectory("dagger")). | ||
Maven([]string{"-X", "-Dspring.profiles.active=mysql", "clean", "package"}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The issue seems to be that you need the database bound and configured (i.e. the build :=
part below) before running this command. I'm not seeing a way to do that with the Java module though (cc @jcsirot). Maybe skip the module for now?
edit: actually it looks like we can just pluck .Container()
off and work from there, Maven(
is just shorthand for WithExec(mvn ...)
- working on that now!
// TODO: this doesn't work because the docker CLI isn't installed. And | ||
// installing it just gives us a broken podman CLI. Whee. | ||
// | ||
// Can we just disable the tests that use Docker? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Interesting idea. I checked the app README, it says At development time we recommend you use the test applications set up as main() methods in PetClinicIntegrationTests (using the default H2 database and also adding Spring Boot Devtools), MySqlTestApplication and PostgresIntegrationTests. These are set up so that you can run the apps in your IDE to get fast feedback and also run the same classes as integration tests against the respective database. The MySql integration tests use Testcontainers to start the database in a Docker container, and the Postgres tests use Docker Compose to do the same thing.
It sounds like the app's test suite is already starting MySQL in a container, exactly the same as I was trying to do in the example pipeline. Not quite sure how that helps us move it forward though.
https://github.com/spring-projects/spring-petclinic?tab=readme-ov-file#test-applications
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I got an example working using test containers. You shouldn't start a Maria db as a service but instead start docker as a service. You shouldn't need a docker client for test containers the Java code interacts with docker. I did have to disable ryuk. TESTCONTAINERS_RYUK_DISABLED=true
See https://discord.com/channels/707636530424053791/1179822601099554856/1209537679780487249
@helderco @marcosnils can you please help me debug the above? The same code works in Go and TypeScript. |
@vikram-dagger is this only happening in the python pipeline? |
@marcosnils Yes |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I rebased and force pushed @vikram-dagger
If checks pass, good to merge from my side ⛴️
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is unused
docs/current_docs/integrations/snippets/java/typescript/index.ts
Outdated
Show resolved
Hide resolved
Signed-off-by: Vikram Vaswani <vikram@dagger.io>
Signed-off-by: Vikram Vaswani <vikram@dagger.io>
Signed-off-by: Vikram Vaswani <vikram@dagger.io>
Docker still failing - can it be disabled instead? Seems distracting Signed-off-by: Alex Suraci <alex@dagger.io>
Signed-off-by: Vikram Vaswani <vikram@dagger.io>
Signed-off-by: Vikram Vaswani <vikram@dagger.io>
Signed-off-by: Vikram Vaswani <vikram@dagger.io>
Signed-off-by: Vikram Vaswani <vikram@dagger.io>
Signed-off-by: Vikram Vaswani <vikram@dagger.io>
Signed-off-by: Vikram Vaswani <vikram@dagger.io>
Signed-off-by: Vikram Vaswani <vikram@dagger.io>
Co-authored-by: Kyle Penfound <kyle@dagger.io> Signed-off-by: Solomon Hykes <shykes@users.noreply.github.com>
FYI don't merge, there's a broken snippet (python) |
b52cb1d
to
9560f15
Compare
Python snippet working for me now from a new module I made with I'm on a Mac M1 arm machine, so I needed to force use of Running locally, I think I kept running out of resources, so I cranked up all the limits in Docker Desktop for memory, swap, virtual memory, volumes, etc, and it worked after that. [Too many errors, abort]
qemu: uncaught target signal 11 (Segmentation fault) - core dumped Once I fixed platform and increased Docker Desktop resources, I had no issue publishing to
Then it ran like this:
so I could see the pretty colors of the logs So...I'll update the other snippets to specify the platform as well. Todo: |
Signed-off-by: Jeremy Adams <jeremy@dagger.io>
Tested all snippet versions by making them the main of new go, python, typescript modules and running them. 👍 |
Fixes https://linear.app/dagger/issue/DOCS-191/spring
This commit ports the Spring guide at https://archive.docs.dagger.io/0.9/882813/build-test-publish-java-spring to use Dagger Functions.