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
16 changes: 8 additions & 8 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,33 +14,33 @@ jobs:
steps:
# https://github.com/actions/checkout
- name: checkout
uses: actions/checkout@v4
uses: actions/checkout@v6

# https://github.com/actions/setup-go
- name: Set up Go
uses: actions/setup-go@v5
uses: actions/setup-go@v6
with:
go-version: '>=1.20'
go-version-file: "go.mod"

# https://github.com/pre-commit/action
- name: run pre-commit
uses: pre-commit/action@v3.0.1
env:
SKIP: no-commit-to-branch
SKIP: no-commit-to-branch,golangci-lint

golangci-lint:
runs-on: ubuntu-latest
steps:
# https://github.com/actions/checkout
- name: checkout
uses: actions/checkout@v4
uses: actions/checkout@v6

# https://github.com/actions/setup-go
- name: Set up Go
uses: actions/setup-go@v5
uses: actions/setup-go@v6
with:
go-version: '>=1.20'
go-version-file: "go.mod"

# https://github.com/golangci/golangci-lint-action
- name: golangci-lint
uses: golangci/golangci-lint-action@v6
uses: golangci/golangci-lint-action@v9
20 changes: 10 additions & 10 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@ jobs:
steps:
# https://github.com/actions/checkout
- name: Checkout
uses: actions/checkout@v4
uses: actions/checkout@v6
with:
fetch-depth: 0

# https://github.com/actions/setup-go
- name: Set up Go
uses: actions/setup-go@v5
uses: actions/setup-go@v6
with:
go-version: ">=1.22"
go-version-file: "go.mod"

# https://github.com/goreleaser/goreleaser-action
- name: Run GoReleaser (Tag)
Expand All @@ -45,7 +45,7 @@ jobs:

# https://github.com/actions/upload-artifact
- name: Upload binaries as artifacts
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@v6
with:
name: binaries
path: dist/cli*
Expand All @@ -56,11 +56,11 @@ jobs:
steps:
# https://github.com/actions/checkout
- name: Checkout repository
uses: actions/checkout@v4
uses: actions/checkout@v6

# https://github.com/actions/download-artifact
- name: Download binaries
uses: actions/download-artifact@v4
uses: actions/download-artifact@v7
with:
name: binaries
path: dist
Expand All @@ -83,7 +83,7 @@ jobs:
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ github.actor }}
username: ${{ github.repository_owner }}
password: ${{ secrets.DOCKER_HUB_TOKEN }}

# https://github.com/docker/login-action
Expand All @@ -97,7 +97,7 @@ jobs:
# https://github.com/actions/github-script
- name: Fetch repository info
id: repo_info
uses: actions/github-script@v7
uses: actions/github-script@v8
with:
result-encoding: string
script: |
Expand Down Expand Up @@ -143,8 +143,8 @@ jobs:

# https://github.com/peter-evans/dockerhub-description
- name: Update Docker Hub Description
uses: peter-evans/dockerhub-description@v4
uses: peter-evans/dockerhub-description@v5
with:
username: ${{ github.actor }}
password: ${{ secrets.DOCKER_HUB_TOKEN }}
password: ${{ secrets.DOCKER_HUB_TOKEN_DOCKERHUB_DESCRIPTION }}
repository: ${{ github.repository }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
config.yml
dist/
restic-runner
testrepo
17 changes: 8 additions & 9 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,31 +21,30 @@ builds:
ignore:
- goos: freebsd
goarch: arm64
- goos: windows
goarch: arm
universal_binaries:
- id: cli
replace: false
archives:
- id: cli
format_overrides:
- goos: windows
format: zip
formats:
- zip
files:
- README.md
- LICENSE.txt
name_template: >-
{{- .ProjectName -}}_
{{- .Version -}}_
{{- if eq .Os "darwin" -}}
macos
{{- else -}}
{{ .Os }}
{{- end -}}_
{{- if eq .Os "darwin" -}}macos{{- else -}}{{ .Os }}{{- end -}}_
{{- .Arch -}}
checksum:
name_template: 'checksums.txt'
name_template: "checksums.txt"
changelog:
sort: asc
filters:
exclude:
- '^docs:'
- '^test:'
- "^docs:"
- "^test:"
10 changes: 7 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.6.0
rev: v6.0.0
hooks:
- id: check-added-large-files
- id: check-case-conflict
Expand All @@ -18,11 +18,15 @@ repos:
- --branch
- main
- repo: https://github.com/golangci/golangci-lint
rev: v1.59.1
rev: v2.8.0
hooks:
- id: golangci-lint
- repo: https://github.com/rhysd/actionlint
rev: v1.7.1
rev: v1.7.10
hooks:
- id: actionlint-docker
name: check github workflows with actionlint
- repo: https://github.com/hadolint/hadolint
rev: v2.14.0
hooks:
- id: hadolint-docker
19 changes: 13 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,16 +1,23 @@
FROM alpine:edge as dist
FROM alpine:edge AS dist
ARG TARGETPLATFORM

# this is only there if goreleaser has created it
# dist is only there if goreleaser has created it before this build
COPY dist /dist/
RUN set -eux; \
platform_dirname=$(printf '%s' "${TARGETPLATFORM}" | tr / _ | tr A-Z a-z | sed 's/amd64/amd64_v1/g'); \
subdir=$(printf '/dist/cli_%s' $platform_dirname); \
cp ${subdir}/restic-runner /restic-runner; \
case "${TARGETPLATFORM:-}" in \
linux/amd64) f="dist/cli_linux_amd64_v1/restic-runner"; ;; \
linux/arm) f="dist/cli_linux_arm_7/restic-runner"; ;; \
linux/arm64) f="dist/cli_linux_arm64_v8.0/restic-runner"; ;; \
*) echo "unknown TARGETPLATFORM: '${TARGETPLATFORM:-}'"; exit 1; ;; \
esac; \
cp "${f}" /; \
chmod +x /restic-runner;

