From a4fcdaf67368e2b3786e0872fec465478596180b Mon Sep 17 00:00:00 2001 From: Kathiresan Selvaraj Date: Fri, 27 Oct 2023 08:08:41 -0400 Subject: [PATCH 1/4] Fix native image building with datastax driver dependency --- .github/workflows/continuous-integration.yaml | 2 +- .github/workflows/docker-image-publish.yaml | 2 +- .github/workflows/performance-testing.yaml | 2 +- .github/workflows/release.yaml | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/continuous-integration.yaml b/.github/workflows/continuous-integration.yaml index eddfc2562f..c4b32b5dec 100644 --- a/.github/workflows/continuous-integration.yaml +++ b/.github/workflows/continuous-integration.yaml @@ -110,4 +110,4 @@ jobs: env: COORD_IMAGE: ${{ secrets.ECR_REPOSITORY }}/stargateio/coordinator-dse-next run: | - ./mvnw -B -ntp clean verify -DskipUnitTests -Dquarkus.container-image.build=true -Dquarkus.container-image.tag=${{ github.sha }} -Dstargate.int-test.coordinator.image=$COORD_IMAGE ${{ matrix.profile }} + ./mvnw -B -ntp clean verify -DskipUnitTests -Dquarkus.container-image.build=true -Dquarkus.container-image.tag=${{ github.sha }} -Dstargate.int-test.coordinator.image=$COORD_IMAGE -Dquarkus.native.additional-build-args='--initialize-at-run-time=com.datastax.oss.driver.internal.core.metadata.MetadataManager' ${{ matrix.profile }} diff --git a/.github/workflows/docker-image-publish.yaml b/.github/workflows/docker-image-publish.yaml index 901709b202..641db09c74 100644 --- a/.github/workflows/docker-image-publish.yaml +++ b/.github/workflows/docker-image-publish.yaml @@ -66,7 +66,7 @@ jobs: - name: Build and push (Amazon ECR) run: | - ./mvnw -B -ntp clean package -DskipTests -Dquarkus.container-image.build=true -Dquarkus.docker.buildx.platform=linux/amd64,linux/arm64 -Dquarkus.container-image.push=true -Dquarkus.container-image.registry=${{ secrets.ECR_REPOSITORY }} -Dquarkus.container-image.tag=${{ github.sha }} -Dquarkus.container-image.additional-tags='' ${{ matrix.profile }} + ./mvnw -B -ntp clean package -DskipTests -Dquarkus.container-image.build=true -Dquarkus.docker.buildx.platform=linux/amd64,linux/arm64 -Dquarkus.container-image.push=true -Dquarkus.container-image.registry=${{ secrets.ECR_REPOSITORY }} -Dquarkus.container-image.tag=${{ github.sha }} -Dquarkus.container-image.additional-tags='' -Dquarkus.native.additional-build-args='--initialize-at-run-time=com.datastax.oss.driver.internal.core.metadata.MetadataManager' ${{ matrix.profile }} # signs docker image with cosign sign: diff --git a/.github/workflows/performance-testing.yaml b/.github/workflows/performance-testing.yaml index 7669b81efb..be18d350f1 100644 --- a/.github/workflows/performance-testing.yaml +++ b/.github/workflows/performance-testing.yaml @@ -49,7 +49,7 @@ jobs: docker-image: 'jsonapi' - type: native - build-ops: '-Pnative -Dquarkus.native.container-build=true -Dquarkus.container-image.build=true' + build-ops: '-Pnative -Dquarkus.native.container-build=true -Dquarkus.container-image.build=true -Dquarkus.native.additional-build-args="--initialize-at-run-time=com.datastax.oss.driver.internal.core.metadata.MetadataManager"' docker-flags: '-n' docker-image: 'jsonapi-native' diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 2ec03e6ba2..13491dc21c 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -114,7 +114,7 @@ jobs: - name: Build and push (Docker Hub) if: ${{ !inputs.skipPublish }} run: | - ./mvnw -B -ntp clean package -DskipTests -Dquarkus.container-image.build=true -Dquarkus.docker.buildx.platform=linux/amd64,linux/arm64 -Dquarkus.container-image.push=true -Dquarkus.container-image.tag=${{needs.resolve-tag.outputs.release-tag}} ${{ matrix.profile }} + ./mvnw -B -ntp clean package -DskipTests -Dquarkus.container-image.build=true -Dquarkus.docker.buildx.platform=linux/amd64,linux/arm64 -Dquarkus.container-image.push=true -Dquarkus.container-image.tag=${{needs.resolve-tag.outputs.release-tag}} -Dquarkus.native.additional-build-args='--initialize-at-run-time=com.datastax.oss.driver.internal.core.metadata.MetadataManager' ${{ matrix.profile }} # # build and push Astra image to Amazon ECR From abe49a0e5b59b124b12bb5020dc9a555ec480402 Mon Sep 17 00:00:00 2001 From: Kathiresan Selvaraj Date: Fri, 27 Oct 2023 08:14:11 -0400 Subject: [PATCH 2/4] Fixed one more image building step --- .github/workflows/release.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 13491dc21c..071aa94121 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -154,7 +154,7 @@ jobs: QUARKUS_SMALLRYE_OPENAPI_INFO_LICENSE_NAME: '' QUARKUS_SMALLRYE_OPENAPI_INFO_LICENSE_URL: '' run: | - ./mvnw -B -ntp clean package -DskipTests -Dquarkus.container-image.build=true -Dquarkus.docker.buildx.platform=linux/amd64,linux/arm64 -Dquarkus.container-image.push=true -Dquarkus.container-image.registry=${{ secrets.ECR_REPOSITORY }} -Dquarkus.container-image.tag=${{needs.resolve-tag.outputs.release-tag}} ${{ matrix.profile }} + ./mvnw -B -ntp clean package -DskipTests -Dquarkus.container-image.build=true -Dquarkus.docker.buildx.platform=linux/amd64,linux/arm64 -Dquarkus.container-image.push=true -Dquarkus.container-image.registry=${{ secrets.ECR_REPOSITORY }} -Dquarkus.container-image.tag=${{needs.resolve-tag.outputs.release-tag}} -Dquarkus.native.additional-build-args='--initialize-at-run-time=com.datastax.oss.driver.internal.core.metadata.MetadataManager' ${{ matrix.profile }} # signs all docker images with cosign # skip whole job if we did not push images From de2a04949f78100c467ef1ea0f8d7bfb62ec8043 Mon Sep 17 00:00:00 2001 From: Kathiresan Selvaraj Date: Sun, 29 Oct 2023 21:17:41 -0400 Subject: [PATCH 3/4] Moved quarkus prop to application.yaml --- .github/workflows/continuous-integration.yaml | 2 +- .github/workflows/docker-image-publish.yaml | 2 +- .github/workflows/performance-testing.yaml | 2 +- .github/workflows/release.yaml | 4 ++-- src/main/resources/application.yaml | 2 ++ 5 files changed, 7 insertions(+), 5 deletions(-) diff --git a/.github/workflows/continuous-integration.yaml b/.github/workflows/continuous-integration.yaml index c4b32b5dec..eddfc2562f 100644 --- a/.github/workflows/continuous-integration.yaml +++ b/.github/workflows/continuous-integration.yaml @@ -110,4 +110,4 @@ jobs: env: COORD_IMAGE: ${{ secrets.ECR_REPOSITORY }}/stargateio/coordinator-dse-next run: | - ./mvnw -B -ntp clean verify -DskipUnitTests -Dquarkus.container-image.build=true -Dquarkus.container-image.tag=${{ github.sha }} -Dstargate.int-test.coordinator.image=$COORD_IMAGE -Dquarkus.native.additional-build-args='--initialize-at-run-time=com.datastax.oss.driver.internal.core.metadata.MetadataManager' ${{ matrix.profile }} + ./mvnw -B -ntp clean verify -DskipUnitTests -Dquarkus.container-image.build=true -Dquarkus.container-image.tag=${{ github.sha }} -Dstargate.int-test.coordinator.image=$COORD_IMAGE ${{ matrix.profile }} diff --git a/.github/workflows/docker-image-publish.yaml b/.github/workflows/docker-image-publish.yaml index 641db09c74..901709b202 100644 --- a/.github/workflows/docker-image-publish.yaml +++ b/.github/workflows/docker-image-publish.yaml @@ -66,7 +66,7 @@ jobs: - name: Build and push (Amazon ECR) run: | - ./mvnw -B -ntp clean package -DskipTests -Dquarkus.container-image.build=true -Dquarkus.docker.buildx.platform=linux/amd64,linux/arm64 -Dquarkus.container-image.push=true -Dquarkus.container-image.registry=${{ secrets.ECR_REPOSITORY }} -Dquarkus.container-image.tag=${{ github.sha }} -Dquarkus.container-image.additional-tags='' -Dquarkus.native.additional-build-args='--initialize-at-run-time=com.datastax.oss.driver.internal.core.metadata.MetadataManager' ${{ matrix.profile }} + ./mvnw -B -ntp clean package -DskipTests -Dquarkus.container-image.build=true -Dquarkus.docker.buildx.platform=linux/amd64,linux/arm64 -Dquarkus.container-image.push=true -Dquarkus.container-image.registry=${{ secrets.ECR_REPOSITORY }} -Dquarkus.container-image.tag=${{ github.sha }} -Dquarkus.container-image.additional-tags='' ${{ matrix.profile }} # signs docker image with cosign sign: diff --git a/.github/workflows/performance-testing.yaml b/.github/workflows/performance-testing.yaml index be18d350f1..7669b81efb 100644 --- a/.github/workflows/performance-testing.yaml +++ b/.github/workflows/performance-testing.yaml @@ -49,7 +49,7 @@ jobs: docker-image: 'jsonapi' - type: native - build-ops: '-Pnative -Dquarkus.native.container-build=true -Dquarkus.container-image.build=true -Dquarkus.native.additional-build-args="--initialize-at-run-time=com.datastax.oss.driver.internal.core.metadata.MetadataManager"' + build-ops: '-Pnative -Dquarkus.native.container-build=true -Dquarkus.container-image.build=true' docker-flags: '-n' docker-image: 'jsonapi-native' diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 071aa94121..2ec03e6ba2 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -114,7 +114,7 @@ jobs: - name: Build and push (Docker Hub) if: ${{ !inputs.skipPublish }} run: | - ./mvnw -B -ntp clean package -DskipTests -Dquarkus.container-image.build=true -Dquarkus.docker.buildx.platform=linux/amd64,linux/arm64 -Dquarkus.container-image.push=true -Dquarkus.container-image.tag=${{needs.resolve-tag.outputs.release-tag}} -Dquarkus.native.additional-build-args='--initialize-at-run-time=com.datastax.oss.driver.internal.core.metadata.MetadataManager' ${{ matrix.profile }} + ./mvnw -B -ntp clean package -DskipTests -Dquarkus.container-image.build=true -Dquarkus.docker.buildx.platform=linux/amd64,linux/arm64 -Dquarkus.container-image.push=true -Dquarkus.container-image.tag=${{needs.resolve-tag.outputs.release-tag}} ${{ matrix.profile }} # # build and push Astra image to Amazon ECR @@ -154,7 +154,7 @@ jobs: QUARKUS_SMALLRYE_OPENAPI_INFO_LICENSE_NAME: '' QUARKUS_SMALLRYE_OPENAPI_INFO_LICENSE_URL: '' run: | - ./mvnw -B -ntp clean package -DskipTests -Dquarkus.container-image.build=true -Dquarkus.docker.buildx.platform=linux/amd64,linux/arm64 -Dquarkus.container-image.push=true -Dquarkus.container-image.registry=${{ secrets.ECR_REPOSITORY }} -Dquarkus.container-image.tag=${{needs.resolve-tag.outputs.release-tag}} -Dquarkus.native.additional-build-args='--initialize-at-run-time=com.datastax.oss.driver.internal.core.metadata.MetadataManager' ${{ matrix.profile }} + ./mvnw -B -ntp clean package -DskipTests -Dquarkus.container-image.build=true -Dquarkus.docker.buildx.platform=linux/amd64,linux/arm64 -Dquarkus.container-image.push=true -Dquarkus.container-image.registry=${{ secrets.ECR_REPOSITORY }} -Dquarkus.container-image.tag=${{needs.resolve-tag.outputs.release-tag}} ${{ matrix.profile }} # signs all docker images with cosign # skip whole job if we did not push images diff --git a/src/main/resources/application.yaml b/src/main/resources/application.yaml index 952cd7d1ea..0279aa16b0 100644 --- a/src/main/resources/application.yaml +++ b/src/main/resources/application.yaml @@ -102,3 +102,5 @@ quarkus: # adapt path of the open api definitions smallrye-openapi: path: /api/json/openapi + native: + additional-build-args: --initialize-at-run-time=com.datastax.oss.driver.internal.core.metadata.MetadataManager \ No newline at end of file From 5b703c97698b63fc7c5b13224e18470a23c2190d Mon Sep 17 00:00:00 2001 From: Kathiresan Selvaraj Date: Sun, 29 Oct 2023 21:22:24 -0400 Subject: [PATCH 4/4] Added comment to explain on the config change. --- src/main/resources/application.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/main/resources/application.yaml b/src/main/resources/application.yaml index 0279aa16b0..9ab02c6220 100644 --- a/src/main/resources/application.yaml +++ b/src/main/resources/application.yaml @@ -103,4 +103,6 @@ quarkus: smallrye-openapi: path: /api/json/openapi native: + # Adding com.datastax.oss.driver.internal.core.metadata.MetadataManager to the list of classes that are initialized + # at run time while building the native image. This is for the issue https://github.com/stargate/jsonapi/issues/597 additional-build-args: --initialize-at-run-time=com.datastax.oss.driver.internal.core.metadata.MetadataManager \ No newline at end of file