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
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
.gitattributes text eol=lf
/prometheus/README.md text eol=lf
/prometheus/ATTRIBUTION.md text eol=lf
/prometheus/profiles/**/manifest.yaml text eol=lf
Expand Down
40 changes: 35 additions & 5 deletions .github/workflows/prometheus-evidence.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,15 @@
name: Prometheus Evidence Immutability

on:
pull_request:
paths:
- 'prometheus/profiles/**'
- '.github/workflows/prometheus-evidence.yml'
pull_request: null

permissions:
contents: read

concurrency:
group: prometheus-evidence-${{ github.ref }}-${{ github.event_name }}
cancel-in-progress: true

jobs:
immutable-paths:
runs-on: ubuntu-latest
Expand All @@ -18,13 +19,42 @@ jobs:
uses: actions/checkout@v7
with:
fetch-depth: 0
sparse-checkout: |
.gitattributes
.github/workflows/prometheus-evidence.yml
prometheus
sparse-checkout-cone-mode: false

- name: Verify LF storage contract
shell: bash
run: |
set -euxo pipefail

attributes_file=$(mktemp)
trap 'rm -f "${attributes_file}"' EXIT
{
printf '%s\0' .gitattributes
git ls-files -z -- prometheus
} | git check-attr --stdin -z eol > "${attributes_file}"
mapfile -d '' -t attributes < "${attributes_file}"
test "${#attributes[@]}" -gt 0
test "$((${#attributes[@]} % 3))" -eq 0
for ((index = 0; index < ${#attributes[@]}; index += 3)); do
path=${attributes[index]}
attribute=${attributes[index + 1]}
value=${attributes[index + 2]}
if [[ "${attribute}" != eol || "${value}" != lf ]]; then
echo "Prometheus evidence must check out with LF line endings: ${path}: ${attribute}: ${value}" >&2
exit 1
fi
done

- name: Reject changes to existing evidence
shell: bash
env:
BASE_SHA: ${{ github.event.pull_request.base.sha }}
run: |
set -euo pipefail
set -euxo pipefail

if git diff --quiet --diff-filter=MDRT "${BASE_SHA}"...HEAD -- prometheus/profiles; then
:
Expand Down
6 changes: 3 additions & 3 deletions prometheus/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ stock Prometheus profiles in `netdata/netdata`.

## Data boundary

- `profiles/<profile>/fixtures/` contains sanitized, source-derived synthetic
- `profiles/<profile-revision>/fixtures/` contains sanitized, source-derived synthetic
Prometheus exposition.
- `profiles/<profile>/SOURCE-INVENTORY.tsv` contains the generated
- `profiles/<profile-revision>/SOURCE-INVENTORY.tsv` contains the generated
source-family-to-profile reconciliation ledger.
- `profiles/<profile>/manifest.yaml` records the size and SHA-256 digest of
- `profiles/<profile-revision>/manifest.yaml` records the size and SHA-256 digest of
every evidence file.

These fixtures are structural unions assembled from public exporter source and
Expand Down