Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
68 changes: 14 additions & 54 deletions .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,69 +2,29 @@ name: Linters

on:
pull_request:
branches:
- master

jobs:
documentation:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

# Some versions of Ubuntu have an awk that does not recognize POSIX classes.
# Log the version of awk and abort when it cannot match space U+0020.
# - https://bugs.launchpad.net/ubuntu/+source/mawk/+bug/69724
- run: awk -W version && awk '{ exit 1 != match($0, /[[:space:]]/) }' <<< ' '
- run: |
find docs/content -not -type d -not -name crd.md -print0 | xargs -0 awk '
BEGIN { print "::add-matcher::.github/actions/awk-matcher.json" }

/[[:space:]]$/ { errors++; print FILENAME ":" FNR " error: Trailing space" }
/TODO/ { errors++; print FILENAME ":" FNR " error: Found TODO. Try running hack/create-todo-patch.sh" }

END { print "::remove-matcher owner=awk::" }
END { exit errors != 0 }
'

documentation-crd:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

# The `documentation-crd` job only checks the crd.md for `TODO`,
# as some of the upstream documentation has trailing spaces
- run: |
find docs/content -name crd.md -print0 | xargs -0 awk '
BEGIN { print "::add-matcher::.github/actions/awk-matcher.json" }

/TODO/ { errors++; print FILENAME ":" FNR " error: Found TODO. Try running hack/create-todo-patch.sh" }

END { print "::remove-matcher owner=awk::" }
END { exit errors != 0 }
'

golangci-lint:
runs-on: ubuntu-latest
runs-on: ubuntu-24.04
permissions:
contents: read
checks: write
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
with: { go-version: 1.x }
- uses: actions/checkout@v6
- uses: actions/setup-go@v6
with: { go-version: stable }

- uses: golangci/golangci-lint-action@v3
- uses: golangci/golangci-lint-action@v9
with:
version: v1.60.1
version: latest
args: --timeout=5m

# Count issues reported by disabled linters. The command always
# exits zero to ensure it does not fail the pull request check.
- name: Count non-blocking issues
run: |
golangci-lint run --config .golangci.next.yaml \
--issues-exit-code 0 \
--max-issues-per-linter 0 \
--max-same-issues 0 \
--out-format json |
jq --sort-keys 'reduce .Issues[] as $i ({}; .[$i.FromLinter] += 1)' |
awk >> "${GITHUB_STEP_SUMMARY}" '
NR == 1 { print "```json" } { print } END { if (NR > 0) print "```" }
' || true
golangci-lint run --config .golangci.next.yaml --show-stats >> "${GITHUB_STEP_SUMMARY}" \
--max-issues-per-linter=0 \
--max-same-issues=0 \
--uniq-by-line=0 \
--output.text.path=/dev/null ||:
36 changes: 18 additions & 18 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,9 @@ jobs:
with:
k3s-channel: "${{ matrix.kubernetes }}"
prefetch-images: |
docker.io/ivorysql/pgbackrest:ubi8-2.56.0-5.0-1
docker.io/ivorysql/pgbouncer:ubi8-1.23.0-5.0-1
docker.io/ivorysql/ivorysql:ubi8-5.0-5.0-1
docker.io/ivorysql/pgbackrest:ubi9-2.56.0-5.1-1
docker.io/ivorysql/pgbouncer:ubi9-1.24.0-5.1-1
docker.io/ivorysql/ivorysql:ubi9-5.1-5.1-1

