-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Leonardo Cecchi <[email protected]>
- Loading branch information
1 parent
d38cc68
commit ce621bb
Showing
36 changed files
with
1,922 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
{ | ||
"image": "mcr.microsoft.com/devcontainers/go:1-bullseye", | ||
"features": { | ||
"ghcr.io/devcontainers/features/docker-in-docker:2": {}, | ||
"ghcr.io/rio/features/k3d:1": {}, | ||
"ghcr.io/mpriscella/features/kind:1": {}, | ||
"ghcr.io/rjfmachado/devcontainer-features/cloud-native:1": { | ||
"kubectl": "latest", | ||
"helm": "latest", | ||
"kubelogin": "none", | ||
"azwi": "none", | ||
"flux": "none", | ||
"cilium": "none" | ||
}, | ||
"ghcr.io/guiyomh/features/golangci-lint:0": {}, | ||
"ghcr.io/devcontainers-contrib/features/kubectx-kubens:1": {}, | ||
"ghcr.io/dhoeric/features/stern:1": {} | ||
}, | ||
|
||
// Needed by kind and k3s to enable kube-proxy's ipvs mode | ||
"mounts":["type=bind,source=/lib/modules,target=/lib/modules"], | ||
|
||
// Enable kubectl short alias with completion | ||
"postCreateCommand": "echo 'alias k=kubectl; complete -F __start_kubectl k' >> ~/.bash_aliases; git clone https://github.com/magicmonty/bash-git-prompt.git ~/.bash-git-prompt --depth=1; echo 'if [ -f \"$HOME/.bash-git-prompt/gitprompt.sh\" ]; then . \"$HOME/.bash-git-prompt/gitprompt.sh\"; fi' >> ~/.bashrc" | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
on: | ||
push: | ||
tags: | ||
- 'v*' | ||
workflow_dispatch: | ||
env: | ||
REGISTRY: ghcr.io | ||
IMAGE_NAME: ${{ github.repository }} | ||
name: build image | ||
jobs: | ||
build-image: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Log in to the Container registry | ||
uses: docker/login-action@v2 | ||
with: | ||
registry: ${{ env.REGISTRY }} | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
- name: Extract metadata (tags, labels) for Docker | ||
id: meta | ||
uses: docker/metadata-action@v4 | ||
with: | ||
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | ||
- name: Build and push Docker image | ||
uses: docker/build-push-action@v3 | ||
with: | ||
context: . | ||
push: true | ||
tags: ${{ steps.meta.outputs.tags }} | ||
labels: ${{ steps.meta.outputs.labels }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
name: Plugin PVC Backup CI | ||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
branches: | ||
- main | ||
workflow_dispatch: | ||
jobs: | ||
lint: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/setup-go@v3 | ||
with: | ||
go-version: '>=1.19.0' | ||
- run: make check | ||
name: "Linters" | ||
|
||
unit-tests: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/setup-go@v3 | ||
with: | ||
go-version: '>=1.19.0' | ||
- run: make test | ||
name: "Unit tests" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
on: | ||
push: | ||
branches: | ||
- main | ||
env: | ||
REGISTRY: ghcr.io | ||
IMAGE_NAME: ${{ github.repository }} | ||
name: release-please | ||
jobs: | ||
release-please: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: google-github-actions/release-please-action@v3 | ||
id: release | ||
with: | ||
release-type: go | ||
package-name: plugin_pvc_backup | ||
token: ${{secrets.REPO_PAT}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
name: spellcheck | ||
|
||
on: | ||
push: | ||
|
||
jobs: | ||
spellcheck: | ||
name: runner / spellcheck | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Check out code. | ||
uses: actions/checkout@v2 | ||
- name: Run PySpelling as a GitHub action | ||
uses: sbates130272/[email protected] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
bin/ | ||
dist/ | ||
.env | ||
.vscode/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,115 @@ | ||
linters-settings: | ||
lll: | ||
line-length: 120 | ||
gci: | ||
sections: | ||
- standard | ||
- default | ||
- prefix(github.com/cloudnative-pg/plugin-pvc-backup) | ||
- blank | ||
- dot | ||
|
||
linters: | ||
# please, do not use `enable-all`: it's deprecated and will be removed soon. | ||
# inverted configuration with `enable-all` and `disable` is not scalable during updates of golangci-lint | ||
disable-all: true | ||
enable: | ||
- asciicheck | ||
- bodyclose | ||
- dogsled | ||
- dupl | ||
- durationcheck | ||
- errcheck | ||
- exportloopref | ||
- gci | ||
- gocognit | ||
- goconst | ||
- gocritic | ||
- gocyclo | ||
- gofmt | ||
- gofumpt | ||
- goheader | ||
- goimports | ||
- gomoddirectives | ||
- gomodguard | ||
- goprintffuncname | ||
- gosec | ||
- gosimple | ||
- govet | ||
- importas | ||
- ineffassign | ||
- lll | ||
- makezero | ||
- misspell | ||
- nakedret | ||
- nestif | ||
- prealloc | ||
- predeclared | ||
- revive | ||
- rowserrcheck | ||
- sqlclosecheck | ||
- staticcheck | ||
- stylecheck | ||
- thelper | ||
- tparallel | ||
- typecheck | ||
- unconvert | ||
- unparam | ||
- unused | ||
- wastedassign | ||
- whitespace | ||
|
||
# to be checked: | ||
# - errorlint | ||
# - forbidigo | ||
# - forcetypeassert | ||
# - goerr113 | ||
# - ifshort | ||
# - nilerr | ||
# - nlreturn | ||
# - noctx | ||
# - nolintlint | ||
# - paralleltest | ||
# - promlinter | ||
# - tagliatelle | ||
# - wrapcheck | ||
|
||
# don't enable: | ||
# - cyclop | ||
# - depguard | ||
# - exhaustive | ||
# - exhaustivestruct | ||
# - funlen | ||
# - gochecknoglobals | ||
# - gochecknoinits | ||
# - godot | ||
# - godox | ||
# - gomnd | ||
# - testpackage | ||
# - wsl | ||
|
||
# deprecated: | ||
# - deadcode | ||
# - golint | ||
# - interfacer | ||
# - maligned | ||
# - scopelint | ||
# - structcheck | ||
# - varcheck | ||
|
||
run: | ||
skip-files: "zz_generated.*" | ||
|
||
issues: | ||
exclude-rules: | ||
# Exclude lll issues for lines with long annotations | ||
- linters: | ||
- lll | ||
source: "//\\s*\\+" | ||
# We have no control of this in zz_generated files and it looks like that excluding those files is not enough | ||
# so we disable "ST1016: methods on the same type should have the same receiver name" in api directory | ||
- linters: | ||
- stylecheck | ||
text: "ST1016:" | ||
path: api/ | ||
exclude-use-default: false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
matrix: | ||
- name: Python Source | ||
sources: | ||
- ./**/*.go | ||
- ./**/*.md | ||
dictionary: | ||
wordlists: | ||
- .wordlist.txt | ||
aspell: | ||
lang: en | ||
d: en_US | ||
pipeline: | ||
- pyspelling.filters.python: | ||
- pyspelling.filters.context: | ||
context_visible_first: true | ||
escapes: \\[\\`~] | ||
delimiters: | ||
# Ignore multiline content between fences (fences can have 3 or more back ticks) | ||
# ``` | ||
# content | ||
# ``` | ||
- open: '(?s)^(?P<open> *`{3,})$' | ||
close: '^(?P=open)$' | ||
# Ignore text between inline back ticks | ||
- open: '(?P<open>`+)' | ||
close: '(?P=open)' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
sidebarToggle | ||
pvc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# Step 1: build image | ||
FROM golang:1.21 AS builder | ||
|
||
# Cache the dependencies | ||
WORKDIR /app | ||
COPY go.mod go.sum /app/ | ||
RUN go mod download | ||
|
||
# Compile the application | ||
COPY . /app | ||
RUN ./scripts/build.sh | ||
|
||
# Step 2: build the image to be actually run | ||
FROM alpine:3.18.4 | ||
USER 10001:10001 | ||
COPY --from=builder /app/bin/plugin-pvc-backup /app/bin/plugin-pvc-backup | ||
ENTRYPOINT ["/app/bin/plugin-pvc-backup"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
.PHONY: run | ||
run: build image | ||
./scripts/run.sh | ||
|
||
.PHONY: build | ||
build: | ||
./scripts/build.sh | ||
|
||
.PHONY: check | ||
check: | ||
./scripts/check.sh | ||
|
||
.PHONY: image | ||
image: | ||
./scripts/image.sh | ||
|
||
.PHONY: test | ||
test: | ||
./scripts/test.sh |
Oops, something went wrong.