Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
8740174
chore(git): Add Gitignore
vmercierfr Apr 16, 2024
75a096e
chore(github): Add Github issue templates
vmercierfr Apr 16, 2024
535a475
chore(github): Configure dependabot
vmercierfr Apr 16, 2024
637e383
chore(linter): Add linters
vmercierfr Apr 16, 2024
5460841
chore(localdev): Add local development environment
vmercierfr Apr 16, 2024
ef7817e
chore(go): Add initial project structure
vmercierfr Apr 16, 2024
e1733c2
chore(go): Add retry package
vmercierfr Apr 16, 2024
0888ed7
chore(go): Add UUID7 package
vmercierfr Apr 16, 2024
12b4269
chore(go): Add postgresql package
vmercierfr Apr 16, 2024
d08c93f
chore(go): Add PPM package
vmercierfr Apr 16, 2024
8478b1e
chore(go): Add CLI commands
vmercierfr Apr 16, 2024
6b90215
chore(bats): Add bats tests
vmercierfr Apr 16, 2024
eca07c7
chore(ci): Add test
vmercierfr Apr 16, 2024
b70d290
chore(ci): Add linter
vmercierfr Apr 16, 2024
abd4147
chore(docs): Add PPM configuration file template
vmercierfr Apr 16, 2024
1e00631
chore(README): Initial import
vmercierfr Apr 16, 2024
06cedb0
chore(helm): Add Helm chart
vmercierfr Apr 18, 2024
ddf3d8d
chore(debian): Add Debian package
vmercierfr Apr 18, 2024
3fd5df6
chore(go): Simplify date in postgresql tests
vmercierfr Apr 18, 2024
8ef42b2
refact(postgresql): Rewrite package to split PostgreSQL logic
vmercierfr Apr 22, 2024
da95adb
refact(partition): Rewrite package to split PostgreSQL logic
vmercierfr Apr 22, 2024
dcaf1c6
refact(ppm): Rewrite package to split PostgreSQL logic
vmercierfr Apr 22, 2024
6d86fcc
refact(cmd): Rewrite package to split PostgreSQL logic
vmercierfr Apr 24, 2024
b670733
chore(kubernetesdev): Add local development environment
vmercierfr Apr 18, 2024
ddd0a97
chore(goreleaser): Add Goreleaser configuration
vmercierfr Apr 18, 2024
5d17554
chore(ci): Add checkov
vmercierfr Apr 18, 2024
3bc21c9
chore(ci): Disable checkov until project is private
vmercierfr Apr 18, 2024
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 .checkov.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
skip-check:
- CKV_SECRET_4 # We have password in our configuration templates
- CKV_DOCKER_2 # We don't define healthcheck for our containers because it's a CLI

skip-path:
- scripts/kubernetesdev # Exclude kubernetes development environment, mostly for PostgreSQL
36 changes: 36 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
---
name: Bug report
about: Create a report to help us improve
title: ''
labels: bug
assignees: ''

---

### Describe the bug

A clear and concise description of what the bug is.

### Desktop (please complete the following information)

- OS: [e.g. Linux]
- PostgreSQL partition manager [e.g. v1.1]
- PostgreSQL version: [e.g. v14]
- Partition key column type [e.g. date, uuidv7]

If possible, please also share:

- Table table structure dump (`pg_dump --schema-only --no-comments --no-privileges -t <table_name> <database_name>`)
- PostgreSQL Partition Manager configuration (`postgresql-partition-manager.yaml`)

### To Reproduce

Steps to reproduce the behavior

### Expected behavior

A clear and concise description of what you expected to happen.

### Additional context

Add any other context about the problem here.
24 changes: 24 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
---
name: Feature request
about: Suggest an idea for this project
title: ''
labels: enhancement
assignees: ''

---

### Is your feature request related to a problem? Please describe

A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

### Describe the solution you'd like

A clear and concise description of what you want to happen.

### Describe alternatives you've considered

A clear and concise description of any alternative solutions or features you've considered.

### Additional context

Add any other context or screenshots about the feature request here.
19 changes: 19 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
version: 2
updates:

- package-ecosystem: gomod
directory: "/"
schedule:
interval: weekly
open-pull-requests-limit: 10

- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: weekly

- package-ecosystem: "docker"
directory: "/scripts/localdev"
schedule:
interval: weekly
33 changes: 33 additions & 0 deletions .github/workflows/linter.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
---
name: linter
on: # yamllint disable-line rule:truthy
push:
branches:
- "*"

permissions:
contents: read

jobs:
golangci:
name: golangci
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: '1.21'
cache: false
- name: golangci-lint
uses: golangci/golangci-lint-action@v4
with:
version: v1.54

