Skip to content

Commit

Permalink
Build viable Docker images for Polaris using Quarkus
Browse files Browse the repository at this point in the history
  • Loading branch information
adutra committed Jan 21, 2025
1 parent 2a174ad commit e5e6f81
Show file tree
Hide file tree
Showing 11 changed files with 77 additions and 100 deletions.
27 changes: 19 additions & 8 deletions .github/workflows/helm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,12 @@ jobs:
with:
fetch-depth: 0

- name: Set up JDK 21
uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'temurin'

- name: Set up Helm
uses: azure/[email protected]
with:
Expand Down Expand Up @@ -83,25 +89,30 @@ jobs:
if: steps.list-changed.outputs.changed == 'true'
uses: medyagh/[email protected]

- name: Docker build
- name: Print Docker info
if: steps.list-changed.outputs.changed == 'true'
run: |
docker -v
minikube docker-env
- name: Image build
if: steps.list-changed.outputs.changed == 'true'
run: |
eval $(minikube docker-env)
docker build -f ./Dockerfile \
--build-arg ECLIPSELINK=true \
--build-arg ECLIPSELINK_DEPS=com.h2database:h2:2.3.232 \
-t polaris:latest .
eval $(minikube -p minikube docker-env)
./gradlew :polaris-quarkus-server:assemble \
-Dquarkus.container-image.build=true \
-PeclipseLinkDeps=com.h2database:h2:2.3.232
minikube image ls
- name: Install fixtures
if: steps.list-changed.outputs.changed == 'true'
run: |
kubectl create namespace polaris-ns
kubectl apply --namespace polaris-ns $(find helm/polaris/ci/fixtures -name "*.yaml" -exec echo -n "-f {} " \;)
kubectl apply --namespace polaris-ns -f helm/polaris/ci/fixtures
- name: Run chart-testing (install)
if: steps.list-changed.outputs.changed == 'true'
run: |
ct install --target-branch ${{ github.event.repository.default_branch }} \
--namespace polaris-ns \
--helm-extra-set-args "--set=image.repository=polaris --set=image.tag=latest" \
--debug --charts ./helm/polaris
33 changes: 31 additions & 2 deletions .github/workflows/regtest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,39 @@ jobs:

steps:
- uses: actions/checkout@v4
- name: fix permissions

- name: Set up JDK 21
uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'temurin'

