refactor(ci): extract inline scripts to ci/scripts/

- ci/scripts/read_meta.py     legge version|build_from da config.yaml/json
- ci/scripts/update_repo.py   upserta repository.json
- ci/scripts/lint_addon.sh    hadolint + yaml/json + shellcheck
- ci/scripts/git_push_repo.sh  commit e push di repository.json

Rimuove writeFile /tmp/ dal Jenkinsfile

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
Martin Tahiraj
2026-04-02 14:46:17 +02:00
parent 88fe792ca0
commit c8dbd399ce
5 changed files with 197 additions and 138 deletions

32
ci/scripts/read_meta.py Normal file
View File

@@ -0,0 +1,32 @@
#!/usr/bin/env python3
"""
Legge version e build_from.amd64 dalla config di un addon HA.
Uso: python3 read_meta.py <addon_dir>
Output su stdout: version|build_from_amd64
"""
import json
import os
import sys
try:
import yaml
HAS_YAML = True
except ImportError:
HAS_YAML = False
addon = sys.argv[1]
for filename in ('config.yaml', 'config.json'):
path = os.path.join(addon, filename)
if not os.path.exists(path):
continue
with open(path) as f:
cfg = yaml.safe_load(f) if (filename.endswith('.yaml') and HAS_YAML) else json.load(f)
version = str(cfg.get('version', 'latest'))
build_from = (cfg.get('build_from') or {}).get('amd64', '')
print(f'{version}|{build_from}')
sys.exit(0)
# Nessuna config trovata
print('latest|')