0
0
Fork 0
mirror of https://github.com/netdata/netdata.git synced 2025-05-12 12:42:09 +00:00
netdata_netdata/.github/scripts/gen-matrix-build.py
Austin S. Hemmelgarn cf199ac034
Update workflows to use $GITHUB_OUTPUT instead of ::set-output:: ()
* Update workflows to use $GITHUB_OUTPUT instead of ::set-output::

* Fix python code.

* Fix handling of python-based build matrix generation.
2022-12-02 10:17:41 -05:00

34 lines
781 B
Python
Executable file

#!/usr/bin/env python3
import json
from ruamel.yaml import YAML
yaml = YAML(typ='safe')
entries = []
with open('.github/data/distros.yml') as f:
data = yaml.load(f)
for i, v in enumerate(data['include']):
e = {
'artifact_key': v['distro'] + str(v['version']).replace('.', ''),
'version': v['version'],
}
if 'base_image' in v:
e['distro'] = ':'.join([v['base_image'], str(v['version'])])
else:
e['distro'] = ':'.join([v['distro'], str(v['version'])])
if 'env_prep' in v:
e['env_prep'] = v['env_prep']
if 'jsonc_removal' in v:
e['jsonc_removal'] = v['jsonc_removal']
entries.append(e)
entries.sort(key=lambda k: k['distro'])
matrix = json.dumps({'include': entries}, sort_keys=True)
print(matrix)