Hi Pasha, Not _exactly_ identical to your use case, but what we do in our Gradle build is to launch a test container for our code generation, then run the migrations (with Flyway), then shut the container down. This works for us, but we've put the whole "launch test container" and run codegen etc. in a dedicated Java class instead of managing it purely via Gradle.
I can share some more details as needed, but you could first look at this which shows what our Gradle task looks like for this: https://groups.google.com/g/jooq-user/c/PxxcBaB8gxA/m/hxDKw3SvAgAJ Best regards, Per Lundberg ________________________________ From: [email protected] <[email protected]> on behalf of Pasha Finkelshtein <[email protected]> Sent: Thursday, February 22, 2024 11:01 To: [email protected] <[email protected]> Subject: Re: jOOQ+Liquibase+docker I tried, no luck yet :) But I believe it's just something nobody did - launch a container for build, not for tests. Also, LiquibaseDatabase won't work for me, because I use `CALL` in my migrations, which creates a lot of entities in the DB... On Thu, 22 Feb 2024, 09:58 Lukas Eder, <[email protected]<mailto:[email protected]>> wrote: Well, surely testscontainers folks will be able to help with testcontainers specific issues? On Thu, Feb 22, 2024 at 9:44 AM Pasha Finkelshtein <[email protected]<mailto:[email protected]>> wrote: Certainly it should work, but I can't start test containers within the Gradle build :( doLast should not be even needed — Ryuk will take care of shutting the container down Also, we need to run Liquibase migrations, so I think bringing container up should be a separate task too [https://ci3.googleusercontent.com/mail-sig/AIorK4za4fFQtg5s3Z7Qt_4tUSoPU0k02d5cI8YvoL_XXhdrnoCdrfDc2Hb43A7SLRf3xTicYMys8Yw] [https://resources.jetbrains.com/storage/products/company/brand/logos/jb_beam.png] [facebook]<https://fb.com/asm0dey> [twitter]<https://twitter.com/asm0di0> [linkedin]<https://linkedin.com/in/asm0dey> [instagram]<https://instagram.com/asm0dey> Pasha Finkelshteyn Developer Advocate for Data Engineering JetBrains [https://cdn2.hubspot.net/hubfs/53/tools/email-signature-generator/icons/email-icon-2x.png] [email protected]<mailto:[email protected]> [https://cdn2.hubspot.net/hubfs/53/tools/email-signature-generator/icons/link-icon-2x.png] https://linktr.ee/asm0dey Find out more<https://jetbrains.com> On Thu, 22 Feb 2024 at 08:46, Lukas Eder <[email protected]<mailto:[email protected]>> wrote: Hi Pasha, I haven't tried yet, but it seems that Task.doFirst() and Task.doLast() could help here? E.g. tasks.named("jooqCodegen") { doFirst { // Start testcontainers } doLast { // Stop testcontainers } } You might add some additional logic to coordinate liquibase with jooqCodegen I hope this helps On Thu, Feb 22, 2024 at 8:41 AM Pasha Finkelshtein <[email protected]<mailto:[email protected]>> wrote: Hi everybody! I wanna do the following during my Gradle build: 1. Launch docker (test?) container with postgres 2. Run my Liquibase migrations on it 3. Regenerate jOOQ code from the database 4. Bring the container down However, I didn't find a working way to launch a (test)container during the build. Did anybody succeed in doing this? Best, Pasha -- You received this message because you are subscribed to the Google Groups "jOOQ User Group" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]<mailto:[email protected]>. To view this discussion on the web visit https://groups.google.com/d/msgid/jooq-user/3422abd2-8312-4fc4-8476-82b6bf3b25ebn%40googlegroups.com<https://groups.google.com/d/msgid/jooq-user/3422abd2-8312-4fc4-8476-82b6bf3b25ebn%40googlegroups.com?utm_medium=email&utm_source=footer>. -- You received this message because you are subscribed to a topic in the Google Groups "jOOQ User Group" group. To unsubscribe from this topic, visit https://groups.google.com/d/topic/jooq-user/WYKlwguBHwE/unsubscribe. To unsubscribe from this group and all its topics, send an email to [email protected]<mailto:[email protected]>. To view this discussion on the web visit https://groups.google.com/d/msgid/jooq-user/CAB4ELO5wcrgPJj9vKNS4Pr33E-0xhnTDKAn7kWwir-ma7XM1eA%40mail.gmail.com<https://groups.google.com/d/msgid/jooq-user/CAB4ELO5wcrgPJj9vKNS4Pr33E-0xhnTDKAn7kWwir-ma7XM1eA%40mail.gmail.com?utm_medium=email&utm_source=footer>. -- You received this message because you are subscribed to the Google Groups "jOOQ User Group" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]<mailto:[email protected]>. To view this discussion on the web visit https://groups.google.com/d/msgid/jooq-user/CAO4yE_bi%3DiPeDNSj0fgxc-mcSiUfxSUHpennN%3DuM7FKJZ%3Dj%3DWQ%40mail.gmail.com<https://groups.google.com/d/msgid/jooq-user/CAO4yE_bi%3DiPeDNSj0fgxc-mcSiUfxSUHpennN%3DuM7FKJZ%3Dj%3DWQ%40mail.gmail.com?utm_medium=email&utm_source=footer>. -- You received this message because you are subscribed to a topic in the Google Groups "jOOQ User Group" group. To unsubscribe from this topic, visit https://groups.google.com/d/topic/jooq-user/WYKlwguBHwE/unsubscribe. To unsubscribe from this group and all its topics, send an email to [email protected]<mailto:[email protected]>. To view this discussion on the web visit https://groups.google.com/d/msgid/jooq-user/CAB4ELO5LOu3f7h5s_vsmz59Vw4kbHwxbf656DK5d76fk%2BHZu3Q%40mail.gmail.com<https://groups.google.com/d/msgid/jooq-user/CAB4ELO5LOu3f7h5s_vsmz59Vw4kbHwxbf656DK5d76fk%2BHZu3Q%40mail.gmail.com?utm_medium=email&utm_source=footer>. -- You received this message because you are subscribed to the Google Groups "jOOQ User Group" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]<mailto:[email protected]>. To view this discussion on the web visit https://groups.google.com/d/msgid/jooq-user/CAO4yE_ZD0i7L8YxLt_EEMYkEpT2r_a73OvHczKUHRxyAjdMxKQ%40mail.gmail.com<https://groups.google.com/d/msgid/jooq-user/CAO4yE_ZD0i7L8YxLt_EEMYkEpT2r_a73OvHczKUHRxyAjdMxKQ%40mail.gmail.com?utm_medium=email&utm_source=footer>. -- You received this message because you are subscribed to the Google Groups "jOOQ User Group" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/jooq-user/VI0PR08MB104485D5810B24FF940ADFC1DEA562%40VI0PR08MB10448.eurprd08.prod.outlook.com.
