summaryrefslogtreecommitdiffstats
path: root/.github/scripts/gen-matrix-repoconfig.py
diff options
context:
space:
mode:
Diffstat (limited to '.github/scripts/gen-matrix-repoconfig.py')
-rwxr-xr-x.github/scripts/gen-matrix-repoconfig.py27
1 files changed, 27 insertions, 0 deletions
diff --git a/.github/scripts/gen-matrix-repoconfig.py b/.github/scripts/gen-matrix-repoconfig.py
new file mode 100755
index 00000000..264cd53e
--- /dev/null
+++ b/.github/scripts/gen-matrix-repoconfig.py
@@ -0,0 +1,27 @@
+#!/usr/bin/env python3
+
+import json
+
+from ruamel.yaml import YAML
+
+yaml = YAML(typ='safe')
+entries = list()
+
+with open('.github/data/distros.yml') as f:
+ data = yaml.load(f)
+
+for i, v in enumerate(data['include']):
+ if 'packages' in data['include'][i]:
+ entries.append({
+ 'distro': data['include'][i]['distro'],
+ 'version': data['include'][i]['version'],
+ 'pkgclouddistro': data['include'][i]['packages']['repo_distro'],
+ 'format': data['include'][i]['packages']['type'],
+ 'base_image': data['include'][i]['base_image'] if 'base_image' in data['include'][i] else ':'.join([data['include'][i]['distro'], data['include'][i]['version']]),
+ 'platform': data['platform_map']['amd64'],
+ 'arches': ' '.join(['"' + x + '"' for x in data['include'][i]['packages']['arches']])
+ })
+
+entries.sort(key=lambda k: (k['distro'], k['version']))
+matrix = json.dumps({'include': entries}, sort_keys=True)
+print(matrix)