4 Commits

Author SHA1 Message Date
4cfb634397 ci: feat add semver conven versioning (#11)
All checks were successful
CD / Check changes (push) Successful in 10s
CD / Create tag (push) Successful in 15s
CD / Build and push (amd64) (push) Successful in 23s
CD / Build and push (arm64) (push) Successful in 5m18s
CD / Create manifest (push) Successful in 8s
Reviewed-on: #11
Co-authored-by: t.behrendt <t.behrendt@t00n.de>
Co-committed-by: t.behrendt <t.behrendt@t00n.de>
2025-09-01 13:13:54 +02:00
cb466747cd chore(deps): update alpine docker tag to v3.22 (#9)
All checks were successful
Build and Release Docker Image / Build and Push amd64 (push) Successful in 27s
Build and Release Docker Image / Build and Push arm64 (push) Successful in 1m24s
Build and Release Docker Image / Create and Push Multi-Arch Manifest (push) Successful in 14s
This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| alpine | final | minor | `3.21` -> `3.22` |

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzOS4yNjMuMSIsInVwZGF0ZWRJblZlciI6IjM5LjI2My4xIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6W119-->

Reviewed-on: #9
Reviewed-by: t.behrendt <t.behrendt@noreply.localhost>
Co-authored-by: Renovate Bot <renovate@t00n.de>
Co-committed-by: Renovate Bot <renovate@t00n.de>
2025-07-30 10:02:46 +02:00
3f544409f1 chore: Configure Renovate (#8)
Some checks failed
Build and Release Docker Image / Build and Push amd64 (push) Successful in 13s
Build and Release Docker Image / Create and Push Multi-Arch Manifest (push) Has been cancelled
Build and Release Docker Image / Build and Push arm64 (push) Has been cancelled
Welcome to [Renovate](https://github.com/renovatebot/renovate)! This is an onboarding PR to help you understand and configure settings before regular Pull Requests begin.

🚦 To activate Renovate, merge this Pull Request. To disable Renovate, simply close this Pull Request unmerged.

---
### Detected Package Files

 * `Dockerfile` (dockerfile)
 * `.gitea/workflows/cd.yaml` (github-actions)

### What to Expect

It looks like your repository dependencies are already up-to-date and no Pull Requests will be necessary right away.

---

 Got questions? Check out Renovate's [Docs](https://docs.renovatebot.com/), particularly the Getting Started section.
If you need any further assistance then you can also [request help here](https://github.com/renovatebot/renovate/discussions).

---

This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).

<!--renovate-config-hash:94693a990c975907e7f13da3309b9d56ba02b3983519b41786edf5cf031e457c-->

Reviewed-on: #8
Co-authored-by: Renovate Bot <renovate@t00n.de>
Co-committed-by: Renovate Bot <renovate@t00n.de>
2025-04-18 13:58:29 +02:00
6ff6e8759e refactor: v2 (#5)
Some checks failed
Build and Release Docker Image / Create and Push Multi-Arch Manifest (push) Has been cancelled
Build and Release Docker Image / Build and Push arm64 (push) Has been cancelled
Build and Release Docker Image / Build and Push amd64 (push) Has been cancelled
Reviewed-on: #5
Co-authored-by: Timo Behrendt <t.behrendt@t00n.de>
Co-committed-by: Timo Behrendt <t.behrendt@t00n.de>
2025-02-07 20:56:02 +01:00
6 changed files with 128 additions and 68 deletions

View File

@@ -1,86 +1,111 @@
name: Build and Release Docker Image name: CD
on: on:
push: push:
branches: branches:
- v2 - main
env:
DOCKER_REGISTRY: gitea.t000-n.de
jobs: jobs:
build_amd64: check-changes:
name: Build and Push amd64 name: Check changes
runs-on: [ubuntu-latest, linux_amd64] runs-on: ubuntu-latest
outputs:
changes: ${{ steps.filter.outputs.code }}
steps: steps:
- name: Checkout repository - name: Checkout
uses: actions/checkout@v4 uses: actions/checkout@v5
- name: Log in to registry - name: Get changed files
uses: docker/login-action@v3 id: filter
uses: dorny/paths-filter@v3
with: with:
registry: gitea.t000-n.de filters: |
username: ${{ secrets.REGISTRY_USERNAME }} code:
password: ${{ secrets.REGISTRY_PASSWORD }} - 'src/**'
- 'Dockerfile'
- 'gitea/workflows/**'
- name: Build Docker image for amd64 build_and_push:
run: | name: Build and push
docker build \ needs:
--platform linux/amd64 \ - check-changes
-f Dockerfile \ if: ${{ needs.check-changes.outputs.changes != '0' }}
-t gitea.t000-n.de/t.behrendt/backupsidecar:${{ github.sha }}-amd64 \ strategy:
. matrix:
arch:
- name: Push Docker image for amd64 - amd64
run: | - arm64
docker push gitea.t000-n.de/t.behrendt/backupsidecar:${{ github.sha }}-amd64 runs-on:
- ubuntu-latest
build_arm64: - linux_${{ matrix.arch }}
name: Build and Push arm64
runs-on: [ubuntu-latest, linux_arm64]
steps: steps:
- name: Checkout repository - uses: actions/checkout@v5
uses: actions/checkout@v4 - uses: docker/setup-buildx-action@v3
- uses: docker/login-action@v3
- name: Log in to registry
uses: docker/login-action@v3
with: with:
registry: gitea.t000-n.de registry: ${{ env.DOCKER_REGISTRY }}
username: ${{ secrets.REGISTRY_USERNAME }} username: ${{ secrets.REGISTRY_USER }}
password: ${{ secrets.REGISTRY_PASSWORD }} password: ${{ secrets.REGISTRY_PASSWORD }}
- id: meta
- name: Build Docker image for arm64
run: | run: |
docker build \ echo REPO_NAME=$(echo ${GITHUB_REPOSITORY} | awk -F"/" '{print $2}' | tr '[:upper:]' '[:lower:]') >> $GITHUB_OUTPUT
--platform linux/arm64 \ echo REPO_VERSION=$(git describe --tags --always | sed 's/^v//') >> $GITHUB_OUTPUT
-f Dockerfile \ - uses: docker/build-push-action@v6
-t gitea.t000-n.de/t.behrendt/backupsidecar:${{ github.sha }}-arm64 \ with:
. context: .
file: ./Dockerfile
platforms: linux/${{ matrix.arch }}
push: true
provenance: false
tags: |
${{ env.DOCKER_REGISTRY }}/t.behrendt/${{ steps.meta.outputs.REPO_NAME }}:${{ steps.meta.outputs.REPO_VERSION }}-${{ matrix.arch }}
- name: Push Docker image for arm64 create_tag:
name: Create tag
needs:
- check-changes
if: ${{ needs.check-changes.outputs.changes != '0' }}
runs-on: ubuntu-latest
outputs:
tag: ${{ steps.tag.outputs.new-tag }}
steps:
- uses: actions/checkout@v5
with:
fetch-depth: 0
- uses: https://gitea.t000-n.de/t.behrendt/conventional-semantic-git-tag-increment@0.0.2
id: tag
with:
token: ${{ secrets.GITEA_TOKEN }}
- run: |
git tag ${{ steps.tag.outputs.new-tag }}
git push origin ${{ steps.tag.outputs.new-tag }}
- name: Set output
run: | run: |
docker push gitea.t000-n.de/t.behrendt/backupsidecar:${{ github.sha }}-arm64 echo "tag=${{ steps.tag.outputs.new-tag }}" >> $GITHUB_OUTPUT
manifest: create_manifest:
name: Create and Push Multi-Arch Manifest name: Create manifest
needs: [build_amd64, build_arm64] needs:
- build_and_push
- create_tag
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Log in to registry - uses: actions/checkout@v5
uses: docker/login-action@v3 - id: meta
run: |
echo REPO_NAME=$(echo ${GITHUB_REPOSITORY} | awk -F"/" '{print $2}' | tr '[:upper:]' '[:lower:]') >> $GITHUB_OUTPUT
echo REPO_VERSION=$(git describe --tags --always | sed 's/^v//') >> $GITHUB_OUTPUT
- uses: docker/login-action@v3
with: with:
registry: gitea.t000-n.de registry: ${{ env.DOCKER_REGISTRY }}
username: ${{ secrets.REGISTRY_USERNAME }} username: ${{ secrets.REGISTRY_USER }}
password: ${{ secrets.REGISTRY_PASSWORD }} password: ${{ secrets.REGISTRY_PASSWORD }}
- run: |
docker manifest create ${{ env.DOCKER_REGISTRY }}/t.behrendt/${{ steps.meta.outputs.REPO_NAME }}:${{ needs.create_tag.outputs.tag }} \
${{ env.DOCKER_REGISTRY }}/t.behrendt/${{ steps.meta.outputs.REPO_NAME }}:${{ steps.meta.outputs.REPO_VERSION }}-amd64 \
${{ env.DOCKER_REGISTRY }}/t.behrendt/${{ steps.meta.outputs.REPO_NAME }}:${{ steps.meta.outputs.REPO_VERSION }}-arm64
- name: Create and push manifest with git SHA docker manifest push ${{ env.DOCKER_REGISTRY }}/t.behrendt/${{ steps.meta.outputs.REPO_NAME }}:${{ needs.create_tag.outputs.tag }}
run: |
docker manifest create gitea.t000-n.de/t.behrendt/backupsidecar:${{ github.sha }} \
gitea.t000-n.de/t.behrendt/backupsidecar:${{ github.sha }}-amd64 \
gitea.t000-n.de/t.behrendt/backupsidecar:${{ github.sha }}-arm64
docker manifest push gitea.t000-n.de/t.behrendt/backupsidecar:${{ github.sha }}
- name: Optionally tag manifest as latest
if: ${{ inputs.latest == true }}
run: |
docker manifest create gitea.t000-n.de/t.behrendt/backupsidecar:latest \
gitea.t000-n.de/t.behrendt/backupsidecar:${{ github.sha }}-amd64 \
gitea.t000-n.de/t.behrendt/backupsidecar:${{ github.sha }}-arm64
docker manifest push gitea.t000-n.de/t.behrendt/backupsidecar:latest

24
.gitea/workflows/ci.yaml Normal file
View File

@@ -0,0 +1,24 @@
name: CI
on:
pull_request:
jobs:
build:
name: Build Docker image
runs-on:
- ubuntu-latest
- linux_amd64
steps:
- uses: actions/checkout@v5
- uses: docker/setup-buildx-action@v3
- name: Build image
uses: docker/build-push-action@v6
with:
context: .
file: ./Dockerfile
platforms: linux/amd64
push: false
provenance: false
tags: |
backupsidecar:ci-test

View File

@@ -1,4 +1,4 @@
FROM alpine:3.21 FROM alpine:3.22
RUN apk update && apk add --no-cache \ RUN apk update && apk add --no-cache \
bash \ bash \

View File

@@ -50,16 +50,23 @@ Ensure the following commands are available in the container:
Example Kubernetes CronJob manifest for running BackupSidecar as a cron job for directory backups in minimal configuration: Example Kubernetes CronJob manifest for running BackupSidecar as a cron job for directory backups in minimal configuration:
```yaml ```yaml
apiVersion: batch/v1beta1 apiVersion: batch/v1
kind: CronJob kind: CronJob
metadata: metadata:
name: backupsidecar-cron name: backupsidecar-cron
namespace: authentik
spec: spec:
schedule: "0 2 * * *" # Run daily at 2:00 AM schedule: "0 7 * * *"
concurrencyPolicy: Forbid
successfulJobsHistoryLimit: 5
failedJobsHistoryLimit: 3
jobTemplate: jobTemplate:
spec: spec:
backoffLimit: 3
activeDeadlineSeconds: 300
template: template:
spec: spec:
restartPolicy: OnFailure
containers: containers:
- name: backupsidecar - name: backupsidecar
image: backupsidecar:latest image: backupsidecar:latest

3
renovate.json Normal file
View File

@@ -0,0 +1,3 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json"
}

View File

@@ -100,9 +100,10 @@ send_notification() {
####################################### #######################################
run_restic_backup() { run_restic_backup() {
local source_dir="$1" local source_dir="$1"
cd "${source_dir}"
log "Starting backup of '${source_dir}' to repository ${RESTIC_REPOSITORY}" log "Starting backup of '${source_dir}' to repository ${RESTIC_REPOSITORY}"
# Capture both stdout and stderr in a variable # Capture both stdout and stderr in a variable
backup_output=$(restic -r "${RESTIC_REPOSITORY}" backup --no-cache --json --verbose "${source_dir}" 2>&1) backup_output=$(restic -r "${RESTIC_REPOSITORY}" backup --no-cache --json --verbose . 2>&1)
# Optionally, also print the output to the console: # Optionally, also print the output to the console:
echo "$backup_output" echo "$backup_output"
# Parse the JSON lines output for the summary message # Parse the JSON lines output for the summary message