Skip to content

Commit 0d6bc52

Browse files
authored
Merge pull request #5 from aboutbits/ab-449-postgresql-operator-publish-workflow-and-pg-15-to-18-test-matrix
AB-449 PostgreSQL Operator: Release workflow + PostgreSQL 15 to 18 Test Matrix
2 parents ee47a37 + c2a28cf commit 0d6bc52

23 files changed

Lines changed: 541 additions & 67 deletions

.github/workflows/release.yml

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
name: Release
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
increment:
7+
description: "Version increment type"
8+
type: choice
9+
required: true
10+
default: "Patch"
11+
options:
12+
- "Major"
13+
- "Minor"
14+
- "Patch"
15+
- "Prerelease"
16+
17+
env:
18+
DOCKER_IMAGE: ghcr.io/${{ github.repository }}
19+
20+
jobs:
21+
test:
22+
uses: ./.github/workflows/test.yml
23+
secrets: inherit
24+
25+
build-and-release:
26+
needs: test
27+
runs-on: ubuntu-24.04
28+
timeout-minutes: 15
29+
steps:
30+
- uses: actions/checkout@v6
31+
with:
32+
token: ${{ secrets.GH_PERSONAL_ACCESS_TOKEN }}
33+
- uses: aboutbits/github-actions-base/git-setup@v2
34+
- uses: aboutbits/github-actions-java/setup-with-gradle@v4
35+
with:
36+
java-version: 25
37+
cache-encryption-key: ${{ secrets.GRADLE_ENCRYPTION_KEY }}
38+
- name: Increment version
39+
run: ./gradlew --console=colored createRelease -Prelease.versionIncrementer=increment${{ github.event.inputs.increment }}
40+
shell: bash
41+
- name: Get next package version
42+
id: nextVersion
43+
run: echo "version=$(./gradlew currentVersion -q -Prelease.quiet)" >> $GITHUB_OUTPUT
44+
shell: bash
45+
- name: Build package
46+
run: ./gradlew --console=colored build -x test
47+
- name: Build Docker image
48+
uses: aboutbits/github-actions-docker/build-push@v1
49+
with:
50+
username: ${{ github.actor }}
51+
password: ${{ secrets.GITHUB_TOKEN }}
52+
docker-image: ${{ env.DOCKER_IMAGE }}
53+
docker-tag: ${{ steps.nextVersion.outputs.version }}
54+
working-directory: './operator'
55+
dockerfile: './operator/src/main/docker/Dockerfile.jvm'
56+
- name: Push tag to remote
57+
run: ./gradlew --console=colored pushRelease
58+
shell: bash
59+
- uses: aboutbits/github-actions-base/github-create-release@v2
60+
with:
61+
tag-name: 'v${{ steps.nextVersion.outputs.version }}'
62+
release-description: |
63+
## Installation
64+
65+
### Helm Chart
66+
```bash
67+
helm install postgresql-operator https://github.com/${{ github.repository }}/releases/download/v${{ steps.nextVersion.outputs.version }}/postgresql-operator-${{ steps.nextVersion.outputs.version }}.tgz
68+
```
69+
70+
### Manual CRD Installation
71+
```bash
72+
kubectl apply -f https://github.com/${{ github.repository }}/releases/download/v${{ steps.nextVersion.outputs.version }}/clusterconnections.postgresql.aboutbits.it-v1.yml
73+
kubectl apply -f https://github.com/${{ github.repository }}/releases/download/v${{ steps.nextVersion.outputs.version }}/databases.postgresql.aboutbits.it-v1.yml
74+
kubectl apply -f https://github.com/${{ github.repository }}/releases/download/v${{ steps.nextVersion.outputs.version }}/schemas.postgresql.aboutbits.it-v1.yml
75+
kubectl apply -f https://github.com/${{ github.repository }}/releases/download/v${{ steps.nextVersion.outputs.version }}/roles.postgresql.aboutbits.it-v1.yml
76+
kubectl apply -f https://github.com/${{ github.repository }}/releases/download/v${{ steps.nextVersion.outputs.version }}/grants.postgresql.aboutbits.it-v1.yml
77+
kubectl apply -f https://github.com/${{ github.repository }}/releases/download/v${{ steps.nextVersion.outputs.version }}/defaultprivileges.postgresql.aboutbits.it-v1.yml
78+
```
79+
release-notes-generation: 'true'
80+
- name: Upload Helm chart and CRD assets
81+
env:
82+
GH_TOKEN: ${{ secrets.GH_PERSONAL_ACCESS_TOKEN }}
83+
run: |
84+
gh release upload v${{ steps.nextVersion.outputs.version }} operator/build/helm/kubernetes/*.tgz operator/build/kubernetes/*.postgresql.aboutbits.it-v1.yml
85+
shell: bash

.github/workflows/test.yml

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,17 @@ on:
55

66
jobs:
77
test:
8-
name: Tests
8+
name: Tests (PostgreSQL ${{ matrix.postgres-version }})
99
runs-on: ubuntu-24.04
1010
timeout-minutes: 5
11+
strategy:
12+
fail-fast: false
13+
matrix:
14+
postgres-version: [ 15, 16, 17, 18 ]
1115
steps:
12-
- uses: actions/checkout@v5
16+
- uses: actions/checkout@v6
17+
with:
18+
token: ${{ secrets.GH_PERSONAL_ACCESS_TOKEN }}
1319
- uses: aboutbits/github-actions-java/setup-with-gradle@v4
1420
with:
1521
java-version: 25
@@ -20,6 +26,7 @@ jobs:
2026
--console=colored
2127
:operator:test
2228
--fail-fast
29+
-Dquarkus.test.profile=test-pg${{ matrix.postgres-version }}
2330
env:
2431
GITHUB_USER_NAME: ${{ github.actor }}
2532
GITHUB_ACCESS_TOKEN: ${{ secrets.GITHUB_TOKEN }}

LICENSE

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
Copyright About Bits GmbH
2+
3+
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:
4+
5+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
6+
7+
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.

Makefile

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,21 @@ run:
1414
generate-jooq:
1515
./gradlew --console=colored :generated:jooqCodegen
1616

17+
# Latest PostgreSQL Version configured in application.yml
1718
test:
18-
./gradlew --console=colored :operator:clean :operator:test
19+
./gradlew --console=colored :operator:clean :operator:test --rerun-tasks
20+
21+
test-pg18:
22+
./gradlew --console=colored :operator:clean :operator:test --rerun-tasks -Dquarkus.test.profile=test-pg18
23+
24+
test-pg17:
25+
./gradlew --console=colored :operator:clean :operator:test --rerun-tasks -Dquarkus.test.profile=test-pg17
26+
27+
test-pg16:
28+
./gradlew --console=colored :operator:clean :operator:test --rerun-tasks -Dquarkus.test.profile=test-pg16
29+
30+
test-pg15:
31+
./gradlew --console=colored :operator:clean :operator:test --rerun-tasks -Dquarkus.test.profile=test-pg15
1932

2033
# Flag targets as phony, to tell `make` that these are no file targets
21-
.PHONY: init install run generate-jooq test
34+
.PHONY: init install run generate-jooq test test-pg18 test-pg17 test-pg16 test-pg15

build.gradle.kts

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,22 +8,36 @@ plugins {
88
java
99
checkstyle
1010
id("io.quarkus").apply(false)
11+
alias(libs.plugins.axionReleasePlugin)
1112
alias(libs.plugins.errorPronePlugin)
1213
alias(libs.plugins.jooqPlugin).apply(false)
1314
}
1415

1516
description = "AboutBits PostgreSQL Operator"
1617

18+
scmVersion {
19+
checks {
20+
aheadOfRemote = true
21+
snapshotDependencies = false
22+
uncommittedChanges = false
23+
}
24+
releaseBranchNames = setOf("main")
25+
releaseOnlyOnReleaseBranches = true
26+
versionCreator("simple")
27+
}
28+
29+
version = scmVersion.version
30+
1731
allprojects {
1832
group = "it.aboutbits.postgresql"
19-
version = "0.0.1-SNAPSHOT"
33+
version = rootProject.version
2034

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

2438
reports {
25-
html.required.set(false)
26-
xml.required.set(false)
39+
html.required = false
40+
xml.required = false
2741
}
2842
}
2943
}

gradle.properties

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
11
# Gradle properties
22
org.gradle.caching=true
3-
org.gradle.parallel=true
3+
org.gradle.configuration-cache=true
4+
# TODO: Set to true when https://github.com/quarkusio/quarkus/issues/49115 is fixed
5+
org.gradle.parallel=false
46
org.gradle.logging.level=INFO
57

68
# Quarkus
79
quarkusPluginId=io.quarkus
8-
quarkusPluginVersion=3.30.7
10+
quarkusPluginVersion=3.30.8
911
# https://mvnrepository.com/artifact/io.quarkus.platform/quarkus-bom
1012
quarkusPlatformGroupId=io.quarkus.platform
1113
quarkusPlatformArtifactId=quarkus-bom
12-
quarkusPlatformVersion=3.30.7
14+
quarkusPlatformVersion=3.30.8
1315
systemProp.quarkus.analytics.disabled=true

gradle/libs.versions.toml

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
[versions]
22
## AboutBits Libraries ##
3-
checkstyleConfig = "2.0.0"
3+
checkstyleConfig = "2.0.0-RC1"
4+
5+
# Axion Release Plugin #
6+
axionReleasePlugin = "1.21.1"
47

58
## Libraries ##
69
jooq = "3.20.10"
@@ -11,14 +14,18 @@ quarkiverse-helm = "1.2.7"
1114
scram-client = "3.2"
1215

1316
## Testing ##
14-
assertj = "3.27.6"
17+
assertj = "3.27.7"
1518
checkstyle = "13.0.0"
1619
datafaker = "2.5.3"
1720
errorProne = "2.46.0"
1821
errorPronePlugin = "4.4.0"
1922
nullAway = "0.13.0"
2023

2124
[plugins]
25+
# https://github.com/allegro/axion-release-plugin
26+
# https://axion-release-plugin.readthedocs.io/
27+
axionReleasePlugin = { id = "pl.allegro.tech.build.axion-release", version.ref = "axionReleasePlugin" }
28+
2229
# https://github.com/tbroyer/gradle-errorprone-plugin
2330
# https://mvnrepository.com/artifact/net.ltgt.errorprone/net.ltgt.errorprone.gradle.plugin
2431
errorPronePlugin = { id = "net.ltgt.errorprone", version.ref = "errorPronePlugin" }
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
services:
2+
db:
3+
image: postgres:15
4+
command: [ "postgres", "-c", "checkpoint_timeout=10min", "-c", "fsync=off", "-c", "full_page_writes=off", "-c", "max_wal_size=2GB", "-c", "synchronous_commit=off" ]
5+
tmpfs:
6+
- /var/lib/postgresql/data:rw,async,noatime
7+
healthcheck:
8+
test: pg_isready -U root -d dummy
9+
interval: 3s
10+
timeout: 3s
11+
retries: 3
12+
ports:
13+
- "5432"
14+
labels:
15+
io.quarkus.devservices.compose.config_map.port.5432: quarkus.datasource.jdbc.port
16+
environment:
17+
- POSTGRES_USER=root
18+
- POSTGRES_PASSWORD=password
19+
- POSTGRES_DB=dummy
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
services:
2+
db:
3+
image: postgres:16
4+
command: [ "postgres", "-c", "checkpoint_timeout=10min", "-c", "fsync=off", "-c", "full_page_writes=off", "-c", "max_wal_size=2GB", "-c", "synchronous_commit=off" ]
5+
tmpfs:
6+
- /var/lib/postgresql/data:rw,async,noatime
7+
healthcheck:
8+
test: pg_isready -U root -d dummy
9+
interval: 3s
10+
timeout: 3s
11+
retries: 3
12+
ports:
13+
- "5432"
14+
labels:
15+
io.quarkus.devservices.compose.config_map.port.5432: quarkus.datasource.jdbc.port
16+
environment:
17+
- POSTGRES_USER=root
18+
- POSTGRES_PASSWORD=password
19+
- POSTGRES_DB=dummy
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
services:
2+
db:
3+
image: postgres:17
4+
command: [ "postgres", "-c", "checkpoint_timeout=10min", "-c", "fsync=off", "-c", "full_page_writes=off", "-c", "max_wal_size=2GB", "-c", "synchronous_commit=off" ]
5+
tmpfs:
6+
- /var/lib/postgresql/data:rw,async,noatime
7+
healthcheck:
8+
test: pg_isready -U root -d dummy
9+
interval: 3s
10+
timeout: 3s
11+
retries: 3
12+
ports:
13+
- "5432"
14+
labels:
15+
io.quarkus.devservices.compose.config_map.port.5432: quarkus.datasource.jdbc.port
16+
environment:
17+
- POSTGRES_USER=root
18+
- POSTGRES_PASSWORD=password
19+
- POSTGRES_DB=dummy

0 commit comments

Comments
 (0)