FROM alpine:edge
RUN apk add --no-cache ca-certificates
RUN apk add --no-cache \
'ca-certificates>=20251003-r0' \
'restic>=0.18.1' \
;
COPY --from=dist /restic-runner /

ENTRYPOINT [ "/restic-runner" ]
18 changes: 18 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
restic-runner:
go build -o "$@"

dist:
goreleaser build --auto-snapshot --clean

.PHONY: docker-build
docker-build: dist
docker build -t backplane/restic-runner .

.PHONY: docker-run
docker-run: docker-build
docker run --rm -it backplane/restic-runner

.PHONY: clean
clean:
go clean
rm -rf dist
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ COMMANDS:
help, h Shows a list of commands or help for one command

GLOBAL OPTIONS:
--config value path to config file (default: "/Users/user/.restic-runner.yml")
--config value path to config file (default: "~/.restic-runner.yml")
--loglevel value how verbosely to log, one of: DEBUG, INFO, WARN, ERROR (default: "INFO")
--pidfile value path to pid lock file; this file prevents issues concurrent jobs (default: "/Users/user/.restic-runner.pid")
--pidfile value path to pid lock file; this file prevents issues concurrent jobs (default: "~/.restic-runner.pid")
--help, -h show help
--version, -v print the version
```
Expand Down
8 changes: 4 additions & 4 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ go 1.22.5

require (
github.com/jinzhu/configor v1.2.2
github.com/urfave/cli/v2 v2.27.2
github.com/urfave/cli/v2 v2.27.7
)

require (
github.com/BurntSushi/toml v1.4.0 // indirect
github.com/cpuguy83/go-md2man/v2 v2.0.4 // indirect
github.com/BurntSushi/toml v1.6.0 // indirect
github.com/cpuguy83/go-md2man/v2 v2.0.7 // indirect
github.com/russross/blackfriday/v2 v2.1.0 // indirect
github.com/xrash/smetrics v0.0.0-20240521201337-686a1a2994c1 // indirect
github.com/xrash/smetrics v0.0.0-20250705151800-55b8f293f342 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
16 changes: 8 additions & 8 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
github.com/BurntSushi/toml v1.2.0/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ=
github.com/BurntSushi/toml v1.4.0 h1:kuoIxZQy2WRRk1pttg9asf+WVv6tWQuBNVmK8+nqPr0=
github.com/BurntSushi/toml v1.4.0/go.mod h1:ukJfTF/6rtPPRCnwkur4qwRxa8vTRFBF0uk2lLoLwho=
github.com/cpuguy83/go-md2man/v2 v2.0.4 h1:wfIWP927BUkWJb2NmU/kNDYIBTh/ziUX91+lVfRxZq4=
github.com/cpuguy83/go-md2man/v2 v2.0.4/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o=
github.com/BurntSushi/toml v1.6.0 h1:dRaEfpa2VI55EwlIW72hMRHdWouJeRF7TPYhI+AUQjk=
github.com/BurntSushi/toml v1.6.0/go.mod h1:ukJfTF/6rtPPRCnwkur4qwRxa8vTRFBF0uk2lLoLwho=
github.com/cpuguy83/go-md2man/v2 v2.0.7 h1:zbFlGlXEAKlwXpmvle3d8Oe3YnkKIK4xSRTd3sHPnBo=
github.com/cpuguy83/go-md2man/v2 v2.0.7/go.mod h1:oOW0eioCTA6cOiMLiUPZOpcVxMig6NIQQ7OS05n1F4g=
github.com/jinzhu/configor v1.2.2 h1:sLgh6KMzpCmaQB4e+9Fu/29VErtBUqsS2t8C9BNIVsA=
github.com/jinzhu/configor v1.2.2/go.mod h1:iFFSfOBKP3kC2Dku0ZGB3t3aulfQgTGJknodhFavsU8=
github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf35Ld67mk=
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
github.com/urfave/cli/v2 v2.27.2 h1:6e0H+AkS+zDckwPCUrZkKX38mRaau4nL2uipkJpbkcI=
github.com/urfave/cli/v2 v2.27.2/go.mod h1:g0+79LmHHATl7DAcHO99smiR/T7uGLw84w8Y42x+4eM=
github.com/xrash/smetrics v0.0.0-20240521201337-686a1a2994c1 h1:gEOO8jv9F4OT7lGCjxCBTO/36wtF6j2nSip77qHd4x4=
github.com/xrash/smetrics v0.0.0-20240521201337-686a1a2994c1/go.mod h1:Ohn+xnUBiLI6FVj/9LpzZWtj1/D6lUovWYBkxHVV3aM=
github.com/urfave/cli/v2 v2.27.7 h1:bH59vdhbjLv3LAvIu6gd0usJHgoTTPhCFib8qqOwXYU=
github.com/urfave/cli/v2 v2.27.7/go.mod h1:CyNAG/xg+iAOg0N4MPGZqVmv2rCoP267496AOXUZjA4=
github.com/xrash/smetrics v0.0.0-20250705151800-55b8f293f342 h1:FnBeRrxr7OU4VvAzt5X7s6266i6cSVkkFPS0TuXWbIg=
github.com/xrash/smetrics v0.0.0-20250705151800-55b8f293f342/go.mod h1:Ohn+xnUBiLI6FVj/9LpzZWtj1/D6lUovWYBkxHVV3aM=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
Expand Down
Loading