diff --git a/.github/auto-merge.yml b/.github/auto-merge.yml new file mode 100644 index 0000000..894e983 --- /dev/null +++ b/.github/auto-merge.yml @@ -0,0 +1,4 @@ +--- +- match: + dependency_type: all + update_type: "semver:minor" diff --git a/.github/dependabot.yaml b/.github/dependabot.yaml index d1e6849..194daf6 100644 --- a/.github/dependabot.yaml +++ b/.github/dependabot.yaml @@ -1,5 +1,6 @@ --- version: 2 + updates: - package-ecosystem: "docker" directory: "/" diff --git a/.github/release-drafter.yml b/.github/release-drafter.yml new file mode 100644 index 0000000..7e0867f --- /dev/null +++ b/.github/release-drafter.yml @@ -0,0 +1,38 @@ +--- +name-template: "v$RESOLVED_VERSION" +tag-template: "v$RESOLVED_VERSION" +categories: + - title: "๐Ÿš€ Features" + labels: + - "feature" + - "enhancement" + - title: "๐Ÿ› Bug Fixes" + labels: + - "fix" + - "bugfix" + - "bug" + - title: "๐Ÿงน Maintenance" + labels: + - "chore" + - "dependencies" +version-resolver: + major: + labels: + - "feature" + minor: + labels: + - "enhancement" + patch: + labels: + - "fix" + - "bugfix" + - "bug" + - "chore" + - "dependencies" + default: patch +template: | + ## Changes + + $CHANGES + + **Full Changelog**: https://github.com/$OWNER/$REPOSITORY/compare/$PREVIOUS_TAG...v$RESOLVED_VERSION diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml deleted file mode 100644 index 7bd54d0..0000000 --- a/.github/workflows/build.yaml +++ /dev/null @@ -1,22 +0,0 @@ -name: Build Docker image - -on: - pull_request: - -jobs: - docker: - name: Build Docker image - env: - IMAGE_NAME: monotek/patron-selfheal - runs-on: ubuntu-20.04 - steps: - - name: Check out source code - uses: actions/checkout@v3 - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v2 - - - name: Build - uses: docker/build-push-action@v4 - with: - push: false diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml new file mode 100644 index 0000000..d95f4c4 --- /dev/null +++ b/.github/workflows/ci.yaml @@ -0,0 +1,37 @@ +--- +name: ci + +on: + pull_request: + +jobs: + super-linter: + runs-on: ubuntu-22.04 + steps: + - name: Checkout Code + uses: actions/checkout@v3 + + - name: Lint Code Base + uses: github/super-linter/slim@v5 + env: + DEFAULT_BRANCH: main + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + docker-build: + runs-on: ubuntu-22.04 + steps: + - name: Checkout Code + uses: actions/checkout@v3 + + - name: Set up QEMU + uses: docker/setup-qemu-action@v2 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + + - name: Build + id: docker_build + uses: docker/build-push-action@v4 + with: + platforms: linux/amd64 + push: false diff --git a/.github/workflows/dependabot-auto-merge.yaml b/.github/workflows/dependabot-auto-merge.yaml new file mode 100644 index 0000000..696d8dc --- /dev/null +++ b/.github/workflows/dependabot-auto-merge.yaml @@ -0,0 +1,15 @@ +--- +name: dependabot-auto-merge + +on: + pull_request: + +jobs: + auto-merge: + runs-on: ubuntu-22.04 + steps: + - uses: actions/checkout@v3 + - uses: ahmadnassri/action-dependabot-auto-merge@v2 + with: + github-token: ${{ secrets.DEPENDABOT_AUTOMERGE }} + target: minor diff --git a/.github/workflows/release-drafter.yaml b/.github/workflows/release-drafter.yaml new file mode 100644 index 0000000..a33ae04 --- /dev/null +++ b/.github/workflows/release-drafter.yaml @@ -0,0 +1,23 @@ +--- +name: Release Drafter + +on: + push: + branches: + - main + pull_request: + types: [opened, reopened, synchronize] + +permissions: + contents: read + +jobs: + update_release_draft: + permissions: + contents: write + pull-requests: write + runs-on: ubuntu-22.04 + steps: + - uses: release-drafter/release-drafter@v5 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/ci-cd.yaml b/.github/workflows/release.yaml similarity index 64% rename from .github/workflows/ci-cd.yaml rename to .github/workflows/release.yaml index 4eded86..7efaed0 100644 --- a/.github/workflows/ci-cd.yaml +++ b/.github/workflows/release.yaml @@ -1,31 +1,26 @@ -name: Push to Registry +--- +name: release on: push: branches: - - 'main' - - 'dev' + - main tags: - - '*' + - "*" jobs: - docker: - if: github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/') - name: Push Docker Image - runs-on: ubuntu-20.04 + docker-build-push: + runs-on: ubuntu-22.04 steps: - - name: Check out source code + - name: Checkout Code uses: actions/checkout@v3 + - name: Set up QEMU + uses: docker/setup-qemu-action@v2 + - name: Set up Docker Buildx uses: docker/setup-buildx-action@v2 - - name: Login to Docker Hub - uses: docker/login-action@v2 - with: - username: ${{ secrets.DOCKERHUB_USERNAME }} - password: ${{ secrets.DOCKERHUB_TOKEN }} - - name: Docker metadata action id: meta uses: docker/metadata-action@v4 @@ -33,14 +28,26 @@ jobs: images: | monotek/patroni-selfheal tags: | + type=ref,event=branch type=ref,event=tag type=semver,pattern=v{{version}} type=semver,pattern=v{{major}}.{{minor}} type=semver,pattern=v{{major}} - type=sha,format=long - - name: Build & Push + - name: Login to Docker Hub + uses: docker/login-action@v2 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + + - name: Build and push + id: docker_build uses: docker/build-push-action@v4 with: + labels: ${{ steps.meta.outputs.labels }} + platforms: linux/amd64,linux/arm64 push: true tags: ${{ steps.meta.outputs.tags }} + + - name: Image digest + run: echo ${{ steps.docker_build.outputs.digest }} diff --git a/README.md b/README.md index 0afbdba..bc6aab4 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,8 @@ # patroni self heal -Checks patroni status and if state is "start failed" deletes the pod so it can recover on restart. +Checks patroni status and if state is "start failed" deletes the pod so it can recover on restart. -Needed as postgres-operator does no support liveness probe. +Needed as [postgres-operator](https://github.com/zalando/postgres-operator) does no support liveness probe. The sidecar needs the following additional rbac config (serviceaccount should already exist):