- run: make createnamespaces check-envtest-existing
env:
Expand Down Expand Up @@ -98,13 +98,13 @@ jobs:
with:
k3s-channel: "${{ matrix.kubernetes }}"
prefetch-images: |
docker.io/ivorysql/pgadmin:ubi8-9.9-5.0-1
docker.io/ivorysql/pgbackrest:ubi8-2.56.0-5.0-1
docker.io/ivorysql/pgbouncer:ubi8-1.23.0-5.0-1
docker.io/ivorysql/postgres-exporter:ubi8-0.17.0-5.0-1
docker.io/ivorysql/ivorysql:ubi8-5.0-5.0-1
docker.io/ivorysql/postgis:ubi8-3.5-5.0-1
registry.developers.crunchydata.com/crunchydata/crunchy-upgrade:ubi8-5.3.1-0
docker.io/ivorysql/pgadmin:ubi9-9.9-5.1-1
docker.io/ivorysql/pgbackrest:ubi9-2.56.0-5.1-1
docker.io/ivorysql/pgbouncer:ubi9-1.24.0-5.1-1
docker.io/ivorysql/postgres-exporter:ubi9-0.17.0-5.1-1
docker.io/ivorysql/ivorysql:ubi9-5.1-5.1-1
docker.io/ivorysql/postgis:ubi9-3.5-5.1-1
registry.developers.crunchydata.com/crunchydata/crunchy-upgrade:ubi9-5.3.1-0
- run: go mod download
- name: Build executable
run: IVYO_VERSION='${{ github.sha }}' make build-ivory-operator
Expand All @@ -118,13 +118,13 @@ jobs:
docker run --detach --network host --read-only \
--volume "$(pwd):/mnt" --workdir '/mnt' --env 'PATH=/mnt/bin' \
--env 'KUBECONFIG=hack/.kube/ivory-operator/ivyo' \
--env 'RELATED_IMAGE_PGADMIN=docker.io/ivorysql/pgadmin:ubi8-9.9-5.0-1' \
--env 'RELATED_IMAGE_PGBACKREST=docker.io/ivorysql/pgbackrest:ubi8-2.56.0-5.0-1' \
--env 'RELATED_IMAGE_PGBOUNCER=docker.io/ivorysql/pgbouncer:ubi8-1.23.0-5.0-1' \
--env 'RELATED_IMAGE_PGEXPORTER=docker.io/ivorysql/postgres-exporter:ubi8-0.17.0-5.0-1' \
--env 'RELATED_IMAGE_PGUPGRADE=registry.developers.crunchydata.com/crunchydata/crunchy-upgrade:ubi8-5.3.1-0' \
--env 'RELATED_IMAGE_IVORY_18=docker.io/ivorysql/ivorysql:ubi8-5.0-5.0-1' \
--env 'RELATED_IMAGE_IVORY_18_GIS_3.5=docker.io/ivorysql/postgis:ubi8-3.5-5.0-1' \
--env 'RELATED_IMAGE_PGADMIN=docker.io/ivorysql/pgadmin:ubi9-9.9-5.1-1' \
--env 'RELATED_IMAGE_PGBACKREST=docker.io/ivorysql/pgbackrest:ubi9-2.56.0-5.1-1' \
--env 'RELATED_IMAGE_PGBOUNCER=docker.io/ivorysql/pgbouncer:ubi9-1.24.0-5.1-1' \
--env 'RELATED_IMAGE_PGEXPORTER=docker.io/ivorysql/postgres-exporter:ubi9-0.17.0-5.1-1' \
--env 'RELATED_IMAGE_PGUPGRADE=registry.developers.crunchydata.com/crunchydata/crunchy-upgrade:ubi9-5.3.1-0' \
--env 'RELATED_IMAGE_IVORY_18=docker.io/ivorysql/ivorysql:ubi9-5.1-5.1-1' \
--env 'RELATED_IMAGE_IVORY_18_GIS_3.5=docker.io/ivorysql/postgis:ubi9-3.5-5.1-1' \
--env 'IVYO_FEATURE_GATES=TablespaceVolumes=true' \
--name 'ivory-operator' ubuntu \
ivory-operator
Expand All @@ -139,7 +139,7 @@ jobs:
KUTTL_PG_UPGRADE_TO_VERSION: '18'
KUTTL_PG_VERSION: '18'
KUTTL_POSTGIS_VERSION: '3.5'
KUTTL_IVORY_IMAGE: 'docker.io/ivorysql/ivorysql:ubi8-5.0-5.0-1'
KUTTL_IVORY_IMAGE: 'docker.io/ivorysql/ivorysql:ubi9-5.1-5.1-1'
- run: |
make check-kuttl && exit
failed=$?
Expand Down
24 changes: 11 additions & 13 deletions .golangci.next.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
# https://golangci-lint.run/usage/configuration/
#
# This file is for linters that might be interesting to enforce in the future.
# Rules that should be enforced immediately belong in [.golangci.yaml].
#
# Both files are used by [.github/workflows/lint.yaml].
version: "2"

