Updates to files and upgrade advice
This commit is contained in:
parent
225926bdc1
commit
39bac68494
25
README.md
25
README.md
@ -253,11 +253,32 @@ In the new branch, make any updates that are needed, when the changes are commit
|
||||
|
||||
Kasm Workspaces will automatically pull the version of the schema that it understands.
|
||||
|
||||
**Updating to 1.17.x support**
|
||||
If only the latest version is building (so 1.1 works but 1.0 doesn't), open build_all_branches.sh, search for `echo "All branches:` and check if there is `git fetch --all` on the line underneath, if not, add it.
|
||||
|
||||
1.17.x changed the schema from 1.0 to 1.1, the main changes to this are the compatibility changes from a simple array to an array of objects, this allows us to tie the image used and the image size to the kasm version.
|
||||
**Updating to 1.16.x support**
|
||||
|
||||
1.16.x changed the schema from 1.0 to 1.1, the main changes to this are the compatibility changes from a simple array to an array of objects, this allows us to tie the image used and the image size to the kasm version.
|
||||
In addition the top level name is removed as is top level uncompessed_size_mb as these are now available in the compatibility matrix (name is called image).
|
||||
|
||||
If you have an older version you will probably need to update the following files:
|
||||
* build_all_branches.sh
|
||||
* processing/processjson.js
|
||||
* site/components/Workspace.js
|
||||
* site/pages/index.js
|
||||
* site/pages/new/[[..workspace]].js
|
||||
|
||||
If you have a lot of workspaces (or just want an easier way to update your workspaces), there is an update file in processing called `update_1_0_to_1_1.js` copy that across to your own install, edit it and make sure the tags etc match your install. If you don't want to use channels, you can remove the available_tags section entirely.
|
||||
|
||||
Then to use it, create a 1.1 branch from your current 1.0 source, then in a terminal:
|
||||
|
||||
```
|
||||
cd processing
|
||||
npm install
|
||||
node update_1_0_to_1_1.js
|
||||
```
|
||||
|
||||
This will convert your existing workspaces to a 1.1 compatible format.
|
||||
|
||||
## Channels
|
||||
Schema 1.1 added the concept of channels. Each registry can specify the channels they support, these are defined by the tags an image has. For example you might have develop, 1.17.0 and 1.17.0-rolling-daily. When the registry json is built it loops through all the workspaces and generates a list of all the possible "Channels" (tags) that are listed in compatibility.available_tags. Available tags is an optional list, if you don't include it on any of the workspaces then your registry will work as before without presenting the end user with a channels option. You shouldn't mix and match though, if you add available tags to 1 workspace, you should add available tags to all workspaces.
|
||||
|
||||
|
@ -10,6 +10,7 @@ touch base/.nojekyll
|
||||
|
||||
# Generating documentation for each other branch in a subdirectory
|
||||
echo "All branches:"
|
||||
git fetch --all
|
||||
echo "$(git branch --remotes --format '%(refname:lstrip=3)' | grep -Ev '^(HEAD|develop|gh-pages)$')"
|
||||
for BRANCH in $(git branch --remotes --format '%(refname:lstrip=3)' | grep -Ev '^(HEAD|develop|gh-pages)$'); do
|
||||
SANITIZED_BRANCH="$(echo $BRANCH | sed 's/\//_/g')"
|
||||
|
@ -41,7 +41,7 @@ glob("**/workspace.json", async function (err, files) {
|
||||
|
||||
let parsed = JSON.parse(filedata);
|
||||
parsed.sha = hash.hash;
|
||||
console.log(parsed.name + ' added')
|
||||
console.log(parsed.friendly_name + ' added')
|
||||
parsed.compatibility.forEach((element, index) => {
|
||||
if ('available_tags' in element) {
|
||||
element.available_tags.forEach((el) => {
|
||||
|
41
processing/update_1_0_to_1_1.js
Normal file
41
processing/update_1_0_to_1_1.js
Normal file
@ -0,0 +1,41 @@
|
||||
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.split(':')[0] + ':1.16.0-rolling-daily',
|
||||
uncompressed_size_mb: 0,
|
||||
available_tags: [
|
||||
'develop',
|
||||
'1.16.0',
|
||||
'1.16.0-rolling-weekly',
|
||||
'1.16.0-rolling-daily'
|
||||
]
|
||||
}
|
||||
|
||||
parsed.compatibility.push(details)
|
||||
delete parsed.uncompressed_size_mb
|
||||
delete parsed.name
|
||||
|
||||
fs.writeFileSync(file, JSON.stringify(parsed, null, 2));
|
||||
}
|
||||
|
||||
|
||||
});
|
@ -6,12 +6,12 @@ function Workspace({ Component, pageProps, workspace }) {
|
||||
const viewexample = (workspace) => {
|
||||
router.push({
|
||||
pathname: '/new/[workspace]',
|
||||
query: { workspace: btoa(workspace.name)}
|
||||
query: { workspace: btoa(workspace.friendly_name)}
|
||||
})
|
||||
}
|
||||
|
||||
return (
|
||||
<div onClick={() => viewexample(workspace)} className="w-[245px] h-[88px] transition-all relative cursor-pointer group flex p-2 items-center justify-center bg-slate-100/90 shadow rounded hover:shadow-xl hover:bg-gradient-to-r hover:from-slate-900 hover:to-cyan-800 hover:text-white">
|
||||
<div onClick={() => viewexample(workspace)} className="w-[245px] h-[88px] transition-all relative cursor-pointer group flex p-2 items-center justify-center bg-slate-100/90 shadow rounded hover:shadow-xl hover:bg-gradient-to-r hover:from-[#162d48] hover:to-[#2980b9] hover:text-white">
|
||||
<div className="w-full h-full">
|
||||
<div className="show-grid flex h-full items-center">
|
||||
<div className="kasmcard-img flex h-full mx-4 items-center justify-center">
|
||||
|
@ -18,7 +18,7 @@ export default function Home({ searchText }) {
|
||||
workspaces.workspaces.forEach((workspace) => {
|
||||
if(workspace.compatibility) {
|
||||
workspace.compatibility.forEach((v) => {
|
||||
const value = parseFloat(v)
|
||||
const value = parseFloat(v.version)
|
||||
if(wsversions.indexOf(value) === -1) {
|
||||
wsversions.push(value)
|
||||
}
|
||||
@ -43,7 +43,7 @@ export default function Home({ searchText }) {
|
||||
}
|
||||
|
||||
let filteredworkspaces = workspaces && workspaces.workspaces && workspaces.workspaces.length > 0 ? [...workspaces.workspaces] : [];
|
||||
filteredworkspaces = filteredworkspaces.filter((v) => v.compatibility.some((el) => el === version + '.x'))
|
||||
filteredworkspaces = filteredworkspaces.filter((v) => v.compatibility.some((el) => el.version === version + '.x'))
|
||||
const lowerSearch = searchText && searchText.toLowerCase();
|
||||
if (searchText && searchText !== "") {
|
||||
filteredworkspaces = filteredworkspaces.filter((i) => {
|
||||
|
@ -10,7 +10,7 @@ import allworkspaces from '../../../public/list.json'
|
||||
export async function getStaticPaths() {
|
||||
let paths = allworkspaces.workspaces.map(workspace => ({
|
||||
params: {
|
||||
workspace: [btoa(workspace.name)]
|
||||
workspace: [btoa(workspace.friendly_name)]
|
||||
}
|
||||
}))
|
||||
paths.push({
|
||||
@ -47,7 +47,6 @@ export default function New({ workspace }) {
|
||||
friendly_name: null,
|
||||
image_src: null,
|
||||
description: null,
|
||||
name: null,
|
||||
cores: 2,
|
||||
memory: 2768,
|
||||
gpu_count: 0,
|
||||
@ -75,7 +74,7 @@ export default function New({ workspace }) {
|
||||
setCombined(defaultState)
|
||||
}
|
||||
else if (workspace && workspace[0]) {
|
||||
const workspaceDetails = allworkspaces.workspaces.find(el => el.name === atob(workspace[0]))
|
||||
const workspaceDetails = allworkspaces.workspaces.find(el => el.friendly_name === atob(workspace[0]))
|
||||
delete workspaceDetails['sha']
|
||||
description.current.value = workspaceDetails.description
|
||||
name.current.value = workspaceDetails.name
|
||||
@ -296,7 +295,7 @@ export default function New({ workspace }) {
|
||||
<div className='w-full lg:w-1/2 p-16 bg-slate-100'>
|
||||
<Workspace workspace={combined} icon={icon} inlineImage={inlineImage} />
|
||||
<pre className='my-8 overflow-y-auto text-xs'>{JSON.stringify(displayWorkspace(), null, 2)}</pre>
|
||||
<button onClick={downloadZip} className='p-4 relative z-10 px-5 bg-cyan-700 border-t border-white/20 border-solid hover:bg-slate-900 transition m-2 rounded items-center text-white/70 flex cursor-pointer'>Download</button>
|
||||
<button onClick={downloadZip} className='p-4 relative z-10 px-5 bg-[#2980b9] border-t border-white/20 border-solid hover:bg-slate-900 transition m-2 rounded items-center text-white/70 flex cursor-pointer'>Download</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
Loading…
Reference in New Issue
Block a user