yamllint:
name: yamllint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Lint YAML files
run: yamllint . # YAML lint is already installed in ubuntu-latest
181 changes: 181 additions & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,181 @@
---
name: unittest
on: # yamllint disable-line rule:truthy
push:
branches:
- "*"

permissions:
contents: read

jobs:
go:
name: go
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: write
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: '1.21'
- name: Install dependencies
run: |
go get .
- name: Build
run: make build
- name: Run Go tests
run: make test
- name: Code Coverage Report
uses: irongut/CodeCoverageSummary@v1.3.0
with:
filename: coverage.xml
badge: true
fail_below_min: true
format: markdown
hide_branch_rate: false
hide_complexity: true
indicators: true
output: both
thresholds: '60 80'
- uses: jwalton/gh-find-current-pr@v1
id: finder
- name: Add Coverage PR Comment
uses: marocchino/sticky-pull-request-comment@v2
with:
number: ${{ steps.finder.outputs.pr }}
path: code-coverage-results.md
recreate: true
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: binary
path: postgresql-partition-manager
if-no-files-found: error
retention-days: 1

e2e:
name: End-to-end
needs: go
strategy:
matrix:
postgres:
- postgres:14
- postgres:15
- postgres:16
runs-on: ubuntu-latest
env:
BATS_LIB_PATH: "${{ github.workspace }}/test/bats/lib/"
PGHOST: localhost
PGUSER: postgres
PGPASSWORD: hackme
PGDATABASE: unittest
services:
postgres:
image: ${{ matrix.postgres }}
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
--hostname postgres
env:
POSTGRES_PASSWORD: hackme
ports:
- 5432:5432

steps:
- uses: actions/checkout@v4

- name: Setup Bats and bats libs
uses: bats-core/bats-action@2.0.0
with:
support-path: ${{ github.workspace }}/test/bats/lib/bats-support
assert-path: ${{ github.workspace }}/test/bats/lib/bats-assert
file-install: false # Unused
detik-install: false # Unused

- name: Download artifact
uses: actions/download-artifact@v4
with:
name: binary

# File permissions are not maintained during artifact upload/download
- name: Move binary to local executable
run: mv postgresql-partition-manager /usr/local/bin && chmod +x /usr/local/bin/postgresql-partition-manager

- name: Run bats
run: make bats-test

helm:
name: helm
runs-on: ubuntu-latest
env:
HELM_UNITTEST_VERSION: v0.3.5
steps:
- uses: actions/checkout@v4
- name: Install helm-unittest
run: helm plugin install --version $HELM_UNITTEST_VERSION https://github.com/helm-unittest/helm-unittest.git
- name: Run Helm test
run: make helm-test

kubeconform:
name: kubeconform
runs-on: ubuntu-latest
env:
KUBECONFORM_VERSION: 0.6.2
steps:
- uses: actions/checkout@v4
- name: Install kubeconform
run: |
curl -sSLo /tmp/kubeconform.tar.gz "https://github.com/yannh/kubeconform/releases/download/v${KUBECONFORM_VERSION}/kubeconform-linux-amd64.tar.gz" \
&& tar -C /usr/local/bin/ -xzvf /tmp/kubeconform.tar.gz
- name: Run Kubeconform test
run: make kubeconform-test

debian:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-go@v5
with:
go-version: stable
- name: Set up QEMU for ARM64 build
uses: docker/setup-qemu-action@v3
- uses: goreleaser/goreleaser-action@v5
with:
distribution: goreleaser
version: latest
args: release --clean --skip=publish --skip=docker --snapshot
env:
GORELEASER_CURRENT_TAG: 0.0.0
- name: Run Debian package tests
run: make debian-test-ci

# checkcov:
# permissions:
# security-events: write # for github/codeql-action/upload-sarif to upload SARIF results
# actions: read # only required for a private repository by github/codeql-action/upload-sarif to get the Action run status
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v4
# - name: Checkov GitHub Action
# uses: bridgecrewio/checkov-action@v12
# with:
# # This will add both a CLI output to the console and create a results.sarif file
# output_format: cli,sarif
# output_file_path: console,results.sarif
# - name: Upload SARIF file
# uses: github/codeql-action/upload-sarif@v3
# # Results are generated only on a success or failure
# # this is required since GitHub by default won't run the next step
# # when the previous one has failed. Security checks that do not pass will 'fail'.
# # An alternative is to add `continue-on-error: true` to the previous step
# # Or 'soft_fail: true' to checkov.
# if: success() || failure()
# with:
# sarif_file: results.sarif
9 changes: 9 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
.DS_Store
/.vscode
/cover.html
/coverage.txt
/coverage.xml
/dist
/postgresql-partition-manager
/postgresql-partition-manager.yaml
scripts/localdev/.data
Loading