linters:
disable-all: true
Expand All @@ -15,30 +10,33 @@ linters:
- godox
- goerr113
- gofumpt
- gosec # exclude-use-default
- gosec
- nilnil
- nolintlint
- predeclared
- revive
- staticcheck # exclude-use-default
- staticcheck
- tenv
- thelper
- tparallel
- wastedassign

issues:
# https://github.com/golangci/golangci-lint/issues/2239
exclude-use-default: false

linters-settings:
errchkjson:
check-error-free-encoding: true

thelper:
# https://github.com/kulti/thelper/issues/27
tb: { begin: true, first: true }
test: { begin: true, first: true, name: true }
tb:
begin: true
first: true
test:
begin: true
first: true
name: true

run:
build-tags:
- envtest
- envtest
109 changes: 48 additions & 61 deletions .golangci.yaml
Original file line number Diff line number Diff line change
@@ -1,75 +1,62 @@
# https://golangci-lint.run/usage/configuration/
version: "2"

linters:
disable:
- contextcheck
- errchkjson
- gci
- gofumpt
- scopelint
enable:
- depguard
- gomodguard
- gosimple
- importas
- misspell
- unconvert
presets:
- bugs
- format
- unused

linters-settings:
depguard:
rules:
everything:
deny:
- pkg: io/ioutil
desc: >
Use the "io" and "os" packages instead.
See https://go.dev/doc/go1.16#ioutil

not-tests:
files: ['!$test']
deny:
- pkg: net/http/httptest
desc: Should be used only in tests.

