generated from kasmtech/workspaces_registry_template
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Initial commit for schema version 1.1
- Loading branch information
Showing
11 changed files
with
175 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
const fs = require("fs"); | ||
const glob = require("glob"); | ||
|
||
const baseversion = '1.16' | ||
const tag = ':develop' | ||
|
||
const version = baseversion + '.x' | ||
const tagversion = baseversion + '.0' | ||
|
||
glob("../workspaces/**/workspace.json", async function (err, files) { | ||
if (err) { | ||
console.log( | ||
"cannot read the folder, something goes wrong with glob", | ||
err | ||
); | ||
} | ||
|
||
|
||
for (const file of files) { | ||
|
||
let filedata = fs.readFileSync(file); | ||
let parsed = JSON.parse(filedata); | ||
|
||
const current = parsed.compatibility[parsed.compatibility.length - 1] | ||
const image = current.image.split(':')[0] | ||
|
||
const exists = parsed.compatibility.findIndex(el => el.version === version) | ||
|
||
let details = { | ||
version, | ||
image: image + tag, | ||
uncompressed_size_mb: 0, | ||
available_tags: [ | ||
'develop', | ||
tagversion, | ||
tagversion + '-rolling-weekly', | ||
tagversion + '-rolling-daily' | ||
] | ||
} | ||
|
||
if (exists === -1) { | ||
parsed.compatibility.push(details) | ||
fs.writeFileSync(file, JSON.stringify(parsed, null, 2)); | ||
} | ||
} | ||
|
||
|
||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
const fs = require("fs"); | ||
const glob = require("glob"); | ||
const { execSync } = require('child_process'); | ||
|
||
|
||
glob("../workspaces/**/workspace.json", function (err, files) { | ||
if (err) { | ||
console.log( | ||
"cannot read the folder, something goes wrong with glob", | ||
err | ||
); | ||
} | ||
|
||
let total = 0 | ||
for (const file of files) { | ||
|
||
let filedata = fs.readFileSync(file); | ||
let parsed = JSON.parse(filedata); | ||
|
||
|
||
parsed.compatibility.forEach((element, index) => { | ||
total++ | ||
if (element.uncompressed_size_mb === 0) { | ||
execSync('docker image prune -a -f') | ||
execSync('docker system prune --all --force --volumes') | ||
|
||
let pull = execSync('docker pull ' + element.image) | ||
// console.log(pull) | ||
let inspect = execSync('docker inspect -f "{{ .Size }}" ' + element.image) | ||
let size = Math.round(inspect / 1000000) | ||
let remove = execSync('docker rmi ' + element.image) | ||
console.log(remove) | ||
parsed.compatibility[index].uncompressed_size_mb = size | ||
console.log('Write file: ' + parsed.friendly_name + ' - ' + element.version + ': ' + size) | ||
fs.writeFileSync(file, JSON.stringify(parsed, null, 2)); | ||
} else { | ||
console.log(parsed.friendly_name + ' - ' + element.version + ': skipped') | ||
} | ||
|
||
}) | ||
|
||
} | ||
console.log(total + ' entries processed') | ||
|
||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
const fs = require("fs"); | ||
const glob = require("glob"); | ||
|
||
glob("../workspaces/**/workspace.json", async function (err, files) { | ||
if (err) { | ||
console.log( | ||
"cannot read the folder, something goes wrong with glob", | ||
err | ||
); | ||
} | ||
|
||
|
||
for (const file of files) { | ||
|
||
let filedata = fs.readFileSync(file); | ||
let parsed = JSON.parse(filedata); | ||
delete parsed.compatibility | ||
|
||
parsed.compatibility = [] | ||
|
||
let details = { | ||
version: '1.16.x', | ||
image: parsed.name, | ||
uncompressed_size_mb: parsed.uncompressed_size_mb | ||
} | ||
|
||
parsed.compatibility.push(details) | ||
delete parsed.uncompressed_size_mb | ||
delete parsed.name | ||
|
||
fs.writeFileSync(file, JSON.stringify(parsed, null, 2)); | ||
} | ||
|
||
|
||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters