mirror of
https://github.com/windmill-labs/windmill.git
synced 2026-08-25 16:02:11 +00:00
update hub script
This commit is contained in:
@@ -0,0 +1 @@
|
||||
-- Add down migration script here
|
||||
@@ -0,0 +1,15 @@
|
||||
-- Add up migration script here
|
||||
UPDATE script SET content = 'import wmill from "https://deno.land/x/wmill@v1.151.0/main.ts";
|
||||
export async function main() {
|
||||
await run(
|
||||
"workspace", "add", "__automation", "admins", Deno.env.get("BASE_INTERNAL_URL") + "/", "--token", Deno.env.get("WM_TOKEN"));
|
||||
|
||||
await run("hub", "pull");
|
||||
}
|
||||
|
||||
async function run(...cmd: string[]) {
|
||||
console.log("Running \"" + cmd.join('' '') + "\"");
|
||||
await wmill.parse(cmd);
|
||||
}', summary = 'Synchronize Hub Resource types with instance',
|
||||
description = 'Basic administrative script to sync latest resource types from hub to share to every workspace. Recommended to run at least once. On a schedule by default.'
|
||||
WHERE hash = -28028598712388162 AND workspace_id = 'admins';
|
||||
+7
-6
@@ -62,6 +62,12 @@ async function pull(opts: GlobalOptions) {
|
||||
});
|
||||
|
||||
for (const x of list) {
|
||||
try {
|
||||
x.schema = JSON.parse(x.schema);
|
||||
} catch (e) {
|
||||
log.info("failed to parse schema for " + x.name);
|
||||
continue;
|
||||
}
|
||||
if (
|
||||
resourceTypes.find(
|
||||
(y) =>
|
||||
@@ -74,12 +80,7 @@ async function pull(opts: GlobalOptions) {
|
||||
continue;
|
||||
}
|
||||
log.info("syncing " + x.name);
|
||||
try {
|
||||
x.schema = JSON.parse(x.schema);
|
||||
} catch (e) {
|
||||
log.info("failed to parse schema for " + x.name);
|
||||
continue;
|
||||
}
|
||||
|
||||
await pushResourceType(
|
||||
workspace.workspaceId,
|
||||
x.name + ".resource-type.json",
|
||||
|
||||
Reference in New Issue
Block a user