- name: Fix permissions
run: mkdir -p regtests/output && chmod 777 regtests/output && chmod 777 regtests/t_*/ref/*

- name: Image build
run: |
export BUILD_TAG=regtests-ci-$(date +%s)
echo BUILD_TAG=${BUILD_TAG} >> ${GITHUB_ENV}
./gradlew :polaris-quarkus-server:assemble \
-Dquarkus.container-image.build=true \
-Dquarkus.container-image.name=polaris-testing \
-Dquarkus.container-image.tag=${BUILD_TAG}
- name: Regression Test
env:
AWS_ACCESS_KEY_ID: ${{secrets.AWS_ACCESS_KEY_ID}}
AWS_SECRET_ACCESS_KEY: ${{secrets.AWS_SECRET_ACCESS_KEY}}
run: docker compose up --build --exit-code-from regtest
run: |
# create compose override file and set image tag
cat <<EOF > ./build/docker-compose.override.yml
services:
polaris:
image: apache/polaris-testing:${BUILD_TAG}
EOF
docker compose \
-f regtests/docker-compose.yml \
-f build/docker-compose.override.yml \
up \
--build \
--exit-code-from regtest
67 changes: 0 additions & 67 deletions Dockerfile

This file was deleted.

4 changes: 0 additions & 4 deletions helm/polaris/ci/persistence-values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,8 @@
#

image:
repository: polaris
tag: latest
pullPolicy: Never

bootstrapMetastoreManager: true

persistenceConfigSecret: polaris-persistence

polarisServerConfig:
Expand Down
2 changes: 0 additions & 2 deletions helm/polaris/ci/simple-values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,4 @@
#

image:
repository: polaris
tag: latest
pullPolicy: Never
6 changes: 2 additions & 4 deletions helm/polaris/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,6 @@ spec:
{{- end }}
image: "{{ tpl .Values.image.repository . }}:{{ tpl .Values.image.tag . | default .Chart.Version }}"
imagePullPolicy: {{ tpl .Values.image.pullPolicy . }}
command: ["/app/bin/polaris-service"]
args: ["server", "/app/config/polaris-server.yml"]
{{- if .Values.extraEnv }}
env:
{{- tpl (toYaml .Values.extraEnv) . | nindent 12 }}
Expand All @@ -107,7 +105,7 @@ spec:
{{- end }}
livenessProbe:
httpGet:
path: /healthcheck
path: /q/health/live
port: "polaris-metrics"
scheme: HTTP
initialDelaySeconds: {{ .Values.livenessProbe.initialDelaySeconds }}
Expand All @@ -118,7 +116,7 @@ spec:
terminationGracePeriodSeconds: {{ .Values.livenessProbe.terminationGracePeriodSeconds }}
readinessProbe:
httpGet:
path: /healthcheck
path: /q/health/ready
port: "polaris-metrics"
scheme: HTTP
initialDelaySeconds: {{ .Values.readinessProbe.initialDelaySeconds }}
Expand Down
2 changes: 1 addition & 1 deletion helm/polaris/templates/tests/test-connection.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,5 @@ spec:
- name: wget
image: busybox
command: ['wget']
args: ['{{ include "polaris.fullname" . }}:{{ index .Values.service.ports "polaris-metrics" }}/healthcheck']
args: ['{{ include "polaris.fullname" . }}:{{ index .Values.service.ports "polaris-metrics" }}/q/health']
restartPolicy: Never
2 changes: 1 addition & 1 deletion helm/polaris/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ replicaCount: 1

image:
# -- The image repository to pull from.
repository: localhost:5001/polaris
repository: apache/polaris
# -- The image pull policy.
pullPolicy: IfNotPresent
# -- The image tag.
Expand Down
4 changes: 4 additions & 0 deletions quarkus/admin/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ dependencies {
implementation(project(":polaris-quarkus-service"))
implementation(project(":polaris-quarkus-defaults"))

if (project.hasProperty("eclipseLinkDeps")) {
runtimeOnly(project(":polaris-eclipselink"))
}

implementation(enforcedPlatform(libs.quarkus.bom))
implementation("io.quarkus:quarkus-picocli")
implementation("io.quarkus:quarkus-container-image-docker")
Expand Down
4 changes: 4 additions & 0 deletions quarkus/server/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ dependencies {
implementation(project(":polaris-service-common"))
implementation(project(":polaris-quarkus-service"))

if (project.hasProperty("eclipseLinkDeps")) {
runtimeOnly(project(":polaris-eclipselink"))
}

// enforce the Quarkus _platform_ here, to get a consistent and validated set of dependencies
implementation(enforcedPlatform(libs.quarkus.bom))
implementation("io.quarkus:quarkus-container-image-docker")
Expand Down
26 changes: 15 additions & 11 deletions docker-compose.yml → regtests/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,9 @@

services:
polaris:
build:
context: .
image: apache/polaris:latest
ports:
- "8181:8181"
- "8181"
- "8182"
environment:
AWS_REGION: us-west-2
Expand All @@ -32,20 +31,25 @@ services:
AZURE_TENANT_ID: $AZURE_TENANT_ID
AZURE_CLIENT_ID: $AZURE_CLIENT_ID
AZURE_CLIENT_SECRET: $AZURE_CLIENT_SECRET
POLARIS_AUTHENTICATION_AUTHENTICATOR_TYPE: test
POLARIS_AUTHENTICATION_TOKEN_SERVICE_TYPE: test
QUARKUS_OTEL_SDK_DISABLED: "true"
polaris.persistence.type: in-memory
polaris.authentication.authenticator.type: test
polaris.authentication.token-service.type: test
polaris.authentication.token-broker.type: symmetric-key
polaris.authentication.token-broker.symmetric-key.secret: polaris
polaris.features.defaults."SUPPORTED_CATALOG_STORAGE_TYPES": '["FILE","S3","GCS","AZURE"]'
polaris.realm-context.realms: default-realm,realm1
quarkus.log.file.enable: false
quarkus.otel.sdk.disabled: "true"
volumes:
- ./regtests/credentials:/tmp/credentials/

- ./credentials:/tmp/credentials/
healthcheck:
test: ["CMD", "curl", "http://localhost:8182/q/health"]
interval: 10s
timeout: 10s
retries: 5
regtest:
build:
context: regtests
context: .
args:
POLARIS_HOST: polaris
depends_on:
Expand All @@ -69,5 +73,5 @@ services:
AWS_CROSS_REGION_BUCKET: $AWS_CROSS_REGION_BUCKET
AWS_ROLE_FOR_CROSS_REGION_BUCKET: $AWS_ROLE_FOR_CROSS_REGION_BUCKET
volumes:
- ./regtests/output:/tmp/polaris-regtests/
- ./regtests/credentials:/tmp/credentials/
- ./output:/tmp/polaris-regtests/
- ./credentials:/tmp/credentials/

0 comments on commit e5e6f81

Please sign in to comment.