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
7 changes: 7 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,10 @@ profile = black

[*.sh]
indent_size = 4
indent_style = tab

[Makefile]
indent_style = tab

[*entrypoint*]
indent_style = tab
1 change: 1 addition & 0 deletions .github/linters/.golangci.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
version: "2"
run:
timeout: 10m
4 changes: 4 additions & 0 deletions .github/super-linter.env
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ VALIDATE_JAVASCRIPT_STANDARD=false
VALIDATE_JSCPD=false
VALIDATE_JSON_PRETTIER=false
VALIDATE_KUBERNETES_KUBECONFORM=false
VALIDATE_MARKDOWN=false
VALIDATE_MARKDOWN_PRETTIER=false
VALIDATE_YAML=false
VALIDATE_YAML_PRETTIER=false
Expand All @@ -19,4 +20,7 @@ VALIDATE_PYTHON_MYPY=false
VALIDATE_PYTHON_PYINK=false
VALIDATE_PYTHON_PYLINT=false

VALIDATE_DOCKERFILE_TRIVY=false
VALIDATE_TRIVY=false

VALIDATE_GO=false
31 changes: 20 additions & 11 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ env:

jobs:
multiplatform_build:
permissions:
contents: read
packages: write
actions: read
strategy:
fail-fast: false
matrix:
Expand All @@ -39,35 +43,40 @@ jobs:
runs-on: ubuntu-24.04
steps:
- name: Validate
env:
EVENT_NAME: ${{ github.event_name }}
GITHUB_REF: ${{ github.ref }}
run: |
if [[ "${{ github.event_name }}" == "workflow_dispatch" && "${{ github.ref }}" == refs/tags* ]]; then
if [[ "$EVENT_NAME" == "workflow_dispatch" && "$GITHUB_REF" == refs/tags/* ]]; then
echo -e "\033[91mManual workflow run on tags is not allowed!\033[0m"
exit 1
fi
- name: Checkout
uses: actions/checkout@v4
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
with:
persist-credentials: false
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
uses: docker/setup-qemu-action@49b3bc8e6bdd4a60e6116a5414239cba5943d3cf # v3.2.0
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
uses: docker/setup-buildx-action@988b5a0280414f521da01fcc63a27aeeb4b104db # v3.6.1
- name: Login to Docker Hub
uses: docker/login-action@v3
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3.3.0
with:
registry: ghcr.io
username: ${GITHUB_ACTOR}
password: ${{secrets.GITHUB_TOKEN}}
- name: Prepare Tag
run: echo "TAG_NAME=$(echo ${TAG_NAME} | sed 's@refs/tags/@@;s@refs/heads/@@;s@/@_@g')" >> $GITHUB_ENV
- name: Get package IDs for delete
- name: Get package IDs for delete
id: get-ids-for-delete
uses: Netcracker/get-package-ids@v0.0.1
uses: Netcracker/get-package-ids@84bc8eb8bed50218be76e671b3a24c35a1300979
with:
component-name: ${{ matrix.component.name }}
component-tag: ${{ env.TAG_NAME }}
access-token: ${{secrets.GITHUB_TOKEN}}
access-token: ${{secrets.GITHUB_TOKEN}}
if: ${{ env.PUSH }}
- name: Build and push
uses: docker/build-push-action@v6
uses: docker/build-push-action@16ebe778df0e7752d2cfcbd924afdbbd89c1a755 # v6.6.1
with:
no-cache: true
context: ${{ matrix.component.context }}
Expand All @@ -76,8 +85,8 @@ jobs:
push: ${{ env.PUSH }}
tags: ghcr.io/netcracker/${{ matrix.component.name }}:${{ env.TAG_NAME }}
provenance: false
- uses: actions/delete-package-versions@v5
with:
- uses: actions/delete-package-versions@e5bc658cc4c965c472efe991f8beea3981499c55 # v5.0.0
with:
package-name: ${{ matrix.component.name }}
package-type: 'container'
package-version-ids: ${{ steps.get-ids-for-delete.outputs.ids-for-delete }}
Expand Down
12 changes: 7 additions & 5 deletions .github/workflows/clean.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ env:
jobs:
delete:
if: github.event.ref_type == 'branch'
permissions:
packages: write
runs-on: ubuntu-24.04
strategy:
fail-fast: false
Expand All @@ -23,20 +25,20 @@ jobs:
- name: Prepare Tag
run: echo "TAG_NAME=$(echo ${TAG_NAME} | sed 's@refs/heads/@@;s@/@_@g')" >> $GITHUB_ENV
- name: Login to Docker Hub
uses: docker/login-action@v3
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3.3.0
with:
registry: ghcr.io
username: ${GITHUB_ACTOR}
password: ${{secrets.GITHUB_TOKEN}}
- name: Get package IDs for delete
- name: Get package IDs for delete
id: get-ids-for-delete
uses: Netcracker/get-package-ids@v0.0.1
uses: Netcracker/get-package-ids@84bc8eb8bed50218be76e671b3a24c35a1300979
with:
component-name: ${{ matrix.component.name }}
component-tag: ${{ env.TAG_NAME }}
access-token: ${{secrets.GITHUB_TOKEN}}
- uses: actions/delete-package-versions@v5
with:
- uses: actions/delete-package-versions@e5bc658cc4c965c472aba07bbc604b8e78b0e8e5 # v5.0.0
with:
package-name: ${{ matrix.component.name }}
package-type: 'container'
package-version-ids: ${{ steps.get-ids-for-delete.outputs.ids-for-delete }}
Expand Down
17 changes: 13 additions & 4 deletions .github/workflows/license.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,24 @@ env:
COPYRIGHT_YEAR: '2024-2025'
jobs:
license:
permissions:
contents: write
pull-requests: write
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- run: docker run -v "${PWD}:/src" -i ghcr.io/google/addlicense -v -c "${{ env.COPYRIGHT_COMPANY }}" -y "${{ env.COPYRIGHT_YEAR }}" $(find . -type f -name "*.go" -o -type f -name "*.sh" -o -type f -name "*.py" | xargs echo)
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
with:
persist-credentials: false
token: ${{ secrets.GITHUB_TOKEN }}
- run: |
find . -type f \( -name "*.go" -o -name "*.sh" -o -name "*.py" \) -print0 | \
xargs -0 docker run -v "${PWD}:/src" -i ghcr.io/google/addlicense \
-v -c "${{ env.COPYRIGHT_COMPANY }}" -y "${{ env.COPYRIGHT_YEAR }}"
- name: Create Pull Request
uses: peter-evans/create-pull-request@v7
uses: peter-evans/create-pull-request@5e914681df9dc83aa4e4905692ca88beb2f9e91f # v7.0.5
with:
commit-message: Auto-update license header
branch: license-update
title: Add License Header
body: Automated license header update
delete-branch: true
delete-branch: true
3 changes: 2 additions & 1 deletion .github/workflows/super-linter.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ jobs:
with:
# Full git history is needed to get a proper list of changed files within `super-linter`
fetch-depth: 0
persist-credentials: false

- name: "Load super-linter environment file"
run: |
Expand All @@ -47,7 +48,7 @@ jobs:
fi

- name: Lint Code Base
uses: super-linter/super-linter@v7
uses: super-linter/super-linter@ffde3b2b33b745cb612d787f669ef9442b1339a6
env:
VALIDATE_ALL_CODEBASE: ${{ inputs.full_scan || false }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ build/_output
extras/target/*
deployments
target/*
charts/**/*.gz
charts/**/*.gz
3 changes: 3 additions & 0 deletions .sqlfluff
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[sqlfluff]
# Specify the SQL dialect to use for linting
dialect = postgres
18 changes: 9 additions & 9 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ vet:

compile:
CGO_ENABLED=0 go build -o ./build/_output/bin/postgres-operator \
-gcflags all=-trimpath=${GOPATH} -asmflags all=-trimpath=${GOPATH} ./cmd/pgskipper-operator
-gcflags all=-trimpath=${GOPATH} -asmflags all=-trimpath=${GOPATH} ./cmd/pgskipper-operator

docker-build:
$(foreach docker_tag,$(DOCKER_NAMES),docker build --file="${DOCKER_FILE}" --pull -t $(docker_tag) ./;)
Expand All @@ -67,18 +67,18 @@ clean:
# Generate code
generate: controller-gen
$(CONTROLLER_GEN) crd:crdVersions={v1} \
object:headerFile="generator/boilerplate.go.txt" \
paths="./api/common/v1"
object:headerFile="generator/boilerplate.go.txt" \
paths="./api/common/v1"

$(CONTROLLER_GEN) crd:crdVersions={v1} \
object:headerFile="generator/boilerplate.go.txt" \
paths="./api/apps/v1" \
output:crd:artifacts:config=charts/patroni-services/crds/
object:headerFile="generator/boilerplate.go.txt" \
paths="./api/apps/v1" \
output:crd:artifacts:config=charts/patroni-services/crds/

$(CONTROLLER_GEN) crd:crdVersions={v1} \
object:headerFile="generator/boilerplate.go.txt" \
paths="./api/patroni/v1" \
output:crd:artifacts:config=charts/patroni-core/crds/
object:headerFile="generator/boilerplate.go.txt" \
paths="./api/patroni/v1" \
output:crd:artifacts:config=charts/patroni-core/crds/
# Find or download controller-gen
# download controller-gen if necessary
controller-gen:
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,4 @@ There are no well-defined rules for troubleshooting, as each task is unique, but
## Useful links

* [Installation Guide](/docs/public/installation.md)
* [Features](/docs/public/features)
* [Features](/docs/public/features)
10 changes: 5 additions & 5 deletions build/bin/entrypoint
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
# This is documented here:
# https://docs.openshift.com/container-platform/3.11/creating_images/guidelines.html#openshift-specific-guidelines

if ! whoami &>/dev/null; then
if [ -w /etc/passwd ]; then
echo "${USER_NAME:-postgres-operator}:x:$(id -u):$(id -g):${USER_NAME:-postgres-operator} user:${HOME}:/sbin/nologin" >> /etc/passwd
fi
if ! whoami >/dev/null 2>&1; then
if [ -w /etc/passwd ]; then
echo "${USER_NAME:-postgres-operator}:x:$(id -u):$(id -g):${USER_NAME:-postgres-operator} user:${HOME}:/sbin/nologin" >>/etc/passwd
fi
fi

exec ${OPERATOR} $@
exec ${OPERATOR} "$@"
2 changes: 1 addition & 1 deletion build/configs/patroni.config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -80,4 +80,4 @@ tags:
clonefrom: false
nofailover: ${DR_MODE}
noloadbalance: false
nosync: false
nosync: false
2 changes: 1 addition & 1 deletion build/configs/postgres-backup-daemon.collector-config
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@
"output_selector": "health"
}
}
]
]
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@
"output_selector": "health"
}
}
]
]
Loading
Loading