-
Notifications
You must be signed in to change notification settings - Fork 0
142 lines (134 loc) · 5.76 KB
/
Copy pathlint.yml
File metadata and controls
142 lines (134 loc) · 5.76 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
# SPDX-License-Identifier: MIT
# Copyright (c) 2026 Netresearch DTT GmbH
#
# Static checks for the glpi-docker-compose-stack repo.
#
# Splits into:
# - container-lint → delegates Dockerfile (hadolint) + shellcheck on shipped
# scripts to netresearch/.github's reusable
# lint-container.yml on @main. Reusable pins hadolint to
# v2.14.0, which handles Docker 25's HEALTHCHECK
# --start-interval correctly. (Earlier v2.12.0 pin was a
# bug — see netresearch/.github#141 + a4a763e.)
# - compose-validate → stays inline. Validates docker compose config with
# repo-specific .env.example placeholder substitution
# (caller-specific shape that doesn't generalise).
# - overlay-hardening → stays inline. Calls tests/lint/hardening-check.sh
# to enforce security_opt:[no-new-privileges:true] +
# cap_drop:[ALL] on every long-running service that
# an examples/compose.*.yml overlay introduces.
# Background: an overlay can ship a service without
# hardening because compose anchors do not survive
# across separate overlay files — this gate catches it.
# - yamllint → stays inline. The repo has no .yamllint.yml config
# file; rules are passed via config_data here to keep
# the contract local.
# - bats → regression suite for bin/env-set.sh +
# bin/compose-file.sh under tests/bin/. Uses
# bats-core/bats-action to install bats + bats-support
# + bats-assert on the runner; failures block PRs.
name: lint
on:
push:
branches: [main]
pull_request:
branches: [main]
workflow_dispatch:
permissions:
contents: read
jobs:
container-lint:
# hadolint (always) + shellcheck (because shell-scandirs is set).
uses: netresearch/.github/.github/workflows/lint-container.yml@main
permissions:
contents: read
with:
shell-scandirs: ./rootfs/usr/local/bin ./bin
compose-validate:
name: docker compose config
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- name: Validate compose.yml
run: |
cp .env.example .env
# supply just-good-enough placeholders so validation passes
# (GLPI's only .env secrets are the DB passwords; its crypt key is
# minted on first boot inside the glpi-config volume)
sed -i \
-e 's/^GLPI_DB_PASSWORD=$/GLPI_DB_PASSWORD=ci-placeholder/' \
-e 's/^DB_ROOT_PASSWORD=$/DB_ROOT_PASSWORD=ci-placeholder/' \
.env
docker compose config --quiet
docker compose -f compose.yml config --quiet
overlay-hardening:
name: overlay hardening
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- name: Install yq (mikefarah)
# The ubuntu-latest runner already has docker compose v2; some images
# also ship a yq, but version + flavour (mikefarah vs kislyuk) vary.
# Pin a specific mikefarah release for reproducibility — the script
# only uses portable v4 syntax (// fallback, @tsv, map/any).
run: |
set -eu
YQ_VERSION=v4.53.2
# SHA256 of yq_linux_amd64 v4.53.2 (verified manually 2026-05-25
# via sha256sum on the published binary; mikefarah/yq's published
# `checksums` file mixes algorithms in a single column so we can't
# parse it programmatically here).
YQ_SHA256=d56bf5c6819e8e696340c312bd70f849dc1678a7cda9c2ad63eebd906371d56b
tmp=$(mktemp)
curl -fsSL \
"https://github.com/mikefarah/yq/releases/download/${YQ_VERSION}/yq_linux_amd64" \
-o "$tmp"
actual=$(sha256sum "$tmp" | awk '{print $1}')
if [ "$actual" != "$YQ_SHA256" ]; then
echo "yq checksum mismatch: expected $YQ_SHA256, got $actual" >&2
exit 1
fi
sudo install -m 0755 "$tmp" /usr/local/bin/yq
rm -f "$tmp"
yq --version
- name: Check overlay hardening
run: ./tests/lint/hardening-check.sh
yamllint:
name: yamllint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- uses: ibiqlik/action-yamllint@2576378a8e339169678f9939646ee3ee325e845c # v3
with:
file_or_dir: .github/workflows .hadolint.yaml compose.yml compose.override.yml.example examples/
config_data: |
extends: default
rules:
line-length: disable
document-start: disable
truthy:
check-keys: false
comments:
min-spaces-from-content: 1
bats:
name: bats tests/bin
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
# Installs bats, bats-support, bats-assert under /usr/lib/bats-*.
# tests/bin/test_helper.bash sources support+assert from that path.
- uses: bats-core/bats-action@77d6fb60505b4d0d1d73e48bd035b55074bbfb43 # v4.0.0
with:
# detik + file are kubernetes/filesystem helpers we don't use.
detik-install: false
file-install: false
- name: Run regression suite
run: bats tests/bin/