From 704e49ebe1edd4458d8b73073b4e7dbef21918ae Mon Sep 17 00:00:00 2001 From: Pat Losoponkul Date: Wed, 15 Nov 2023 18:21:09 +0700 Subject: [PATCH 01/10] fix: make sure test libs dont leak to runnable Signed-off-by: Pat Losoponkul --- build.sbt | 48 ++++++++----------- .../keycloak/admin/KeycloakAdmin.scala | 0 project/plugins.sbt | 2 +- .../containers/KeycloakContainerCustom.scala | 0 .../containers/KeycloakTestContainer.scala | 0 .../KeycloakTestContainerSupport.scala | 0 .../PostgreSQLContainerCustom.scala | 0 .../sharedtest/containers/PostgresLayer.scala | 0 .../containers/PostgresTestContainer.scala | 0 .../PostgresTestContainerSupport.scala | 0 .../containers/VaultContainerCustom.scala | 0 .../containers/VaultTestContainer.scala | 0 12 files changed, 22 insertions(+), 28 deletions(-) rename prism-agent/service/server/src/{main => test}/scala/io/iohk/atala/iam/authorization/keycloak/admin/KeycloakAdmin.scala (100%) rename shared-test/src/{main => test}/scala/io/iohk/atala/sharedtest/containers/KeycloakContainerCustom.scala (100%) rename shared-test/src/{main => test}/scala/io/iohk/atala/sharedtest/containers/KeycloakTestContainer.scala (100%) rename shared-test/src/{main => test}/scala/io/iohk/atala/sharedtest/containers/KeycloakTestContainerSupport.scala (100%) rename shared-test/src/{main => test}/scala/io/iohk/atala/sharedtest/containers/PostgreSQLContainerCustom.scala (100%) rename shared-test/src/{main => test}/scala/io/iohk/atala/sharedtest/containers/PostgresLayer.scala (100%) rename shared-test/src/{main => test}/scala/io/iohk/atala/sharedtest/containers/PostgresTestContainer.scala (100%) rename shared-test/src/{main => test}/scala/io/iohk/atala/sharedtest/containers/PostgresTestContainerSupport.scala (100%) rename shared-test/src/{main => test}/scala/io/iohk/atala/sharedtest/containers/VaultContainerCustom.scala (100%) rename shared-test/src/{main => test}/scala/io/iohk/atala/sharedtest/containers/VaultTestContainer.scala (100%) diff --git a/build.sbt b/build.sbt index 69304ca23d..87b20b59b3 100644 --- a/build.sbt +++ b/build.sbt @@ -125,10 +125,10 @@ lazy val D = new { val scalaPbRuntime: ModuleID = "com.thesamet.scalapb" %% "scalapb-runtime" % scalapb.compiler.Version.scalapbVersion % "protobuf" val scalaPbGrpc: ModuleID = "com.thesamet.scalapb" %% "scalapb-runtime-grpc" % scalapb.compiler.Version.scalapbVersion - // TODO we are adding test stuff to the main dependencies - val testcontainersPostgres: ModuleID = "com.dimafeng" %% "testcontainers-scala-postgresql" % V.testContainersScala - val testcontainersVault: ModuleID = "com.dimafeng" %% "testcontainers-scala-vault" % V.testContainersScala - val testcontainersKeycloak: ModuleID = "com.github.dasniko" % "testcontainers-keycloak" % V.testContainersJavaKeycloak + + val testcontainersPostgres: ModuleID = "com.dimafeng" %% "testcontainers-scala-postgresql" % V.testContainersScala % Test + val testcontainersVault: ModuleID = "com.dimafeng" %% "testcontainers-scala-vault" % V.testContainersScala % Test + val testcontainersKeycloak: ModuleID = "com.github.dasniko" % "testcontainers-keycloak" % V.testContainersJavaKeycloak % Test val doobiePostgres: ModuleID = "org.tpolecat" %% "doobie-postgres" % V.doobie val doobieHikari: ModuleID = "org.tpolecat" %% "doobie-hikari" % V.doobie @@ -155,9 +155,6 @@ lazy val D_Shared = new { Seq( D.typesafeConfig, D.scalaPbGrpc, - D.testcontainersPostgres, - D.testcontainersVault, - D.testcontainersKeycloak, D.zio, // FIXME: split shared DB stuff as subproject? D.doobieHikari, @@ -168,22 +165,19 @@ lazy val D_Shared = new { lazy val D_SharedTest = new { lazy val dependencies: Seq[ModuleID] = - Seq( - D.typesafeConfig, - D.testcontainersPostgres, - D.testcontainersVault, - D.testcontainersKeycloak, - D.zio, - D.doobieHikari, - D.doobiePostgres, - D.zioCatsInterop, - D.zioJson, - D.zioHttp, - D.zioTest, - D.zioTestSbt, - D.zioTestMagnolia, - D.zioMock - ) + D_Shared.dependencies ++ + Seq( + D.testcontainersPostgres, + D.testcontainersVault, + D.testcontainersKeycloak, + D.zioCatsInterop, + D.zioJson, + D.zioHttp, + D.zioTest, + D.zioTestSbt, + D.zioTestMagnolia, + D.zioMock + ) } lazy val D_Connect = new { @@ -711,7 +705,7 @@ lazy val polluxDoobie = project ) .dependsOn(polluxCore % "compile->compile;test->test") .dependsOn(shared) - .dependsOn(sharedTest % Test) + .dependsOn(sharedTest % "test->test") // ######################## // ### Pollux Anoncreds ### @@ -761,7 +755,7 @@ lazy val connectDoobie = project libraryDependencies ++= D_Connect.sqlDoobieDependencies ) .dependsOn(shared) - .dependsOn(sharedTest % Test) + .dependsOn(sharedTest % "test->test") .dependsOn(connectCore % "compile->compile;test->test") // ############################ @@ -797,7 +791,7 @@ lazy val prismAgentWalletAPI = project castorCore, eventNotification ) - .dependsOn(sharedTest % Test) + .dependsOn(sharedTest % "test->test") lazy val prismAgentServer = project .in(file("prism-agent/service/server")) @@ -830,7 +824,7 @@ lazy val prismAgentServer = project castorCore, eventNotification ) - .dependsOn(sharedTest % Test) + .dependsOn(sharedTest % "test->test") // ############################ // #### Release process ##### diff --git a/prism-agent/service/server/src/main/scala/io/iohk/atala/iam/authorization/keycloak/admin/KeycloakAdmin.scala b/prism-agent/service/server/src/test/scala/io/iohk/atala/iam/authorization/keycloak/admin/KeycloakAdmin.scala similarity index 100% rename from prism-agent/service/server/src/main/scala/io/iohk/atala/iam/authorization/keycloak/admin/KeycloakAdmin.scala rename to prism-agent/service/server/src/test/scala/io/iohk/atala/iam/authorization/keycloak/admin/KeycloakAdmin.scala diff --git a/project/plugins.sbt b/project/plugins.sbt index cf9014c180..40fc8bb023 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -6,7 +6,7 @@ addSbtPlugin("com.github.sbt" % "sbt-native-packager" % "1.9.11") addSbtPlugin("org.scoverage" % "sbt-scoverage" % "2.0.6") addSbtPlugin("com.github.sbt" % "sbt-native-packager" % "1.9.11") addSbtPlugin("org.scoverage" % "sbt-coveralls" % "1.3.9") -addSbtPlugin("com.github.sbt" % "sbt-license-report" % "1.5.0") +addSbtPlugin("com.github.sbt" % "sbt-license-report" % "1.6.1") addSbtPlugin("com.thesamet" % "sbt-protoc" % "1.0.6") // In order to import proper version of com.google.protobuf.ByteString we need to add this dependency diff --git a/shared-test/src/main/scala/io/iohk/atala/sharedtest/containers/KeycloakContainerCustom.scala b/shared-test/src/test/scala/io/iohk/atala/sharedtest/containers/KeycloakContainerCustom.scala similarity index 100% rename from shared-test/src/main/scala/io/iohk/atala/sharedtest/containers/KeycloakContainerCustom.scala rename to shared-test/src/test/scala/io/iohk/atala/sharedtest/containers/KeycloakContainerCustom.scala diff --git a/shared-test/src/main/scala/io/iohk/atala/sharedtest/containers/KeycloakTestContainer.scala b/shared-test/src/test/scala/io/iohk/atala/sharedtest/containers/KeycloakTestContainer.scala similarity index 100% rename from shared-test/src/main/scala/io/iohk/atala/sharedtest/containers/KeycloakTestContainer.scala rename to shared-test/src/test/scala/io/iohk/atala/sharedtest/containers/KeycloakTestContainer.scala diff --git a/shared-test/src/main/scala/io/iohk/atala/sharedtest/containers/KeycloakTestContainerSupport.scala b/shared-test/src/test/scala/io/iohk/atala/sharedtest/containers/KeycloakTestContainerSupport.scala similarity index 100% rename from shared-test/src/main/scala/io/iohk/atala/sharedtest/containers/KeycloakTestContainerSupport.scala rename to shared-test/src/test/scala/io/iohk/atala/sharedtest/containers/KeycloakTestContainerSupport.scala diff --git a/shared-test/src/main/scala/io/iohk/atala/sharedtest/containers/PostgreSQLContainerCustom.scala b/shared-test/src/test/scala/io/iohk/atala/sharedtest/containers/PostgreSQLContainerCustom.scala similarity index 100% rename from shared-test/src/main/scala/io/iohk/atala/sharedtest/containers/PostgreSQLContainerCustom.scala rename to shared-test/src/test/scala/io/iohk/atala/sharedtest/containers/PostgreSQLContainerCustom.scala diff --git a/shared-test/src/main/scala/io/iohk/atala/sharedtest/containers/PostgresLayer.scala b/shared-test/src/test/scala/io/iohk/atala/sharedtest/containers/PostgresLayer.scala similarity index 100% rename from shared-test/src/main/scala/io/iohk/atala/sharedtest/containers/PostgresLayer.scala rename to shared-test/src/test/scala/io/iohk/atala/sharedtest/containers/PostgresLayer.scala diff --git a/shared-test/src/main/scala/io/iohk/atala/sharedtest/containers/PostgresTestContainer.scala b/shared-test/src/test/scala/io/iohk/atala/sharedtest/containers/PostgresTestContainer.scala similarity index 100% rename from shared-test/src/main/scala/io/iohk/atala/sharedtest/containers/PostgresTestContainer.scala rename to shared-test/src/test/scala/io/iohk/atala/sharedtest/containers/PostgresTestContainer.scala diff --git a/shared-test/src/main/scala/io/iohk/atala/sharedtest/containers/PostgresTestContainerSupport.scala b/shared-test/src/test/scala/io/iohk/atala/sharedtest/containers/PostgresTestContainerSupport.scala similarity index 100% rename from shared-test/src/main/scala/io/iohk/atala/sharedtest/containers/PostgresTestContainerSupport.scala rename to shared-test/src/test/scala/io/iohk/atala/sharedtest/containers/PostgresTestContainerSupport.scala diff --git a/shared-test/src/main/scala/io/iohk/atala/sharedtest/containers/VaultContainerCustom.scala b/shared-test/src/test/scala/io/iohk/atala/sharedtest/containers/VaultContainerCustom.scala similarity index 100% rename from shared-test/src/main/scala/io/iohk/atala/sharedtest/containers/VaultContainerCustom.scala rename to shared-test/src/test/scala/io/iohk/atala/sharedtest/containers/VaultContainerCustom.scala diff --git a/shared-test/src/main/scala/io/iohk/atala/sharedtest/containers/VaultTestContainer.scala b/shared-test/src/test/scala/io/iohk/atala/sharedtest/containers/VaultTestContainer.scala similarity index 100% rename from shared-test/src/main/scala/io/iohk/atala/sharedtest/containers/VaultTestContainer.scala rename to shared-test/src/test/scala/io/iohk/atala/sharedtest/containers/VaultTestContainer.scala From 99a8aaa2ab38d9dcc5621f9e875cab14b050a1ad Mon Sep 17 00:00:00 2001 From: Pat Losoponkul Date: Thu, 16 Nov 2023 00:59:33 +0700 Subject: [PATCH 02/10] fix: explicitly define transitive dependencies of resteasyclient Signed-off-by: Pat Losoponkul --- build.sbt | 78 ++++++++++++++++++++++++++++++++++++++++++++----------- 1 file changed, 63 insertions(+), 15 deletions(-) diff --git a/build.sbt b/build.sbt index 87b20b59b3..8bfda18bf5 100644 --- a/build.sbt +++ b/build.sbt @@ -56,6 +56,7 @@ lazy val V = new { // https://mvnrepository.com/artifact/io.circe/circe-core val circe = "0.14.6" + val jackson = "2.14.3" val tapir = "1.6.4" @@ -126,9 +127,11 @@ lazy val D = new { "com.thesamet.scalapb" %% "scalapb-runtime" % scalapb.compiler.Version.scalapbVersion % "protobuf" val scalaPbGrpc: ModuleID = "com.thesamet.scalapb" %% "scalapb-runtime-grpc" % scalapb.compiler.Version.scalapbVersion - val testcontainersPostgres: ModuleID = "com.dimafeng" %% "testcontainers-scala-postgresql" % V.testContainersScala % Test + val testcontainersPostgres: ModuleID = + "com.dimafeng" %% "testcontainers-scala-postgresql" % V.testContainersScala % Test val testcontainersVault: ModuleID = "com.dimafeng" %% "testcontainers-scala-vault" % V.testContainersScala % Test - val testcontainersKeycloak: ModuleID = "com.github.dasniko" % "testcontainers-keycloak" % V.testContainersJavaKeycloak % Test + val testcontainersKeycloak: ModuleID = + "com.github.dasniko" % "testcontainers-keycloak" % V.testContainersJavaKeycloak % Test exclude ("org.keycloak", "keycloak-admin-client") val doobiePostgres: ModuleID = "org.tpolecat" %% "doobie-postgres" % V.doobie val doobieHikari: ModuleID = "org.tpolecat" %% "doobie-hikari" % V.doobie @@ -164,20 +167,65 @@ lazy val D_Shared = new { } lazy val D_SharedTest = new { + // https://github.com/sbt/sbt-license-report/issues/87 + // https://stackoverflow.com/questions/48771768/sbt-error-importing-resteasy-client + // + // 'sbt-license' plugin is using ivy to resolve dependencies where other tasks are using coursier. + // 'org.jboss.resteasy:resteasy-*' which is the transitive dependencies of 'keycloak-admin-client' + // has this issue where 'relativePath' is used in the 'parent' section. + // - https://github.com/resteasy/resteasy/blob/6.2.4.Final/resteasy-client-api/pom.xml#L9 + // - https://www.scala-sbt.org/1.x/docs/Library-Management.html#Known+limitations + // + // This workaround provides those dependencies explicitly, but it will be a nightmare to maintain. + // FIXME: solve this with a long-term solution + lazy val keycloakAdminExplicitDependencies: Seq[ModuleID] = + Seq[ModuleID]( + "org.keycloak" % "keycloak-admin-client" % V.keycloak excludeAll ( + ExclusionRule("org.jboss.resteasy", "resteasy-core"), + ExclusionRule("org.jboss.resteasy", "resteasy-multipart-provider"), + ExclusionRule("org.jboss.resteasy", "resteasy-jackson2-provider"), + ExclusionRule("org.jboss.resteasy", "resteasy-jaxb-provider"), + ), + "org.jboss.resteasy" % "resteasy-core" % "6.2.4.Final" excludeAll ( + ExclusionRule("jakarta.servlet", "jakarta.servlet-api"), + ), + "org.jboss.resteasy" % "resteasy-jackson2-provider" % "6.2.4.Final" excludeAll ( + ExclusionRule("jakarta.servlet", "jakarta.servlet-api"), + ), + "org.jboss.logging" % "jboss-logging" % "3.5.0.Final", + "commons-codec" % "commons-codec" % "1.15", + "jakarta.ws.rs" % "jakarta.ws.rs-api" % "3.1.0", + "jakarta.annotation" % "jakarta.annotation-api" % "2.1.1", + "jakarta.xml.bind" % "jakarta.xml.bind-api" % "3.0.1", + "org.reactivestreams" % "reactive-streams" % "1.0.4", + "jakarta.validation" % "jakarta.validation-api" % "3.0.2", + "org.jboss" % "jandex" % "2.4.3.Final", + "jakarta.activation" % "jakarta.activation-api" % "2.1.2", + "org.eclipse.angus" % "angus-activation" % "1.0.0", + "com.ibm.async" % "asyncutil" % "0.1.0", + "org.apache.httpcomponents" % "httpclient" % "4.5.14", + "com.github.java-json-tools" % "json-patch" % "1.13", + "com.fasterxml.jackson.core" % "jackson-core" % V.jackson, + "com.fasterxml.jackson.core" % "jackson-databind" % V.jackson, + "com.fasterxml.jackson.core" % "jackson-annotations" % V.jackson, + "com.fasterxml.jackson.jakarta.rs" % "jackson-jakarta-rs-base" % V.jackson, + "com.fasterxml.jackson.jakarta.rs" % "jackson-jakarta-rs-json-provider" % V.jackson, + "com.fasterxml.jackson.module" % "jackson-module-jakarta-xmlbind-annotations" % V.jackson, + ).map(_ % Test) + lazy val dependencies: Seq[ModuleID] = - D_Shared.dependencies ++ - Seq( - D.testcontainersPostgres, - D.testcontainersVault, - D.testcontainersKeycloak, - D.zioCatsInterop, - D.zioJson, - D.zioHttp, - D.zioTest, - D.zioTestSbt, - D.zioTestMagnolia, - D.zioMock - ) + D_Shared.dependencies ++ keycloakAdminExplicitDependencies ++ Seq( + D.testcontainersPostgres, + D.testcontainersVault, + D.testcontainersKeycloak, + D.zioCatsInterop, + D.zioJson, + D.zioHttp, + D.zioTest, + D.zioTestSbt, + D.zioTestMagnolia, + D.zioMock + ) } lazy val D_Connect = new { From 4570ac4c81efc017e08bae83756c778143dce69e Mon Sep 17 00:00:00 2001 From: Pat Losoponkul Date: Thu, 16 Nov 2023 13:24:48 +0700 Subject: [PATCH 03/10] ci: use java 22 for release workflow Signed-off-by: Pat Losoponkul --- .github/workflows/release.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 597eb90567..3b6edd5833 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -33,7 +33,7 @@ jobs: - name: Setup Java and Scala uses: olafurpg/setup-scala@v13 with: - java-version: openjdk@1.11 + java-version: openjdk@1.22 - name: Setup Node.js uses: actions/setup-node@v3 with: @@ -41,7 +41,7 @@ jobs: - name: Setup Helm uses: azure/setup-helm@v3 with: - version: '3.12.2' # default is latest (stable) + version: "3.12.2" # default is latest (stable) id: install - name: Setup yq - portable yaml processor uses: mikefarah/yq@v4.34.2 From f21b5720a4e4415862d9ffc1e984fc1922f930b2 Mon Sep 17 00:00:00 2001 From: Pat Losoponkul Date: Thu, 16 Nov 2023 13:30:54 +0700 Subject: [PATCH 04/10] ci: use java 17 for release workflow Signed-off-by: Pat Losoponkul --- .github/workflows/release.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 3b6edd5833..542e45d39e 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -31,9 +31,9 @@ jobs: ref: ${{ github.event.inputs.release-branch }} fetch-depth: 0 - name: Setup Java and Scala - uses: olafurpg/setup-scala@v13 + uses: olafurpg/setup-scala@v14 with: - java-version: openjdk@1.22 + java-version: openjdk@1.17 - name: Setup Node.js uses: actions/setup-node@v3 with: From 6c309027137fb1d9e24c6c00d4e10202ed2763d0 Mon Sep 17 00:00:00 2001 From: Pat Losoponkul Date: Thu, 16 Nov 2023 13:42:37 +0700 Subject: [PATCH 05/10] chore: update comments Signed-off-by: Pat Losoponkul --- build.sbt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/build.sbt b/build.sbt index 8bfda18bf5..da9731b184 100644 --- a/build.sbt +++ b/build.sbt @@ -177,9 +177,10 @@ lazy val D_SharedTest = new { // - https://www.scala-sbt.org/1.x/docs/Library-Management.html#Known+limitations // // This workaround provides those dependencies explicitly, but it will be a nightmare to maintain. + // for version reference: https://github.com/resteasy/resteasy/blob/6.2.4.Final/resteasy-dependencies-bom/pom.xml // FIXME: solve this with a long-term solution lazy val keycloakAdminExplicitDependencies: Seq[ModuleID] = - Seq[ModuleID]( + Seq( "org.keycloak" % "keycloak-admin-client" % V.keycloak excludeAll ( ExclusionRule("org.jboss.resteasy", "resteasy-core"), ExclusionRule("org.jboss.resteasy", "resteasy-multipart-provider"), From 0aba45b7aff1821f3dddeb76a47eb07656aa5dbe Mon Sep 17 00:00:00 2001 From: Pat Losoponkul Date: Thu, 16 Nov 2023 14:00:16 +0700 Subject: [PATCH 06/10] test: log error in tests Signed-off-by: Pat Losoponkul --- .../io/iohk/atala/iam/authentication/oidc/KeycloakClient.scala | 3 ++- .../admin/KeycloakPermissionManagementServiceSpec.scala | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/prism-agent/service/server/src/main/scala/io/iohk/atala/iam/authentication/oidc/KeycloakClient.scala b/prism-agent/service/server/src/main/scala/io/iohk/atala/iam/authentication/oidc/KeycloakClient.scala index d912abf741..85a823b78d 100644 --- a/prism-agent/service/server/src/main/scala/io/iohk/atala/iam/authentication/oidc/KeycloakClient.scala +++ b/prism-agent/service/server/src/main/scala/io/iohk/atala/iam/authentication/oidc/KeycloakClient.scala @@ -110,7 +110,8 @@ class KeycloakClientImpl(client: AuthzClient, httpClient: Client, keycloakConfig ) ) ) - .logError("Fail to get the accessToken on keyclaok.") + .logError("Fail to get the accessToken on keycloak.") + .tapError(_ => ZIO.succeed(keycloakConfig).debug("keycloakConfig")) .mapError(e => KeycloakClientError.UnexpectedError("Fail to get the accessToken on keyclaok.")) .provide(ZLayer.succeed(httpClient)) body <- response.body.asString diff --git a/prism-agent/service/server/src/test/scala/io/iohk/atala/iam/authorization/keycloak/admin/KeycloakPermissionManagementServiceSpec.scala b/prism-agent/service/server/src/test/scala/io/iohk/atala/iam/authorization/keycloak/admin/KeycloakPermissionManagementServiceSpec.scala index 8b71fda85a..3219338acc 100644 --- a/prism-agent/service/server/src/test/scala/io/iohk/atala/iam/authorization/keycloak/admin/KeycloakPermissionManagementServiceSpec.scala +++ b/prism-agent/service/server/src/test/scala/io/iohk/atala/iam/authorization/keycloak/admin/KeycloakPermissionManagementServiceSpec.scala @@ -60,7 +60,7 @@ object KeycloakPermissionManagementServiceSpec contextAwareTransactorLayer, pgContainerLayer, apolloLayer - ).provide(Runtime.removeDefaultLoggers) + ) } private val successfulCasesSuite = suite("Successful Cases")( From ba1bdd28ce0ab70c73482128ade14502741ced8b Mon Sep 17 00:00:00 2001 From: Pat Losoponkul Date: Thu, 16 Nov 2023 15:01:57 +0700 Subject: [PATCH 07/10] ci: java option prefer ipv4 stack Signed-off-by: Pat Losoponkul --- .github/workflows/release.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 542e45d39e..fba9992525 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -23,6 +23,7 @@ jobs: GITHUB_ACTOR: ${{ secrets.ATALA_GITHUB_ACTOR }} GITHUB_TOKEN: ${{ secrets.ATALA_GITHUB_TOKEN }} SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }} + _JAVA_OPTIONS: -Djava.net.preferIPv4Stack=true runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 From 2e0557dfd071941349748e5890d40dc39ae3a1b4 Mon Sep 17 00:00:00 2001 From: Pat Losoponkul Date: Thu, 16 Nov 2023 15:42:15 +0700 Subject: [PATCH 08/10] chore: pr cleanup Signed-off-by: Pat Losoponkul --- .github/workflows/release.yml | 2 ++ .../io/iohk/atala/iam/authentication/oidc/KeycloakClient.scala | 3 +-- .../admin/KeycloakPermissionManagementServiceSpec.scala | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index fba9992525..11e79ff346 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -23,6 +23,8 @@ jobs: GITHUB_ACTOR: ${{ secrets.ATALA_GITHUB_ACTOR }} GITHUB_TOKEN: ${{ secrets.ATALA_GITHUB_TOKEN }} SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }} + # New JDK version makes 'localhost' lookup on linux return ipv6. + # Our test containers are on ipv4. We need to make 'localhost' resolve to ipv4. _JAVA_OPTIONS: -Djava.net.preferIPv4Stack=true runs-on: ubuntu-latest steps: diff --git a/prism-agent/service/server/src/main/scala/io/iohk/atala/iam/authentication/oidc/KeycloakClient.scala b/prism-agent/service/server/src/main/scala/io/iohk/atala/iam/authentication/oidc/KeycloakClient.scala index 85a823b78d..377ad1faf9 100644 --- a/prism-agent/service/server/src/main/scala/io/iohk/atala/iam/authentication/oidc/KeycloakClient.scala +++ b/prism-agent/service/server/src/main/scala/io/iohk/atala/iam/authentication/oidc/KeycloakClient.scala @@ -111,8 +111,7 @@ class KeycloakClientImpl(client: AuthzClient, httpClient: Client, keycloakConfig ) ) .logError("Fail to get the accessToken on keycloak.") - .tapError(_ => ZIO.succeed(keycloakConfig).debug("keycloakConfig")) - .mapError(e => KeycloakClientError.UnexpectedError("Fail to get the accessToken on keyclaok.")) + .mapError(e => KeycloakClientError.UnexpectedError("Fail to get the accessToken on keycloak.")) .provide(ZLayer.succeed(httpClient)) body <- response.body.asString .logError("Fail parse keycloak token response.") diff --git a/prism-agent/service/server/src/test/scala/io/iohk/atala/iam/authorization/keycloak/admin/KeycloakPermissionManagementServiceSpec.scala b/prism-agent/service/server/src/test/scala/io/iohk/atala/iam/authorization/keycloak/admin/KeycloakPermissionManagementServiceSpec.scala index 3219338acc..8b71fda85a 100644 --- a/prism-agent/service/server/src/test/scala/io/iohk/atala/iam/authorization/keycloak/admin/KeycloakPermissionManagementServiceSpec.scala +++ b/prism-agent/service/server/src/test/scala/io/iohk/atala/iam/authorization/keycloak/admin/KeycloakPermissionManagementServiceSpec.scala @@ -60,7 +60,7 @@ object KeycloakPermissionManagementServiceSpec contextAwareTransactorLayer, pgContainerLayer, apolloLayer - ) + ).provide(Runtime.removeDefaultLoggers) } private val successfulCasesSuite = suite("Successful Cases")( From be1c0144e6eaa367d6942f2813457f72d2a768e2 Mon Sep 17 00:00:00 2001 From: Pat Losoponkul Date: Thu, 16 Nov 2023 17:01:02 +0700 Subject: [PATCH 09/10] build: disable scalastweard for keycloak test containers Signed-off-by: Pat Losoponkul --- build.sbt | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/build.sbt b/build.sbt index da9731b184..261e433ded 100644 --- a/build.sbt +++ b/build.sbt @@ -56,14 +56,13 @@ lazy val V = new { // https://mvnrepository.com/artifact/io.circe/circe-core val circe = "0.14.6" - val jackson = "2.14.3" val tapir = "1.6.4" val typesafeConfig = "1.4.2" val protobuf = "3.1.9" val testContainersScala = "0.41.0" - val testContainersJavaKeycloak = "3.0.0" + val testContainersJavaKeycloak = "3.0.0" // scala-steward:off val doobie = "1.0.0-RC2" val quill = "4.7.3" @@ -86,7 +85,7 @@ lazy val V = new { val micrometer = "1.11.2" val nimbusJwt = "10.0.0" - val keycloak = "22.0.4" + val keycloak = "22.0.4" // scala-steward:off } /** Dependencies */ @@ -187,6 +186,7 @@ lazy val D_SharedTest = new { ExclusionRule("org.jboss.resteasy", "resteasy-jackson2-provider"), ExclusionRule("org.jboss.resteasy", "resteasy-jaxb-provider"), ), + // scala-steward:off "org.jboss.resteasy" % "resteasy-core" % "6.2.4.Final" excludeAll ( ExclusionRule("jakarta.servlet", "jakarta.servlet-api"), ), @@ -206,12 +206,13 @@ lazy val D_SharedTest = new { "com.ibm.async" % "asyncutil" % "0.1.0", "org.apache.httpcomponents" % "httpclient" % "4.5.14", "com.github.java-json-tools" % "json-patch" % "1.13", - "com.fasterxml.jackson.core" % "jackson-core" % V.jackson, - "com.fasterxml.jackson.core" % "jackson-databind" % V.jackson, - "com.fasterxml.jackson.core" % "jackson-annotations" % V.jackson, - "com.fasterxml.jackson.jakarta.rs" % "jackson-jakarta-rs-base" % V.jackson, - "com.fasterxml.jackson.jakarta.rs" % "jackson-jakarta-rs-json-provider" % V.jackson, - "com.fasterxml.jackson.module" % "jackson-module-jakarta-xmlbind-annotations" % V.jackson, + "com.fasterxml.jackson.core" % "jackson-core" % "2.14.3", + "com.fasterxml.jackson.core" % "jackson-databind" % "2.14.3", + "com.fasterxml.jackson.core" % "jackson-annotations" % "2.14.3", + "com.fasterxml.jackson.jakarta.rs" % "jackson-jakarta-rs-base" % "2.14.3", + "com.fasterxml.jackson.jakarta.rs" % "jackson-jakarta-rs-json-provider" % "2.14.3", + "com.fasterxml.jackson.module" % "jackson-module-jakarta-xmlbind-annotations" % "2.14.3", + // scala-steward:on ).map(_ % Test) lazy val dependencies: Seq[ModuleID] = From 16b76b6404539dc915948eab9efd7736bcc6e451 Mon Sep 17 00:00:00 2001 From: Pat Losoponkul Date: Thu, 16 Nov 2023 17:11:55 +0700 Subject: [PATCH 10/10] chore: use java_tool_options to set JVM options Signed-off-by: Pat Losoponkul --- .github/workflows/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 11e79ff346..ddcca98eb5 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -25,7 +25,7 @@ jobs: SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }} # New JDK version makes 'localhost' lookup on linux return ipv6. # Our test containers are on ipv4. We need to make 'localhost' resolve to ipv4. - _JAVA_OPTIONS: -Djava.net.preferIPv4Stack=true + JAVA_TOOL_OPTIONS: -Djava.net.preferIPv4Stack=true runs-on: ubuntu-latest steps: - uses: actions/checkout@v3