Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
0d61233
configure profiles with related compose dev services to test against …
ThoSap Jan 22, 2026
4984200
specify optimized tmpfs mount options
ThoSap Jan 22, 2026
27b0b57
adjust the GitHub test workflow to use a test matrix for PostgreSQL v…
ThoSap Jan 22, 2026
14f473b
implement a release workflow
ThoSap Jan 23, 2026
af2420f
remove the container image app suffix
ThoSap Jan 23, 2026
e80d4ee
fix typo
ThoSap Jan 23, 2026
8510471
fix the image name in the Helm chart values.yml
ThoSap Jan 23, 2026
62b8137
enable Gradle configuration cache as Quarkus is compatible with it
ThoSap Jan 23, 2026
1d16cfc
update to Quarkus 3.30.8
ThoSap Jan 23, 2026
cc66654
restructure release description
ThoSap Jan 26, 2026
dc5e0fa
error out if an unsupported privilege is used and conditionally refle…
ThoSap Jan 26, 2026
de4bab9
move the unsupported privilege test to the CRDValidation tests and do…
ThoSap Jan 26, 2026
becb9c1
add the maintain privilege again to the Javadoc
ThoSap Jan 26, 2026
e602f5a
use aboutbits/java-checkstyle-config version 2.0.0-RC1
ThoSap Jan 26, 2026
f3c00a6
update to AssertJ 3.27.7
ThoSap Jan 26, 2026
446b269
run the test matrix also when running the release workflow and on mai…
ThoSap Jan 26, 2026
10283d2
fix the workflow in PRs
ThoSap Jan 26, 2026
3c80bff
remove the concurrency block from the reused test workflow
ThoSap Jan 26, 2026
3ec0efa
specify the About Bits GmbH MIT license
ThoSap Jan 26, 2026
011ba49
use the exec-form in the compose files to properly handle SIGTERM
ThoSap Jan 26, 2026
c2a28cf
reference the correct ObjectType TABLE constant
ThoSap Jan 26, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
85 changes: 85 additions & 0 deletions .github/workflows/release.yml
Copy link
Member

Choose a reason for hiding this comment

The 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 publish.yml. I think the name release.yml is more appropriate. I will make a note for myself to change it at all other backend packages.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I changed it already for all backend repositories.

Copy link
Contributor Author

Choose a reason for hiding this comment

The 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:
test:
uses: ./.github/workflows/test.yml
secrets: inherit

build-and-release:
needs: test
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 -x test
- 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

### Helm Chart
```bash
helm install postgresql-operator https://github.com/${{ github.repository }}/releases/download/v${{ steps.nextVersion.outputs.version }}/postgresql-operator-${{ steps.nextVersion.outputs.version }}.tgz
```

### Manual CRD Installation
```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
```
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
11 changes: 9 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,17 @@ on:

jobs:
test:
name: Tests
name: Tests (PostgreSQL ${{ matrix.postgres-version }})
runs-on: ubuntu-24.04
timeout-minutes: 5
strategy:
fail-fast: false
matrix:
postgres-version: [ 15, 16, 17, 18 ]
steps:
- uses: actions/checkout@v5
- uses: actions/checkout@v6
with:
token: ${{ secrets.GH_PERSONAL_ACCESS_TOKEN }}
- uses: aboutbits/github-actions-java/setup-with-gradle@v4
with:
java-version: 25
Expand All @@ -20,6 +26,7 @@ jobs:
--console=colored
:operator:test
--fail-fast
-Dquarkus.test.profile=test-pg${{ matrix.postgres-version }}
env:
GITHUB_USER_NAME: ${{ github.actor }}
GITHUB_ACCESS_TOKEN: ${{ secrets.GITHUB_TOKEN }}
7 changes: 7 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Copyright About Bits GmbH

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
17 changes: 15 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,21 @@ run:
generate-jooq:
./gradlew --console=colored :generated:jooqCodegen

# Latest PostgreSQL Version configured in application.yml
test:
./gradlew --console=colored :operator:clean :operator:test
./gradlew --console=colored :operator:clean :operator:test --rerun-tasks

test-pg18:
./gradlew --console=colored :operator:clean :operator:test --rerun-tasks -Dquarkus.test.profile=test-pg18

test-pg17:
./gradlew --console=colored :operator:clean :operator:test --rerun-tasks -Dquarkus.test.profile=test-pg17

test-pg16:
./gradlew --console=colored :operator:clean :operator:test --rerun-tasks -Dquarkus.test.profile=test-pg16

test-pg15:
./gradlew --console=colored :operator:clean :operator:test --rerun-tasks -Dquarkus.test.profile=test-pg15

