-
Notifications
You must be signed in to change notification settings - Fork 0
AB-449 PostgreSQL Operator: Release workflow + PostgreSQL 15 to 18 Test Matrix #5
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
Changes from 9 commits
0d61233
4984200
27b0b57
14f473b
af2420f
e80d4ee
8510471
62b8137
1d16cfc
cc66654
dc5e0fa
de4bab9
becb9c1
e602f5a
f3c00a6
446b269
10283d2
3c80bff
3ec0efa
011ba49
c2a28cf
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In the frontend packages we called this file like this. In the backend packages we used the name
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I changed it already for all backend repositories.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I like it. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,85 @@ | ||
| name: Release | ||
|
|
||
| on: | ||
| workflow_dispatch: | ||
| inputs: | ||
| increment: | ||
| description: "Version increment type" | ||
| type: choice | ||
| required: true | ||
| default: "Patch" | ||
| options: | ||
| - "Major" | ||
| - "Minor" | ||
| - "Patch" | ||
| - "Prerelease" | ||
|
|
||
| env: | ||
| DOCKER_IMAGE: ghcr.io/${{ github.repository }} | ||
|
|
||
| jobs: | ||
| build-and-publish: | ||
| runs-on: ubuntu-24.04 | ||
| timeout-minutes: 15 | ||
| steps: | ||
| - uses: actions/checkout@v6 | ||
| with: | ||
| token: ${{ secrets.GH_PERSONAL_ACCESS_TOKEN }} | ||
| - uses: aboutbits/github-actions-base/git-setup@v2 | ||
| - uses: aboutbits/github-actions-java/setup-with-gradle@v4 | ||
| with: | ||
| java-version: 25 | ||
| cache-encryption-key: ${{ secrets.GRADLE_ENCRYPTION_KEY }} | ||
| - name: Increment version | ||
| run: ./gradlew --console=colored createRelease -Prelease.versionIncrementer=increment${{ github.event.inputs.increment }} | ||
| shell: bash | ||
| - name: Get next package version | ||
| id: nextVersion | ||
| run: echo "version=$(./gradlew currentVersion -q -Prelease.quiet)" >> $GITHUB_OUTPUT | ||
| shell: bash | ||
| - name: Build package | ||
| run: ./gradlew --console=colored build | ||
| - name: Build Docker image | ||
| uses: aboutbits/github-actions-docker/build-push@v1 | ||
| with: | ||
| username: ${{ github.actor }} | ||
| password: ${{ secrets.GITHUB_TOKEN }} | ||
| docker-image: ${{ env.DOCKER_IMAGE }} | ||
| docker-tag: ${{ steps.nextVersion.outputs.version }} | ||
| working-directory: './operator' | ||
| dockerfile: './operator/src/main/docker/Dockerfile.jvm' | ||
| - name: Push tag to remote | ||
| run: ./gradlew --console=colored pushRelease | ||
| shell: bash | ||
| - uses: aboutbits/github-actions-base/github-create-release@v2 | ||
| with: | ||
| tag-name: 'v${{ steps.nextVersion.outputs.version }}' | ||
| release-description: | | ||
| ## Installation | ||
|
|
||
| **Docker Image:** | ||
| ```bash | ||
| docker pull ${{ env.DOCKER_IMAGE }}:${{ steps.nextVersion.outputs.version }} | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. When does a user need this?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Only if you want to inspect the container image with tools like https://github.com/wagoodman/dive or https://github.com/reproducible-containers/diffoci For the other cases, you most likely always use the Helm chart.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would remove this, since this is just for debugging reasons. Or at least this is the least important information here. So first the must be the Helm installation instruction. |
||
| ``` | ||
|
|
||
| **Helm Chart:** | ||
|
ThoSap marked this conversation as resolved.
Outdated
|
||
| ```bash | ||
| helm install postgresql-operator https://github.com/${{ github.repository }}/releases/download/v${{ steps.nextVersion.outputs.version }}/postgresql-operator-${{ steps.nextVersion.outputs.version }}.tgz | ||
| ``` | ||
|
|
||
| **Manually installing CRDs:** | ||
|
ThoSap marked this conversation as resolved.
Outdated
|
||
| ```bash | ||
| kubectl apply -f https://github.com/${{ github.repository }}/releases/download/v${{ steps.nextVersion.outputs.version }}/clusterconnections.postgresql.aboutbits.it-v1.yml | ||
| kubectl apply -f https://github.com/${{ github.repository }}/releases/download/v${{ steps.nextVersion.outputs.version }}/databases.postgresql.aboutbits.it-v1.yml | ||
| kubectl apply -f https://github.com/${{ github.repository }}/releases/download/v${{ steps.nextVersion.outputs.version }}/schemas.postgresql.aboutbits.it-v1.yml | ||
| kubectl apply -f https://github.com/${{ github.repository }}/releases/download/v${{ steps.nextVersion.outputs.version }}/roles.postgresql.aboutbits.it-v1.yml | ||
| kubectl apply -f https://github.com/${{ github.repository }}/releases/download/v${{ steps.nextVersion.outputs.version }}/grants.postgresql.aboutbits.it-v1.yml | ||
| kubectl apply -f https://github.com/${{ github.repository }}/releases/download/v${{ steps.nextVersion.outputs.version }}/defaultprivileges.postgresql.aboutbits.it-v1.yml | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. When do we need these manual installations? Is this really something that is required? Or will everything be handeled by the Helm chart?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It is required if someone is not using the Helm chart, or we add a flag to the Helm chart to not install the CRDs using a simple boolean switch. |
||
| ``` | ||
| release-notes-generation: 'true' | ||
| - name: Upload Helm chart and CRD assets | ||
| env: | ||
| GH_TOKEN: ${{ secrets.GH_PERSONAL_ACCESS_TOKEN }} | ||
| run: | | ||
| gh release upload v${{ steps.nextVersion.outputs.version }} operator/build/helm/kubernetes/*.tgz operator/build/kubernetes/*.postgresql.aboutbits.it-v1.yml | ||
| shell: bash | ||
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,13 +1,15 @@ | ||
| # Gradle properties | ||
| org.gradle.caching=true | ||
| org.gradle.parallel=true | ||
| org.gradle.configuration-cache=true | ||
| # TODO: Set to true when https://github.com/quarkusio/quarkus/issues/49115 is fixed | ||
| org.gradle.parallel=false | ||
| org.gradle.logging.level=INFO | ||
|
|
||
| # Quarkus | ||
| quarkusPluginId=io.quarkus | ||
| quarkusPluginVersion=3.30.7 | ||
| quarkusPluginVersion=3.30.8 | ||
| # https://mvnrepository.com/artifact/io.quarkus.platform/quarkus-bom | ||
| quarkusPlatformGroupId=io.quarkus.platform | ||
| quarkusPlatformArtifactId=quarkus-bom | ||
| quarkusPlatformVersion=3.30.7 | ||
| quarkusPlatformVersion=3.30.8 | ||
| systemProp.quarkus.analytics.disabled=true |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| services: | ||
| db: | ||
| image: postgres:15 | ||
| command: "postgres -c checkpoint_timeout=10min -c fsync=off -c full_page_writes=off -c max_wal_size=2GB -c synchronous_commit=off" | ||
| tmpfs: | ||
| - /var/lib/postgresql/data:rw,async,noatime | ||
| healthcheck: | ||
| test: pg_isready -U root -d dummy | ||
| interval: 3s | ||
| timeout: 3s | ||
| retries: 3 | ||
| ports: | ||
| - "5432" | ||
| labels: | ||
| io.quarkus.devservices.compose.config_map.port.5432: quarkus.datasource.jdbc.port | ||
| environment: | ||
| - POSTGRES_USER=root | ||
| - POSTGRES_PASSWORD=password | ||
| - POSTGRES_DB=dummy |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| services: | ||
| db: | ||
| image: postgres:16 | ||
| command: "postgres -c checkpoint_timeout=10min -c fsync=off -c full_page_writes=off -c max_wal_size=2GB -c synchronous_commit=off" | ||
| tmpfs: | ||
| - /var/lib/postgresql/data:rw,async,noatime | ||
| healthcheck: | ||
| test: pg_isready -U root -d dummy | ||
| interval: 3s | ||
| timeout: 3s | ||
| retries: 3 | ||
| ports: | ||
| - "5432" | ||
| labels: | ||
| io.quarkus.devservices.compose.config_map.port.5432: quarkus.datasource.jdbc.port | ||
| environment: | ||
| - POSTGRES_USER=root | ||
| - POSTGRES_PASSWORD=password | ||
| - POSTGRES_DB=dummy |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| services: | ||
| db: | ||
| image: postgres:17 | ||
| command: "postgres -c checkpoint_timeout=10min -c fsync=off -c full_page_writes=off -c max_wal_size=2GB -c synchronous_commit=off" | ||
| tmpfs: | ||
| - /var/lib/postgresql/data:rw,async,noatime | ||
| healthcheck: | ||
| test: pg_isready -U root -d dummy | ||
| interval: 3s | ||
| timeout: 3s | ||
| retries: 3 | ||
| ports: | ||
| - "5432" | ||
| labels: | ||
| io.quarkus.devservices.compose.config_map.port.5432: quarkus.datasource.jdbc.port | ||
| environment: | ||
| - POSTGRES_USER=root | ||
| - POSTGRES_PASSWORD=password | ||
| - POSTGRES_DB=dummy |
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,19 @@ | ||||||
| services: | ||||||
| db: | ||||||
| image: postgres:18 | ||||||
| command: "postgres -c checkpoint_timeout=10min -c fsync=off -c full_page_writes=off -c max_wal_size=2GB -c synchronous_commit=off" | ||||||
| tmpfs: | ||||||
| - /var/lib/postgresql/18/docker:rw,async,noatime | ||||||
|
||||||
| - /var/lib/postgresql/18/docker:rw,async,noatime | |
| - /var/lib/postgresql/data:rw,async,noatime |
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.
No, this is correct, see docker-library/postgres#1259
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -15,7 +15,6 @@ | |
| import static it.aboutbits.postgresql.core.Privilege.CREATE; | ||
| import static it.aboutbits.postgresql.core.Privilege.DELETE; | ||
| import static it.aboutbits.postgresql.core.Privilege.INSERT; | ||
| import static it.aboutbits.postgresql.core.Privilege.MAINTAIN; | ||
| import static it.aboutbits.postgresql.core.Privilege.REFERENCES; | ||
| import static it.aboutbits.postgresql.core.Privilege.SELECT; | ||
| import static it.aboutbits.postgresql.core.Privilege.TEMPORARY; | ||
|
|
@@ -55,8 +54,8 @@ public enum GrantObjectType { | |
| DELETE, | ||
| TRUNCATE, | ||
| REFERENCES, | ||
| TRIGGER, | ||
| MAINTAIN | ||
| TRIGGER | ||
| //MAINTAIN // PostgreSQL 17+ | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. General question: Would this break the integration with 15 and 16 if it is not used?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No, it would not break the integration if it is not used or tested against. It currently fails as I added a grant all What I could do is retrieve the PostgreSQL major version from the jOOQ // Returns the major version number (e.g., 17)
int majorVersion = dsl.connectionResult(connection ->
connection.getMetaData().getDatabaseMajorVersion()
);
// OR
// Returns an integer, e.g., 170000
Integer versionNum = dsl.fetchValue("show server_version_num", Integer.class);
// OR
// Returns short string, e.g., "17.0"
String version = dsl.fetchValue("show server_version", String.class); 2026-01-26 08:40:30,201 DEBUG [org.jooq.tools.LoggerListener] (ReconcilerExecutor-defaultprivilegereconciler-196) Executing query : alter default privileges for role "test-role-75yz5h1v0srm9acoof5a0czky5xru8lpkan2y2zxc894g74ixwcxk" in schema "test-schema-b9igbunxgzg18l95upbnwtasfq01m5tbanecrinm55rv2b27bpv" grant delete, insert, references, truncate, update, maintain, trigger on tables to "test-role-2y69entlxnrljru70a9at1lhq363ro4msi9c7b05omvjxl6lg39az"
2026-01-26 08:40:30,206 DEBUG [org.jooq.tools.LoggerListener] (ReconcilerExecutor-defaultprivilegereconciler-196) Exception : org.jooq.exception.DataAccessException: SQL [alter default privileges for role "test-role-75yz5h1v0srm9acoof5a0czky5xru8lpkan2y2zxc894g74ixwcxk" in schema "test-schema-b9igbunxgzg18l95upbnwtasfq01m5tbanecrinm55rv2b27bpv" grant delete, insert, references, truncate, update, maintain, trigger on tables to "test-role-2y69entlxnrljru70a9at1lhq363ro4msi9c7b05omvjxl6lg39az"]; ERROR: unrecognized privilege type "maintain"
at org.jooq_3.20.10.POSTGRES.debug(Unknown Source)
at org.jooq.impl.Tools.translate(Tools.java:3709)
at org.jooq.impl.Tools.translate(Tools.java:3685)
at org.jooq.impl.DefaultExecuteContext.sqlException(DefaultExecuteContext.java:869)
at org.jooq.impl.AbstractQuery.execute(AbstractQuery.java:363)
at org.jooq.impl.Tools.attach(Tools.java:1735)
at org.jooq.impl.DefaultDSLContext.execute(DefaultDSLContext.java:5338)
at it.aboutbits.postgresql.crd.defaultprivilege.DefaultPrivilegeService.grant(DefaultPrivilegeService.java:110)
at it.aboutbits.postgresql.crd.defaultprivilege.DefaultPrivilegeReconciler.reconcileInTransaction(DefaultPrivilegeReconciler.java:232)
at it.aboutbits.postgresql.crd.defaultprivilege.DefaultPrivilegeReconciler.lambda$reconcile$0(DefaultPrivilegeReconciler.java:99)
at org.jooq.impl.DefaultDSLContext.lambda$transactionResult0$3(DefaultDSLContext.java:533)
at org.jooq.impl.Tools$3$1.block(Tools.java:6402)
at java.base/java.util.concurrent.ForkJoinPool.unmanagedBlock(ForkJoinPool.java:4364)
at java.base/java.util.concurrent.ForkJoinPool.managedBlock(ForkJoinPool.java:4310)
at org.jooq.impl.Tools$3.get(Tools.java:6399)
at org.jooq.impl.DefaultDSLContext.transactionResult0(DefaultDSLContext.java:581)
at org.jooq.impl.DefaultDSLContext.transactionResult(DefaultDSLContext.java:504)
at it.aboutbits.postgresql.crd.defaultprivilege.DefaultPrivilegeReconciler.reconcile(DefaultPrivilegeReconciler.java:98)
at it.aboutbits.postgresql.crd.defaultprivilege.DefaultPrivilegeReconciler.reconcile(DefaultPrivilegeReconciler.java:22)
at it.aboutbits.postgresql.crd.defaultprivilege.DefaultPrivilegeReconciler_ClientProxy.reconcile(Unknown Source)
at io.javaoperatorsdk.operator.processing.Controller$1.execute(Controller.java:161)
at io.javaoperatorsdk.operator.processing.Controller$1.execute(Controller.java:117)
at io.javaoperatorsdk.operator.monitoring.micrometer.MicrometerMetrics.lambda$timeControllerExecution$0(MicrometerMetrics.java:151)
at io.micrometer.core.instrument.composite.CompositeTimer.record(CompositeTimer.java:69)
at io.javaoperatorsdk.operator.monitoring.micrometer.MicrometerMetrics.timeControllerExecution(MicrometerMetrics.java:148)
at io.javaoperatorsdk.operator.processing.Controller.reconcile(Controller.java:116)
at io.javaoperatorsdk.operator.processing.event.ReconciliationDispatcher.reconcileExecution(ReconciliationDispatcher.java:154)
at io.javaoperatorsdk.operator.processing.event.ReconciliationDispatcher.handleReconcile(ReconciliationDispatcher.java:131)
at io.javaoperatorsdk.operator.processing.event.ReconciliationDispatcher.handleDispatch(ReconciliationDispatcher.java:98)
at io.javaoperatorsdk.operator.processing.event.ReconciliationDispatcher.handleExecution(ReconciliationDispatcher.java:69)
at io.javaoperatorsdk.operator.processing.event.EventProcessor$ReconcilerExecutor.run(EventProcessor.java:483)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1090)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:614)
at java.base/java.lang.Thread.run(Thread.java:1474)
Caused by: org.postgresql.util.PSQLException: ERROR: unrecognized privilege type "maintain"
at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2736)
at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:2421)
at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:372)
at org.postgresql.jdbc.PgStatement.executeInternal(PgStatement.java:525)
at org.postgresql.jdbc.PgStatement.execute(PgStatement.java:435)
at org.postgresql.jdbc.PgStatement.executeWithFlags(PgStatement.java:357)
at org.postgresql.jdbc.PgStatement.executeCachedSql(PgStatement.java:342)
at org.postgresql.jdbc.PgStatement.executeWithFlags(PgStatement.java:318)
at org.postgresql.jdbc.PgStatement.execute(PgStatement.java:313)
at org.jooq.tools.jdbc.DefaultStatement.execute(DefaultStatement.java:102)
at org.jooq.impl.SettingsEnabledPreparedStatement.execute(SettingsEnabledPreparedStatement.java:227)
at org.jooq.impl.AbstractQuery.execute(AbstractQuery.java:459)
at org.jooq.impl.AbstractQuery.execute(AbstractQuery.java:349)
... 29 more
2026-01-26 08:40:30,206 DEBUG [org.jooq.impl.DefaultConnectionProvider] (ReconcilerExecutor-defaultprivilegereconciler-196) rollback
2026-01-26 08:40:30,207 DEBUG [org.jooq.impl.DefaultConnectionProvider] (ReconcilerExecutor-defaultprivilegereconciler-196) setting auto commit : true
2026-01-26 08:40:30,208 ERROR [it.aboutbits.postgresql.core.BaseReconciler] (ReconcilerExecutor-defaultprivilegereconciler-196) Failed to reconcile resource [resource=test-default-privilege-rc5qtair1jkf9ur5tkulnz5k60tb2cke5io6deom]: org.jooq.exception.DataAccessException: SQL [alter default privileges for role "test-role-75yz5h1v0srm9acoof5a0czky5xru8lpkan2y2zxc894g74ixwcxk" in schema "test-schema-b9igbunxgzg18l95upbnwtasfq01m5tbanecrinm55rv2b27bpv" grant delete, insert, references, truncate, update, maintain, trigger on tables to "test-role-2y69entlxnrljru70a9at1lhq363ro4msi9c7b05omvjxl6lg39az"]; ERROR: unrecognized privilege type "maintain"
at org.jooq_3.20.10.POSTGRES.debug(Unknown Source)
...
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I now check for unsupported privileges and conditionally test these. |
||
| ) | ||
| ), | ||
| SEQUENCE( | ||
|
|
||
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 sick! 💯