- pkg: testing/*
desc: The "testing" packages should be used only in tests.

- pkg: github.com/ivorysql/ivory-operator/internal/testing/*
desc: The "internal/testing" packages should be used only in tests.

exhaustive:
default-signifies-exhaustive: true

goimports:
local-prefixes: github.com/ivorysql/ivory-operator

gomodguard:
blocked:
modules:
- gopkg.in/yaml.v2: { recommendations: [sigs.k8s.io/yaml] }
- gopkg.in/yaml.v3: { recommendations: [sigs.k8s.io/yaml] }
- gotest.tools: { recommendations: [gotest.tools/v3] }
- k8s.io/kubernetes:
reason: >
k8s.io/kubernetes is for managing dependencies of the Kubernetes
project, i.e. building kubelet and kubeadm.

importas:
alias:
- pkg: k8s.io/api/(\w+)/(v[\w\w]+)
alias: $1$2
- pkg: k8s.io/apimachinery/pkg/apis/(\w+)/(v[\w\d]+)
alias: $1$2
- pkg: k8s.io/apimachinery/pkg/api/errors
alias: apierrors
no-unaliased: true
settings:
dupword:
ignore:
# We might see duplicate instances of 'fi' if we end two bash 'if' statements
- fi

depguard:
rules:
everything:
deny:
- pkg: io/ioutil
desc: >
Use the "io" and "os" packages instead.
See https://go.dev/doc/go1.16#ioutil
not-tests:
files: ['!$test']
deny:
- pkg: net/http/httptest
desc: Should be used only in tests.
- pkg: testing/*
desc: The "testing" packages should be used only in tests.
- pkg: github.com/ivorysql/ivory-operator/internal/testing/*
desc: The "internal/testing" packages should be used only in tests.

exhaustive:
default-signifies-exhaustive: true

gomodguard:
blocked:
modules:
- gopkg.in/yaml.v2: { recommendations: [sigs.k8s.io/yaml] }
- gopkg.in/yaml.v3: { recommendations: [sigs.k8s.io/yaml] }
- gotest.tools: { recommendations: [gotest.tools/v3] }
- k8s.io/kubernetes:
reason: >
k8s.io/kubernetes is for managing dependencies of the Kubernetes project.

importas:
alias:
- pkg: k8s.io/api/(\w+)/(v[\w\w]+)
alias: $1$2
- pkg: k8s.io/apimachinery/pkg/apis/(\w+)/(v[\w\d]+)
alias: $1$2
- pkg: k8s.io/apimachinery/pkg/api/errors
alias: apierrors
no-unaliased: true

run:
build-tags:
- envtest
skip-dirs:
- pkg/generated
- envtest
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ generate-kuttl: export KUTTL_PG_UPGRADE_FROM_VERSION ?= 14
generate-kuttl: export KUTTL_PG_UPGRADE_TO_VERSION ?= 15
generate-kuttl: export KUTTL_PG_VERSION ?= 15
generate-kuttl: export KUTTL_POSTGIS_VERSION ?= 3.3
generate-kuttl: export KUTTL_IVORY_IMAGE ?= docker.io/ivorysql/ivorysql:ubi8-2.2-1.1-1
generate-kuttl: export KUTTL_IVORY_IMAGE ?= docker.io/ivorysql/ivorysql:ubi9-5.1-5.1-1
generate-kuttl: ## Generate kuttl tests
[ ! -d testing/kuttl/e2e-generated ] || rm -r testing/kuttl/e2e-generated
[ ! -d testing/kuttl/e2e-generated-other ] || rm -r testing/kuttl/e2e-generated-other
Expand Down
14 changes: 7 additions & 7 deletions config/manager/manager.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,19 @@ spec:
- name: IVORY_DEBUG
value: "true"
- name: RELATED_IMAGE_IVORY_18
value: "docker.io/ivorysql/ivorysql:ubi8-5.0-5.0-1"
value: "docker.io/ivorysql/ivorysql:ubi9-5.1-5.1-1"
- name: RELATED_IMAGE_PGADMIN
value: "docker.io/ivorysql/pgadmin:ubi8-9.9-5.0-1"
value: "docker.io/ivorysql/pgadmin:ubi9-9.9-5.1-1"
- name: RELATED_IMAGE_PGBACKREST
value: "docker.io/ivorysql/pgbackrest:ubi8-2.56.0-5.0-1"
value: "docker.io/ivorysql/pgbackrest:ubi9-2.56.0-5.1-1"
- name: RELATED_IMAGE_PGBOUNCER
value: "docker.io/ivorysql/pgbouncer:ubi8-1.23.0-5.0-1"
value: "docker.io/ivorysql/pgbouncer:ubi9-1.24.0-5.1-1"
- name: RELATED_IMAGE_PGEXPORTER
value: "docker.io/ivorysql/postgres-exporter:ubi8-0.17.0-5.0-1"
value: "docker.io/ivorysql/postgres-exporter:ubi9-0.17.0-5.1-1"
- name: RELATED_IMAGE_PGUPGRADE
value: "registry.developers.crunchydata.com/crunchydata/crunchy-upgrade:ubi8-5.3.1-0"
value: "registry.developers.crunchydata.com/crunchydata/crunchy-upgrade:ubi9-5.3.1-0"
- name: RELATED_IMAGE_POSTGRES_18_GIS_3.5
value: "docker.io/ivorysql/ivorysql-postgis:ubi8-3.5-5.0-1"
value: "docker.io/ivorysql/ivorysql-postgis:ubi9-3.5-5.1-1"
securityContext:
allowPrivilegeEscalation: false
capabilities: { drop: [ALL] }
Expand Down
4 changes: 2 additions & 2 deletions examples/ivorycluster/ivorycluster.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ kind: IvoryCluster
metadata:
name: hippo
spec:
image: docker.io/ivorysql/ivorysql:ubi8-2.2-1.1-1
image: docker.io/ivorysql/ivorysql:ubi9-5.1-5.1-1
postgresVersion: 15
instances:
- name: instance1
Expand All @@ -15,7 +15,7 @@ spec:
storage: 1Gi
backups:
pgbackrest:
image: docker.io/ivorysql/pgbackrest:ubi8-2.45-1.1-1
image: docker.io/ivorysql/pgbackrest:ubi9-2.56.0-5.1-1
repos:
- name: repo1
volume:
Expand Down
4 changes: 2 additions & 2 deletions examples/kustomize/azure/ivory.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ kind: IvoryCluster
metadata:
name: hippo-azure
spec:
image: docker.io/ivorysql/ivorysql:ubi8-2.2-1.1-1
image: docker.io/ivorysql/ivorysql:ubi9-5.1-5.1-1
postgresVersion: 15
instances:
- dataVolumeClaimSpec:
Expand All @@ -14,7 +14,7 @@ spec:
storage: 1Gi
backups:
pgbackrest:
image: docker.io/ivorysql/pgbackrest:ubi8-2.45-1.1-1
image: docker.io/ivorysql/pgbackrest:ubi9-2.56.0-5.1-1
configuration:
- secret:
name: ivyo-azure-creds
Expand Down
Loading
Loading