From e1635ec762cb5c8fe8daf05b9e2aac4fbeecb162 Mon Sep 17 00:00:00 2001 From: Ruben Fiszel Date: Tue, 14 Feb 2023 15:00:02 +0100 Subject: [PATCH] fix: update hub sync script --- ...230214135931_migrate_hub_sync_script.down.sql | 1 + ...20230214135931_migrate_hub_sync_script.up.sql | 16 ++++++++++++++++ 2 files changed, 17 insertions(+) create mode 100644 backend/migrations/20230214135931_migrate_hub_sync_script.down.sql create mode 100644 backend/migrations/20230214135931_migrate_hub_sync_script.up.sql diff --git a/backend/migrations/20230214135931_migrate_hub_sync_script.down.sql b/backend/migrations/20230214135931_migrate_hub_sync_script.down.sql new file mode 100644 index 0000000000..d2f607c5b8 --- /dev/null +++ b/backend/migrations/20230214135931_migrate_hub_sync_script.down.sql @@ -0,0 +1 @@ +-- Add down migration script here diff --git a/backend/migrations/20230214135931_migrate_hub_sync_script.up.sql b/backend/migrations/20230214135931_migrate_hub_sync_script.up.sql new file mode 100644 index 0000000000..ca01842dbf --- /dev/null +++ b/backend/migrations/20230214135931_migrate_hub_sync_script.up.sql @@ -0,0 +1,16 @@ +-- Add up migration script here +-- Add up migration script here +UPDATE script SET content = 'import wmill from "https://deno.land/x/wmill@v1.63.1/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 admins workspace', +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'; \ No newline at end of file