# Flag targets as phony, to tell `make` that these are no file targets
.PHONY: init install run generate-jooq test
.PHONY: init install run generate-jooq test test-pg18 test-pg17 test-pg16 test-pg15
20 changes: 17 additions & 3 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,36 @@ plugins {
java
checkstyle
id("io.quarkus").apply(false)
alias(libs.plugins.axionReleasePlugin)
alias(libs.plugins.errorPronePlugin)
alias(libs.plugins.jooqPlugin).apply(false)
}

description = "AboutBits PostgreSQL Operator"

scmVersion {
checks {
aheadOfRemote = true
snapshotDependencies = false
uncommittedChanges = false
}
releaseBranchNames = setOf("main")
releaseOnlyOnReleaseBranches = true
versionCreator("simple")
}

version = scmVersion.version

allprojects {
group = "it.aboutbits.postgresql"
version = "0.0.1-SNAPSHOT"
version = rootProject.version

tasks.withType<Checkstyle>().configureEach {
dependsOn(":checkstyleExtractConfig")

reports {
html.required.set(false)
xml.required.set(false)
html.required = false
xml.required = false
}
}
}
Expand Down
8 changes: 5 additions & 3 deletions gradle.properties
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
11 changes: 9 additions & 2 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
[versions]
## AboutBits Libraries ##
checkstyleConfig = "2.0.0"
checkstyleConfig = "2.0.0-RC1"

# Axion Release Plugin #
axionReleasePlugin = "1.21.1"

## Libraries ##
jooq = "3.20.10"
Expand All @@ -11,14 +14,18 @@ quarkiverse-helm = "1.2.7"
scram-client = "3.2"

## Testing ##
assertj = "3.27.6"
assertj = "3.27.7"
checkstyle = "13.0.0"
datafaker = "2.5.3"
errorProne = "2.46.0"
errorPronePlugin = "4.4.0"
nullAway = "0.13.0"

[plugins]
# https://github.com/allegro/axion-release-plugin
# https://axion-release-plugin.readthedocs.io/
axionReleasePlugin = { id = "pl.allegro.tech.build.axion-release", version.ref = "axionReleasePlugin" }

# https://github.com/tbroyer/gradle-errorprone-plugin
# https://mvnrepository.com/artifact/net.ltgt.errorprone/net.ltgt.errorprone.gradle.plugin
errorPronePlugin = { id = "net.ltgt.errorprone", version.ref = "errorPronePlugin" }
Expand Down
19 changes: 19 additions & 0 deletions operator/src/main/docker/compose-devservices-test-pg15.yml
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
19 changes: 19 additions & 0 deletions operator/src/main/docker/compose-devservices-test-pg16.yml
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
19 changes: 19 additions & 0 deletions operator/src/main/docker/compose-devservices-test-pg17.yml
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
19 changes: 19 additions & 0 deletions operator/src/main/docker/compose-devservices-test-pg18.yml
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
Copy link

Copilot AI Jan 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The tmpfs path includes a version-specific directory '/var/lib/postgresql/18/docker' that differs from the standard PostgreSQL data directory path used in other versions. This inconsistency could lead to confusion. Consider using the standard '/var/lib/postgresql/data' path for consistency with pg15, pg16, and pg17 configurations.

Suggested change
- /var/lib/postgresql/18/docker:rw,async,noatime
- /var/lib/postgresql/data:rw,async,noatime

Copilot uses AI. Check for mistakes.
Copy link
Contributor Author

@ThoSap ThoSap Jan 23, 2026

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

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
34 changes: 22 additions & 12 deletions operator/src/main/java/it/aboutbits/postgresql/core/Privilege.java
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
package it.aboutbits.postgresql.core;

import com.fasterxml.jackson.annotation.JsonValue;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
import lombok.experimental.Accessors;
import org.jooq.impl.DSL;
import org.jspecify.annotations.NullMarked;
import org.jspecify.annotations.Nullable;

import java.util.Locale;

Expand All @@ -12,19 +16,25 @@
* </a>
*/
@NullMarked
@Getter
@Accessors(fluent = true)
@RequiredArgsConstructor
public enum Privilege {
SELECT,
INSERT,
UPDATE,
DELETE,
TRUNCATE,
REFERENCES,
TRIGGER,
CREATE,
CONNECT,
TEMPORARY,
USAGE,
MAINTAIN;
SELECT(null),
INSERT(null),
UPDATE(null),
DELETE(null),
TRUNCATE(null),
REFERENCES(null),
TRIGGER(null),
CREATE(null),
CONNECT(null),
TEMPORARY(null),
USAGE(null),
MAINTAIN(17);

@Nullable
private final Integer minimumPostgresVersion;

@JsonValue
public String toValue() {
Expand Down
Loading