Merge pull request 'Merge dev in testing: Aktualisiert Workflows' (#25) from dev into testing
Security Scans / Trivy & OSV-Scanner (push) Successful in 28s
TruffleHog Secret Scan / TruffleHog (push) Successful in 14s
Testing Build, Publish & Preview Release / Build, Publish Packages (Testing) & Create Preview Release (push) Successful in 13m2s
Unit-Tests / Unit-Tests (pull_request) Skipped
TruffleHog Secret Scan / TruffleHog (pull_request) Successful in 13s
Security Scans / Trivy & OSV-Scanner (pull_request) Successful in 19s
Security Scans / Trivy & OSV-Scanner (push) Successful in 28s
TruffleHog Secret Scan / TruffleHog (push) Successful in 14s
Testing Build, Publish & Preview Release / Build, Publish Packages (Testing) & Create Preview Release (push) Successful in 13m2s
Unit-Tests / Unit-Tests (pull_request) Skipped
TruffleHog Secret Scan / TruffleHog (pull_request) Successful in 13s
Security Scans / Trivy & OSV-Scanner (pull_request) Successful in 19s
Reviewed-on: #25
This commit was merged in pull request #25.
This commit is contained in:
@@ -18,7 +18,7 @@ jobs:
|
|||||||
uses: actions/checkout@v7
|
uses: actions/checkout@v7
|
||||||
|
|
||||||
- name: Install Rust Toolchain
|
- name: Install Rust Toolchain
|
||||||
uses: actions-rust-lang/setup-rust-toolchain@v1
|
uses: actions-rust-lang/setup-rust-toolchain@v2
|
||||||
with:
|
with:
|
||||||
toolchain: stable
|
toolchain: stable
|
||||||
cache: false
|
cache: false
|
||||||
@@ -67,7 +67,10 @@ jobs:
|
|||||||
id: cache-packaging-tools
|
id: cache-packaging-tools
|
||||||
uses: actions/cache@v6
|
uses: actions/cache@v6
|
||||||
with:
|
with:
|
||||||
path: ~/.cargo/bin
|
path: |
|
||||||
|
~/.cargo/bin/cargo-binstall
|
||||||
|
~/.cargo/bin/cargo-deb
|
||||||
|
~/.cargo/bin/cargo-generate-rpm
|
||||||
key: packaging-tools-${{ runner.os }}-${{ env.CARGO_BINSTALL_VERSION }}-${{ env.CARGO_DEB_VERSION }}-${{ env.CARGO_GENERATE_RPM_VERSION }}
|
key: packaging-tools-${{ runner.os }}-${{ env.CARGO_BINSTALL_VERSION }}-${{ env.CARGO_DEB_VERSION }}-${{ env.CARGO_GENERATE_RPM_VERSION }}
|
||||||
|
|
||||||
- name: Install Packaging Tools (Prebuilt Binaries)
|
- name: Install Packaging Tools (Prebuilt Binaries)
|
||||||
|
|||||||
@@ -2,14 +2,14 @@ name: Renovate
|
|||||||
|
|
||||||
on:
|
on:
|
||||||
schedule:
|
schedule:
|
||||||
- cron: "0 4 * * 1"
|
- cron: "0 * * * *"
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
renovate:
|
renovate:
|
||||||
name: Dependency-Updates prüfen & Pull Requests erstellen
|
name: Dependency-Updates prüfen & Pull Requests erstellen
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
container: ghcr.io/renovatebot/renovate:44.79.2
|
container: ghcr.io/renovatebot/renovate:44.82.0
|
||||||
steps:
|
steps:
|
||||||
- name: Renovate ausführen
|
- name: Renovate ausführen
|
||||||
run: renovate
|
run: renovate
|
||||||
@@ -19,7 +19,8 @@ jobs:
|
|||||||
RENOVATE_TOKEN: ${{ secrets.RENOVATE_TOKEN }}
|
RENOVATE_TOKEN: ${{ secrets.RENOVATE_TOKEN }}
|
||||||
RENOVATE_REPOSITORIES: ${{ gitea.repository || github.repository }}
|
RENOVATE_REPOSITORIES: ${{ gitea.repository || github.repository }}
|
||||||
RENOVATE_AUTODISCOVER: "false"
|
RENOVATE_AUTODISCOVER: "false"
|
||||||
RENOVATE_GIT_AUTHOR: "Renovate Bot <renovate-bot@creative-dragonslayer.de>"
|
RENOVATE_GIT_AUTHOR: "Renovate Bot <renovate-bot@creativedragonslayer.de>"
|
||||||
RENOVATE_HOST_RULES: >-
|
RENOVATE_HOST_RULES: >-
|
||||||
[{"hostType":"cargo","matchHost":"gitea.creative-dragonslayer.de","token":"${{ secrets.RENOVATE_TOKEN }}"}]
|
[{"hostType":"cargo","matchHost":"${{ gitea.server_url || github.server_url }}","token":"${{ secrets.RENOVATE_TOKEN }}"}]
|
||||||
|
GITHUB_COM_TOKEN: ${{ secrets.GH_RENOVATE_TOKEN }}
|
||||||
LOG_LEVEL: info
|
LOG_LEVEL: info
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ jobs:
|
|||||||
uses: actions/checkout@v7
|
uses: actions/checkout@v7
|
||||||
|
|
||||||
- name: Install Rust Toolchain
|
- name: Install Rust Toolchain
|
||||||
uses: actions-rust-lang/setup-rust-toolchain@v1
|
uses: actions-rust-lang/setup-rust-toolchain@v2
|
||||||
with:
|
with:
|
||||||
toolchain: stable
|
toolchain: stable
|
||||||
cache: false
|
cache: false
|
||||||
@@ -67,7 +67,10 @@ jobs:
|
|||||||
id: cache-packaging-tools
|
id: cache-packaging-tools
|
||||||
uses: actions/cache@v6
|
uses: actions/cache@v6
|
||||||
with:
|
with:
|
||||||
path: ~/.cargo/bin
|
path: |
|
||||||
|
~/.cargo/bin/cargo-binstall
|
||||||
|
~/.cargo/bin/cargo-deb
|
||||||
|
~/.cargo/bin/cargo-generate-rpm
|
||||||
key: packaging-tools-${{ runner.os }}-${{ env.CARGO_BINSTALL_VERSION }}-${{ env.CARGO_DEB_VERSION }}-${{ env.CARGO_GENERATE_RPM_VERSION }}
|
key: packaging-tools-${{ runner.os }}-${{ env.CARGO_BINSTALL_VERSION }}-${{ env.CARGO_DEB_VERSION }}-${{ env.CARGO_GENERATE_RPM_VERSION }}
|
||||||
|
|
||||||
- name: Install Packaging Tools (Prebuilt Binaries)
|
- name: Install Packaging Tools (Prebuilt Binaries)
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ jobs:
|
|||||||
uses: actions/checkout@v7
|
uses: actions/checkout@v7
|
||||||
|
|
||||||
- name: Install Rust Toolchain
|
- name: Install Rust Toolchain
|
||||||
uses: actions-rust-lang/setup-rust-toolchain@v1
|
uses: actions-rust-lang/setup-rust-toolchain@v2
|
||||||
with:
|
with:
|
||||||
toolchain: stable
|
toolchain: stable
|
||||||
cache: false
|
cache: false
|
||||||
|
|||||||
@@ -31,8 +31,12 @@ Dieses Dokument dient als technischer Leitfaden und Kontextdokument für KI-Codi
|
|||||||
│ └── config.toml # Linker für Cross-Target-Kompilierung & Registry-Konfiguration
|
│ └── config.toml # Linker für Cross-Target-Kompilierung & Registry-Konfiguration
|
||||||
├── .gitea/
|
├── .gitea/
|
||||||
│ └── workflows/
|
│ └── workflows/
|
||||||
│ ├── main.yaml # CI/CD: Stabile Builds, Multi-Arch-Paketierung, Release & Upload
|
│ ├── main.yaml # CI/CD: Stabile Builds, Multi-Arch-Paketierung, Release & Upload
|
||||||
│ └── testing.yaml # CI/CD: Preview-Builds & Testing-Pakete
|
│ ├── testing.yaml # CI/CD: Preview-Builds & Testing-Pakete
|
||||||
|
│ ├── unit-tests.yaml # CI: cargo test bei PRs mit Ziel-Branch testing
|
||||||
|
│ ├── security-scan.yaml # CI: Trivy (vuln/secret/misconfig) & OSV-Scanner
|
||||||
|
│ ├── trufflehog-scan.yaml # CI: TruffleHog Secret-Scanning
|
||||||
|
│ └── renovate.yaml # CI: Renovate Dependency-Updates (self-hosted, wöchentlich)
|
||||||
├── scripts/
|
├── scripts/
|
||||||
│ ├── get-build-number.py # Ermittelt automatisch die nächste Revisions-/Build-Nummer
|
│ ├── get-build-number.py # Ermittelt automatisch die nächste Revisions-/Build-Nummer
|
||||||
│ └── package-arch.py # Erzeugt native Arch Linux .pkg.tar.zst Pakete
|
│ └── package-arch.py # Erzeugt native Arch Linux .pkg.tar.zst Pakete
|
||||||
@@ -52,6 +56,7 @@ Dieses Dokument dient als technischer Leitfaden und Kontextdokument für KI-Codi
|
|||||||
├── Dockerfile # Minimales & gehärtetes Runtime-Container-Image
|
├── Dockerfile # Minimales & gehärtetes Runtime-Container-Image
|
||||||
├── docker-compose.example.yml # Beispielkonfiguration für Docker Compose
|
├── docker-compose.example.yml # Beispielkonfiguration für Docker Compose
|
||||||
├── Cargo.toml # Projekt-Manifest & Metadaten für deb, rpm und arch
|
├── Cargo.toml # Projekt-Manifest & Metadaten für deb, rpm und arch
|
||||||
|
├── renovate.json # Renovate-Konfiguration (baseBranches, Gruppierung, Custom-Manager)
|
||||||
├── LICENSE # Lizenztext
|
├── LICENSE # Lizenztext
|
||||||
├── README.md # Benutzerdokumentation
|
├── README.md # Benutzerdokumentation
|
||||||
└── AGENTS.md # Dieses Agenten-Handbuch
|
└── AGENTS.md # Dieses Agenten-Handbuch
|
||||||
@@ -77,7 +82,7 @@ Bei Änderungen an Binärnamen, Abhängigkeiten oder Beschreibungen müssen die
|
|||||||
- `pkgrel`, `arch`, `depends`, `optdepends`.
|
- `pkgrel`, `arch`, `depends`, `optdepends`.
|
||||||
|
|
||||||
### 3.3 Skripte in `scripts/`
|
### 3.3 Skripte in `scripts/`
|
||||||
- **Generizität**: Die Skripte dürfen keine hardcodierten Anwendungsnamen, spezifischen Abhängigkeiten oder projektspezifischen URLs enthalten. Alle Werte müssen dynamisch aus `Cargo.toml` oder Umgebungsvariablen (`BUILD_NUMBER`, `GITEA_URL`, `REPO`, `TOKEN`) ermittelt werden.
|
- **Generizität**: Die Skripte dürfen keine hardcodierten Anwendungsnamen, spezifischen Abhängigkeiten oder projektspezifischen URLs enthalten. Alle Werte müssen dynamisch aus `Cargo.toml` oder Umgebungsvariablen (`BUILD_NUMBER`, `GITEA_URL`, `REPO`, `REPO_OWNER`, `TOKEN`) ermittelt werden.
|
||||||
- **Python-Kompatibilität**: Verwende Standard-Python 3 ohne externe PyPI-Abhängigkeiten (nur Standardbibliothek).
|
- **Python-Kompatibilität**: Verwende Standard-Python 3 ohne externe PyPI-Abhängigkeiten (nur Standardbibliothek).
|
||||||
|
|
||||||
### 3.4 Container-Sicherheit & Persistenz
|
### 3.4 Container-Sicherheit & Persistenz
|
||||||
@@ -119,8 +124,33 @@ python3 scripts/package-arch.py --arch x86_64 --pkgrel 1
|
|||||||
|
|
||||||
## 5. CI/CD-Pipeline Details
|
## 5. CI/CD-Pipeline Details
|
||||||
|
|
||||||
- **Trigger**:
|
### 5.1 Branch-Flow & Trigger
|
||||||
- `push` auf `main`: Baut Binaries für alle 3 Architekturen, baut `.deb`, `.rpm` und `.pkg.tar.zst`, lädt sie in die Gitea Package Registry hoch, erstellt ein Gitea Release `v<VERSION>` und baut/veröffentlicht das Docker-Container-Image mit den Tags `:latest`, `:<VERSION>`, `:v<VERSION>` und `:<VERSION>.<BUILD_NUMBER>`.
|
Promotion-Flow: `dev` → `testing` → `main`, ausschließlich per Merge (nie direkt gepusht).
|
||||||
- `push` auf `testing`: Baut Binaries & Pakete für den `testing`-Kanal, erstellt ein Pre-Release `v<VERSION>-preview` und baut/veröffentlicht das Docker-Container-Image ausschließlich mit eindeutigen Testing-Tags (`:testing`, `:<VERSION>-preview`, `:<VERSION>-testing`, `:<VERSION>-preview.<BUILD_NUMBER>`, `:testing-<BUILD_NUMBER>`). Der Tag `:latest` ist strikt dem `main`-Workflow vorbehalten.
|
|
||||||
- **Secrets**:
|
- `pull_request` mit Ziel-Branch `testing` (`unit-tests.yaml`): führt `cargo test` aus (`types: opened, synchronize, reopened`).
|
||||||
- `PACKAGE_TOKEN` (bzw. Fallback-Token-Namen wie `RELEASE_TOKEN`, `GITEA_TOKEN`) wird für API-Zugriffe auf Gitea Packages, Container Registry und Releases verwendet.
|
- `push` auf `main` (`main.yaml`): Baut Binaries für alle 3 Architekturen, baut `.deb`, `.rpm` und `.pkg.tar.zst`, lädt sie in die Gitea Package Registry hoch, erstellt ein Gitea Release `v<VERSION>` und baut/veröffentlicht das Docker-Container-Image mit den Tags `:latest`, `:<VERSION>`, `:v<VERSION>` und `:<VERSION>.<BUILD_NUMBER>`.
|
||||||
|
- `push` auf `testing` (`testing.yaml`): Baut Binaries & Pakete für den `testing`-Kanal, erstellt ein Pre-Release `v<VERSION>-preview` und baut/veröffentlicht das Docker-Container-Image ausschließlich mit eindeutigen Testing-Tags (`:testing`, `:<VERSION>-preview`, `:<VERSION>-testing`, `:<VERSION>-preview.<BUILD_NUMBER>`, `:testing-<BUILD_NUMBER>`). Der Tag `:latest` ist strikt dem `main`-Workflow vorbehalten.
|
||||||
|
- `push`/`pull_request`/wöchentlich (`security-scan.yaml`, `trufflehog-scan.yaml`): Trivy (vuln/secret/misconfig) & OSV-Scanner laufen bei Push auf `main`/`testing`/`dev` sowie bei jedem PR; TruffleHog hat **keinen** `branches`-Filter und läuft bei Push auf **jeden** Branch (zusätzlich bei jedem PR). Funde werden per `scripts/report-security-issue.py` als Gitea-Issue gemeldet.
|
||||||
|
- stündlich, `workflow_dispatch` (`renovate.yaml`): Renovate (containerisiert via `ghcr.io/renovatebot/renovate`) prüft Dependency-Updates, siehe 5.5. Der stündliche CI-Lauf steuert nur, wie schnell Renovate reagiert (z.B. auf Dependency-Dashboard-Checkboxen); tatsächliche neue Update-PRs entstehen weiterhin nur innerhalb des in `renovate.json` gesetzten `schedule` (Montag vor 6 Uhr).
|
||||||
|
|
||||||
|
### 5.2 Caching (`actions/cache@v6`)
|
||||||
|
`main.yaml`/`testing.yaml` cachen mehrere Verzeichnisse, um wiederholte Cross-Compile-Builds zu beschleunigen:
|
||||||
|
- `~/.cargo/registry`, `~/.cargo/git`, `target` – Cache-Key basiert auf `hashFiles('Cargo.lock')`.
|
||||||
|
- `~/.rustup/.../lib/rustlib/<target>` für die zwei zusätzlichen Cross-Targets – Cache-Key basiert auf der **aufgelösten** `rustc --version`, nicht auf dem gleitenden `stable`-Label. Sonst könnte nach einem Rust-Update eine veraltete gecachte Std-Lib mit einem neueren Compiler kombiniert werden.
|
||||||
|
- `~/.cargo/bin/cargo-binstall`, `~/.cargo/bin/cargo-deb`, `~/.cargo/bin/cargo-generate-rpm` (gezielt die Binaries statt des gesamten Verzeichnisses, um alte Rust-Compiler-Proxys bei Toolchain-Updates nicht wiederherzustellen) – alle drei sind auf feste Versionen gepinnt (Job-`env`), nicht auf `latest`.
|
||||||
|
|
||||||
|
**Wichtige Falle:** `target/debian`, `target/generate-rpm` und `target/arch` hängen ebenfalls unter `target` und werden dadurch mitgecacht, aber von keinem Tool automatisch geleert. Vor jedem Paketbau werden sie daher explizit per `rm -rf` bereinigt – sonst werden alte, bereits hochgeladene Paket-Dateien aus früheren Builds erneut mit hochgeladen, und die Gitea Package Registry lehnt sie mit `409 Conflict` ab (Paket-Dateien sind dort unveränderlich). Bei neuen Paketierungs-Outputs außerhalb dieser drei Ordner muss diese Bereinigung entsprechend erweitert werden.
|
||||||
|
|
||||||
|
### 5.3 Build-Nummer (`scripts/get-build-number.py`)
|
||||||
|
Pro CI-Lauf wird genau **eine** Build-Nummer ermittelt und identisch an `cargo deb`, `cargo generate-rpm` und `package-arch.py --pkgrel` weitergereicht – `.deb`, `.rpm` und Arch-Paket tragen also immer dieselbe Nummer. Zur Ermittlung wird pro Paket-Typ (`debian`, `rpm`, `arch`) gezielt `GET /api/v1/packages/{owner}/{type}/{name}/-/latest` abgefragt (ein Request pro Typ, kein Paging, unbeeinflusst von Docker-Tags/anderen Paketen desselben Owners); das Maximum aller drei Typen + 1 ergibt die neue Nummer. Eine pauschale, ungefilterte Abfrage über alle Pakete des Owners (`GET /packages/{owner}`) darf hier nicht mehr verwendet werden, da sie durch Docker-Image-Tags & Co. verdrängt werden kann.
|
||||||
|
|
||||||
|
### 5.4 Secrets
|
||||||
|
- `PACKAGE_TOKEN` (bzw. Fallback-Token-Namen wie `RELEASE_TOKEN`, `GITEA_TOKEN`) wird für API-Zugriffe auf Gitea Packages, Container Registry und Releases verwendet.
|
||||||
|
- `SECURITY_TOKEN` für die Security-Scan-Workflows (Gitea-Issue-Erstellung).
|
||||||
|
- `RENOVATE_TOKEN` für den Renovate-Workflow.
|
||||||
|
- `GH_RENOVATE_TOKEN` (optional, Renovate-Workflow, als `GITHUB_COM_TOKEN` an Renovate durchgereicht) – GitHub-PAT (Public-Repo-Read genügt), damit Renovate Release-Infos für GitHub-gehostete Dependencies (u.a. `github-actions`-Manager) authentifiziert statt rate-limitiert abfragt.
|
||||||
|
|
||||||
|
### 5.5 Renovate (`renovate.json`)
|
||||||
|
- `baseBranches: ["dev"]` – Renovate liest Dependency-Dateien ausschließlich von `dev` und öffnet PRs nur dort, passend zum `dev → testing → main`-Promotion-Flow. Die Konfigurationsdatei selbst muss trotzdem über den Gitea-Default-Branch auffindbar sein.
|
||||||
|
- Drei Gruppen (`packageRules`), jeweils mit `separateMajorMinor: false`/`separateMinorPatch: false` (sonst reißt Renovate Major-Updates trotz `groupName` standardmäßig in einen eigenen PR): "Gitea Actions" (dateibasiert über `matchFileNames: [".gitea/workflows/**"]`, deckt auch die Custom-Manager unten ab), "Cargo Dependencies", "Docker-Images".
|
||||||
|
- `customManagers` (Regex) tracken Versionen, die als reine Strings in `run:`-Blöcken stecken und vom `github-actions`-Manager nicht erkannt werden: `TRIVY_VERSION`, `OSV_SCANNER_VERSION`, `TRUFFLEHOG_VERSION`, `CARGO_BINSTALL_VERSION`, `CARGO_DEB_VERSION`, `CARGO_GENERATE_RPM_VERSION`. Wird in einer Workflow-Datei eine weitere Tool-Version nach demselben Muster (`NAME_VERSION: "x.y.z"`) gepinnt, muss hier ein passender Eintrag ergänzt werden, sonst bleibt sie von Renovate unbemerkt veraltet.
|
||||||
|
|||||||
Generated
+15
-9
@@ -93,6 +93,12 @@ version = "0.22.1"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6"
|
checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "base64"
|
||||||
|
version = "0.23.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "ac07cdecf99051d9a5238b80f35af32cdeba5b336e55d957b318b50137e18da5"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "bitflags"
|
name = "bitflags"
|
||||||
version = "2.13.1"
|
version = "2.13.1"
|
||||||
@@ -316,7 +322,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||||||
checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb"
|
checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"libc 0.2.189",
|
"libc 0.2.189",
|
||||||
"windows-sys 0.61.2",
|
"windows-sys 0.59.0",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -565,7 +571,7 @@ version = "0.1.20"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "96547c2556ec9d12fb1578c4eaf448b04993e7fb79cbaad930a656880a6bdfa0"
|
checksum = "96547c2556ec9d12fb1578c4eaf448b04993e7fb79cbaad930a656880a6bdfa0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"base64",
|
"base64 0.22.1",
|
||||||
"bytes",
|
"bytes",
|
||||||
"futures-channel",
|
"futures-channel",
|
||||||
"futures-util",
|
"futures-util",
|
||||||
@@ -866,7 +872,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "mirror-package"
|
name = "mirror-package"
|
||||||
version = "1.0.3"
|
version = "1.0.4"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"clap",
|
"clap",
|
||||||
@@ -1035,7 +1041,7 @@ dependencies = [
|
|||||||
"once_cell",
|
"once_cell",
|
||||||
"socket2",
|
"socket2",
|
||||||
"tracing",
|
"tracing",
|
||||||
"windows-sys 0.61.2",
|
"windows-sys 0.59.0",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -1090,11 +1096,11 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "reqwest"
|
name = "reqwest"
|
||||||
version = "0.13.4"
|
version = "0.13.5"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "219c5811de6525e5416c7d5d53bb656d3afdbc6c5af816e0802bcfa42dbdc1c3"
|
checksum = "16a1cfa75cc186dd73d5818e510e042e40927bccc9c236b061cea97e1eb08029"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"base64",
|
"base64 0.23.1",
|
||||||
"bytes",
|
"bytes",
|
||||||
"encoding_rs",
|
"encoding_rs",
|
||||||
"futures-core",
|
"futures-core",
|
||||||
@@ -1214,7 +1220,7 @@ dependencies = [
|
|||||||
"security-framework",
|
"security-framework",
|
||||||
"security-framework-sys",
|
"security-framework-sys",
|
||||||
"webpki-root-certs",
|
"webpki-root-certs",
|
||||||
"windows-sys 0.61.2",
|
"windows-sys 0.59.0",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -1892,7 +1898,7 @@ version = "0.1.11"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "c2a7b1c03c876122aa43f3020e6c3c3ee5c05081c9a00739faf7503aeba10d22"
|
checksum = "c2a7b1c03c876122aa43f3020e6c3c3ee5c05081c9a00739faf7503aeba10d22"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"windows-sys 0.61.2",
|
"windows-sys 0.59.0",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "mirror-package"
|
name = "mirror-package"
|
||||||
version = "1.0.3"
|
version = "1.0.4"
|
||||||
edition = "2024"
|
edition = "2024"
|
||||||
authors = ['DragonSlayer_14']
|
authors = ['DragonSlayer_14']
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
|
|||||||
@@ -1,7 +1,9 @@
|
|||||||
|
# mirror-package
|
||||||
|
|
||||||
[](https://gitea.creative-dragonslayer.de/Linuxapps/MirrorPackage/actions?workflow=main.yaml)
|
[](https://gitea.creative-dragonslayer.de/Linuxapps/MirrorPackage/actions?workflow=main.yaml)
|
||||||
[](https://gitea.creative-dragonslayer.de/Linuxapps/MirrorPackage/actions?workflow=testing.yaml)
|
[](https://gitea.creative-dragonslayer.de/Linuxapps/MirrorPackage/actions?workflow=testing.yaml)
|
||||||
|
[](https://gitea.creative-dragonslayer.de/Linuxapps/MirrorPackage/actions?workflow=security-scan.yaml)
|
||||||
# mirror-package
|
[](https://gitea.creative-dragonslayer.de/Linuxapps/MirrorPackage/actions?workflow=trufflehog-scan.yaml)
|
||||||
|
|
||||||
Automatisiertes Werkzeug zum Extrahieren, Herunterladen und Spiegeln vorkompilierter Linux-Pakete aus GitHub-Releases in eine selbstgehostete Gitea- / Forgejo-Paket-Registry.
|
Automatisiertes Werkzeug zum Extrahieren, Herunterladen und Spiegeln vorkompilierter Linux-Pakete aus GitHub-Releases in eine selbstgehostete Gitea- / Forgejo-Paket-Registry.
|
||||||
|
|
||||||
@@ -202,8 +204,12 @@ services:
|
|||||||
│ └── config.toml # Linker- & Cargo-Konfiguration
|
│ └── config.toml # Linker- & Cargo-Konfiguration
|
||||||
├── .gitea/
|
├── .gitea/
|
||||||
│ └── workflows/
|
│ └── workflows/
|
||||||
│ ├── main.yaml # CI/CD: Release, Pakete & Container (Stable)
|
│ ├── main.yaml # CI/CD: Release, Pakete & Container (Stable)
|
||||||
│ └── testing.yaml # CI/CD: Preview, Pakete & Container (Testing)
|
│ ├── testing.yaml # CI/CD: Preview, Pakete & Container (Testing)
|
||||||
|
│ ├── unit-tests.yaml # CI: cargo test bei PRs gegen testing
|
||||||
|
│ ├── security-scan.yaml # CI: Trivy & OSV-Scanner
|
||||||
|
│ ├── trufflehog-scan.yaml # CI: TruffleHog Secret-Scanning
|
||||||
|
│ └── renovate.yaml # CI: automatisierte Abhängigkeits-Updates (Renovate)
|
||||||
├── scripts/
|
├── scripts/
|
||||||
│ ├── get-build-number.py # Dynamische Ermittlung der Build-/Revisionsnummer
|
│ ├── get-build-number.py # Dynamische Ermittlung der Build-/Revisionsnummer
|
||||||
│ └── package-arch.py # Erstellung nativer Arch Linux-Pakete
|
│ └── package-arch.py # Erstellung nativer Arch Linux-Pakete
|
||||||
@@ -223,6 +229,7 @@ services:
|
|||||||
├── Dockerfile # Gehärtetes, minimales Runtime-Container-Image
|
├── Dockerfile # Gehärtetes, minimales Runtime-Container-Image
|
||||||
├── docker-compose.example.yml # Beispielkonfiguration für Docker Compose
|
├── docker-compose.example.yml # Beispielkonfiguration für Docker Compose
|
||||||
├── Cargo.toml # Projekt-Manifest und Paketierungs-Metadaten
|
├── Cargo.toml # Projekt-Manifest und Paketierungs-Metadaten
|
||||||
|
├── renovate.json # Renovate-Konfiguration für automatisierte Abhängigkeits-Updates
|
||||||
├── LICENSE # GPL-3.0-or-later Lizenztext
|
├── LICENSE # GPL-3.0-or-later Lizenztext
|
||||||
├── AGENTS.md # Agenten- & Entwickler-Richtlinien
|
├── AGENTS.md # Agenten- & Entwickler-Richtlinien
|
||||||
└── README.md # Projektdokumentation
|
└── README.md # Projektdokumentation
|
||||||
@@ -251,6 +258,15 @@ cargo build --release
|
|||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
## CI/CD & Contributing
|
||||||
|
|
||||||
|
- **Branch-Flow**: Änderungen durchlaufen `dev` → `testing` → `main`, jeweils per Merge (nie direkt gepusht).
|
||||||
|
- **Pull Requests gegen `testing`** lösen automatisch `cargo test` aus.
|
||||||
|
- **Sicherheits-Scans**: Trivy & OSV-Scanner laufen bei Push auf `main`/`testing`/`dev` sowie bei jedem Pull Request; TruffleHog läuft bei Push auf **jeden** Branch (kein `branches`-Filter) sowie ebenfalls bei jedem Pull Request. Funde werden als Gitea-Issue gemeldet.
|
||||||
|
- **Abhängigkeits-Updates** werden automatisiert über [Renovate](https://docs.renovatebot.com/) als PRs gegen `dev` vorgeschlagen.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
## Lizenz
|
## Lizenz
|
||||||
|
|
||||||
Dieses Projekt ist unter der [GPL-3.0-or-later](LICENSE)-Lizenz lizenziert.
|
Dieses Projekt ist unter der [GPL-3.0-or-later](LICENSE)-Lizenz lizenziert.
|
||||||
|
|||||||
+21
-7
@@ -3,7 +3,9 @@
|
|||||||
"extends": ["config:recommended"],
|
"extends": ["config:recommended"],
|
||||||
"timezone": "Europe/Berlin",
|
"timezone": "Europe/Berlin",
|
||||||
"schedule": ["before 6am on monday"],
|
"schedule": ["before 6am on monday"],
|
||||||
"baseBranches": ["dev"],
|
"baseBranchPatterns": [
|
||||||
|
"dev"
|
||||||
|
],
|
||||||
"packageRules": [
|
"packageRules": [
|
||||||
{
|
{
|
||||||
"matchFileNames": [".gitea/workflows/**"],
|
"matchFileNames": [".gitea/workflows/**"],
|
||||||
@@ -27,7 +29,9 @@
|
|||||||
"customManagers": [
|
"customManagers": [
|
||||||
{
|
{
|
||||||
"customType": "regex",
|
"customType": "regex",
|
||||||
"fileMatch": ["^\\.gitea/workflows/.+\\.ya?ml$"],
|
"managerFilePatterns": [
|
||||||
|
"/^\\.gitea/workflows/.+\\.ya?ml$/"
|
||||||
|
],
|
||||||
"matchStrings": [
|
"matchStrings": [
|
||||||
"TRIVY_VERSION:\\s*\"(?<currentValue>[^\"]+)\""
|
"TRIVY_VERSION:\\s*\"(?<currentValue>[^\"]+)\""
|
||||||
],
|
],
|
||||||
@@ -37,7 +41,9 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"customType": "regex",
|
"customType": "regex",
|
||||||
"fileMatch": ["^\\.gitea/workflows/.+\\.ya?ml$"],
|
"managerFilePatterns": [
|
||||||
|
"/^\\.gitea/workflows/.+\\.ya?ml$/"
|
||||||
|
],
|
||||||
"matchStrings": [
|
"matchStrings": [
|
||||||
"OSV_SCANNER_VERSION:\\s*\"(?<currentValue>[^\"]+)\""
|
"OSV_SCANNER_VERSION:\\s*\"(?<currentValue>[^\"]+)\""
|
||||||
],
|
],
|
||||||
@@ -47,7 +53,9 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"customType": "regex",
|
"customType": "regex",
|
||||||
"fileMatch": ["^\\.gitea/workflows/.+\\.ya?ml$"],
|
"managerFilePatterns": [
|
||||||
|
"/^\\.gitea/workflows/.+\\.ya?ml$/"
|
||||||
|
],
|
||||||
"matchStrings": [
|
"matchStrings": [
|
||||||
"TRUFFLEHOG_VERSION:\\s*\"(?<currentValue>[^\"]+)\""
|
"TRUFFLEHOG_VERSION:\\s*\"(?<currentValue>[^\"]+)\""
|
||||||
],
|
],
|
||||||
@@ -57,7 +65,9 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"customType": "regex",
|
"customType": "regex",
|
||||||
"fileMatch": ["^\\.gitea/workflows/.+\\.ya?ml$"],
|
"managerFilePatterns": [
|
||||||
|
"/^\\.gitea/workflows/.+\\.ya?ml$/"
|
||||||
|
],
|
||||||
"matchStrings": [
|
"matchStrings": [
|
||||||
"CARGO_BINSTALL_VERSION:\\s*\"(?<currentValue>[^\"]+)\""
|
"CARGO_BINSTALL_VERSION:\\s*\"(?<currentValue>[^\"]+)\""
|
||||||
],
|
],
|
||||||
@@ -67,7 +77,9 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"customType": "regex",
|
"customType": "regex",
|
||||||
"fileMatch": ["^\\.gitea/workflows/.+\\.ya?ml$"],
|
"managerFilePatterns": [
|
||||||
|
"/^\\.gitea/workflows/.+\\.ya?ml$/"
|
||||||
|
],
|
||||||
"matchStrings": [
|
"matchStrings": [
|
||||||
"CARGO_DEB_VERSION:\\s*\"(?<currentValue>[^\"]+)\""
|
"CARGO_DEB_VERSION:\\s*\"(?<currentValue>[^\"]+)\""
|
||||||
],
|
],
|
||||||
@@ -76,7 +88,9 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"customType": "regex",
|
"customType": "regex",
|
||||||
"fileMatch": ["^\\.gitea/workflows/.+\\.ya?ml$"],
|
"managerFilePatterns": [
|
||||||
|
"/^\\.gitea/workflows/.+\\.ya?ml$/"
|
||||||
|
],
|
||||||
"matchStrings": [
|
"matchStrings": [
|
||||||
"CARGO_GENERATE_RPM_VERSION:\\s*\"(?<currentValue>[^\"]+)\""
|
"CARGO_GENERATE_RPM_VERSION:\\s*\"(?<currentValue>[^\"]+)\""
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -253,9 +253,9 @@ def main():
|
|||||||
osv_path = sys.argv[2] if len(sys.argv) > 2 else None
|
osv_path = sys.argv[2] if len(sys.argv) > 2 else None
|
||||||
trufflehog_path = sys.argv[3] if len(sys.argv) > 3 else None
|
trufflehog_path = sys.argv[3] if len(sys.argv) > 3 else None
|
||||||
|
|
||||||
gitea_url = os.environ["GITEA_URL"].rstrip("/")
|
gitea_url = os.environ.get("GITEA_URL", "").strip().rstrip("/")
|
||||||
repo = os.environ["REPO"]
|
repo = os.environ.get("REPO", "").strip()
|
||||||
token = os.environ["TOKEN"]
|
token = os.environ.get("TOKEN", "").strip()
|
||||||
run_url = os.environ.get("RUN_URL", "")
|
run_url = os.environ.get("RUN_URL", "")
|
||||||
osv_exit = int(os.environ.get("OSV_EXIT", "0"))
|
osv_exit = int(os.environ.get("OSV_EXIT", "0"))
|
||||||
trufflehog_exit = int(os.environ.get("TRUFFLEHOG_EXIT", "0"))
|
trufflehog_exit = int(os.environ.get("TRUFFLEHOG_EXIT", "0"))
|
||||||
@@ -263,28 +263,32 @@ def main():
|
|||||||
findings = sort_findings(load_trivy(trivy_path) + load_osv(osv_path) + load_trufflehog(trufflehog_path))
|
findings = sort_findings(load_trivy(trivy_path) + load_osv(osv_path) + load_trufflehog(trufflehog_path))
|
||||||
print_summary(findings)
|
print_summary(findings)
|
||||||
|
|
||||||
open_issue = find_open_issue(token, gitea_url, repo)
|
if not token or not gitea_url or not repo:
|
||||||
|
missing = [name for name, val in [("TOKEN", token), ("GITEA_URL", gitea_url), ("REPO", repo)] if not val]
|
||||||
if findings:
|
print(f"{', '.join(missing)} nicht gesetzt oder leer – überspringe Gitea-Issue-Synchronisation.")
|
||||||
report = build_report(findings, run_url)
|
|
||||||
if open_issue:
|
|
||||||
print(f"Kommentiere bestehendes Issue #{open_issue['number']} mit {len(findings)} Fund(en).")
|
|
||||||
api("POST", f"/repos/{repo}/issues/{open_issue['number']}/comments", token, gitea_url, {"body": report})
|
|
||||||
else:
|
|
||||||
label_id = ensure_label(token, gitea_url, repo)
|
|
||||||
print(f"Erstelle neues Issue mit {len(findings)} Fund(en).")
|
|
||||||
api("POST", f"/repos/{repo}/issues", token, gitea_url, {
|
|
||||||
"title": ISSUE_TITLE,
|
|
||||||
"body": report,
|
|
||||||
"labels": [label_id],
|
|
||||||
})
|
|
||||||
elif open_issue:
|
|
||||||
print(f"Keine aktuellen Funde mehr. Kommentiere Issue #{open_issue['number']}.")
|
|
||||||
api("POST", f"/repos/{repo}/issues/{open_issue['number']}/comments", token, gitea_url, {
|
|
||||||
"body": f"Aktueller Scan hat keine offenen Schwachstellen mehr gefunden.\n\n{run_url}".strip(),
|
|
||||||
})
|
|
||||||
else:
|
else:
|
||||||
print("Keine Funde und kein offenes Issue vorhanden.")
|
open_issue = find_open_issue(token, gitea_url, repo)
|
||||||
|
|
||||||
|
if findings:
|
||||||
|
report = build_report(findings, run_url)
|
||||||
|
if open_issue:
|
||||||
|
print(f"Kommentiere bestehendes Issue #{open_issue['number']} mit {len(findings)} Fund(en).")
|
||||||
|
api("POST", f"/repos/{repo}/issues/{open_issue['number']}/comments", token, gitea_url, {"body": report})
|
||||||
|
else:
|
||||||
|
label_id = ensure_label(token, gitea_url, repo)
|
||||||
|
print(f"Erstelle neues Issue mit {len(findings)} Fund(en).")
|
||||||
|
api("POST", f"/repos/{repo}/issues", token, gitea_url, {
|
||||||
|
"title": ISSUE_TITLE,
|
||||||
|
"body": report,
|
||||||
|
"labels": [label_id],
|
||||||
|
})
|
||||||
|
elif open_issue:
|
||||||
|
print(f"Keine aktuellen Funde mehr. Kommentiere Issue #{open_issue['number']}.")
|
||||||
|
api("POST", f"/repos/{repo}/issues/{open_issue['number']}/comments", token, gitea_url, {
|
||||||
|
"body": f"Aktueller Scan hat keine offenen Schwachstellen mehr gefunden.\n\n{run_url}".strip(),
|
||||||
|
})
|
||||||
|
else:
|
||||||
|
print("Keine Funde und kein offenes Issue vorhanden.")
|
||||||
|
|
||||||
osv_ok_exits = {0, 1}
|
osv_ok_exits = {0, 1}
|
||||||
trufflehog_ok_exits = {0, 183}
|
trufflehog_ok_exits = {0, 183}
|
||||||
|
|||||||
Reference in New Issue
Block a user