-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathget-image-matrix.php
More file actions
executable file
·40 lines (35 loc) · 1.36 KB
/
get-image-matrix.php
File metadata and controls
executable file
·40 lines (35 loc) · 1.36 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
#!/usr/bin/env php
<?php
$path = realpath(__DIR__);
$imagesFile = $path . '/images.json';
$result = [];
try {
$images = \json_decode((string)file_get_contents($imagesFile), true, JSON_THROW_ON_ERROR);
foreach($images as $image) {
$item = [
"lookup-name" => $image['lookup-name'] ?? '',
"gh-image-basename" => $image['gh-image-basename'] ?? '',
"gh-image-basetag" => $image['gh-image-basetag'] ?? 'latest',
"gh-image-name" => $image['gh-image-name'] ?? '',
"context" => $image['context'] ?? '',
"version-full" => $image['full'] ?? '',
"version-short" => $image['short'] ?? '',
"platforms" => $image['platforms'] ?? '',
];
if ($item['lookup-name'] === ''
|| $item['gh-image-basename'] === ''
|| $item['gh-image-name'] === ''
|| $item['version-full'] === ''
|| $item['version-short'] === ''
|| $item['context'] === ''
|| $item['platforms'] === ''
|| !file_exists(__DIR__ . '/' . $item['context'] . '/Dockerfile')
) {
// skip - invalid entry
continue;
}
$result['include'][] = $item;
}
} catch(\Throwable) {}
//echo str_replace('"', '\"', \json_encode($result, JSON_THROW_ON_ERROR));
echo \json_encode($result, JSON_THROW_ON_ERROR);