From 9f8393bd3ef77d8eecc913180ee02f280f0e86d0 Mon Sep 17 00:00:00 2001 From: Stig Ofstad Date: Thu, 13 Jun 2024 14:52:08 +0200 Subject: [PATCH] ci: fix broken demo deploy --- .github/workflows/deploy-to-radix.yaml | 6 +- .github/workflows/on-release.yaml | 10 +- .gitignore | 1 + _schema/blueprint.schema.json | 63 ----------- _schema/recipe.schema.json | 65 ----------- _schema/recipeConfig.schema.json | 104 ------------------ .../data_source_templates/DemoDataSource.json | 17 +++ .../ExtraDataSource.json | 16 +++ .../app/data_source_templates/WorkflowDS.json | 16 +++ .../app/data_source_templates/system_DS.json | 15 +++ .../DemoDataSource.json | 17 +++ .../ExtraDataSource.json | 16 +++ .../WorkflowDS.json | 16 +++ .../system_DS.json | 15 +++ example/reset-app.sh | 16 +++ 15 files changed, 154 insertions(+), 239 deletions(-) delete mode 100644 _schema/blueprint.schema.json delete mode 100644 _schema/recipe.schema.json delete mode 100644 _schema/recipeConfig.schema.json create mode 100644 example/app/data_source_templates/DemoDataSource.json create mode 100644 example/app/data_source_templates/ExtraDataSource.json create mode 100644 example/app/data_source_templates/WorkflowDS.json create mode 100644 example/app/data_source_templates/system_DS.json create mode 100644 example/app/data_source_templates_radix_demo/DemoDataSource.json create mode 100644 example/app/data_source_templates_radix_demo/ExtraDataSource.json create mode 100644 example/app/data_source_templates_radix_demo/WorkflowDS.json create mode 100644 example/app/data_source_templates_radix_demo/system_DS.json diff --git a/.github/workflows/deploy-to-radix.yaml b/.github/workflows/deploy-to-radix.yaml index a00621a5b..e0fb034f0 100644 --- a/.github/workflows/deploy-to-radix.yaml +++ b/.github/workflows/deploy-to-radix.yaml @@ -91,9 +91,11 @@ jobs: run: yarn install - name: Reset application - working-directory: ./example + working-directory: ./application env: RESET_APP_TOKEN: ${{ env.RESET_APP_TOKEN }} + MONGO_PASSWORD: ${{ secrets.MONGO_PASSWORD_DEV }} run: | - sleep 30 # Wait for the services to be restarted + rm -rf app/data_source_templates + mv app/data_source_templates_radix_demo app/data_source_templates ./reset-app.sh dev ${{ env.RESET_APP_TOKEN }} \ No newline at end of file diff --git a/.github/workflows/on-release.yaml b/.github/workflows/on-release.yaml index cb9e6e42f..dea20b88d 100644 --- a/.github/workflows/on-release.yaml +++ b/.github/workflows/on-release.yaml @@ -26,8 +26,8 @@ jobs: with: image-tags: latest,${{ inputs.release-tag }} - # deploy: - # needs: publish-image - # uses: ./.github/workflows/deploy-to-radix.yaml - # with: - # radix-environment: "dev" \ No newline at end of file + deploy: + needs: publish-image + uses: ./.github/workflows/deploy-to-radix.yaml + with: + radix-environment: "dev" \ No newline at end of file diff --git a/.gitignore b/.gitignore index f684ff606..5f4a4c5b3 100644 --- a/.gitignore +++ b/.gitignore @@ -19,3 +19,4 @@ packages/dm-core-plugins/src/build.css *.tsbuildinfo /example/job_handlers/reverse_description/results/ +/example/app/data_sources/ diff --git a/_schema/blueprint.schema.json b/_schema/blueprint.schema.json deleted file mode 100644 index 1f4763a47..000000000 --- a/_schema/blueprint.schema.json +++ /dev/null @@ -1,63 +0,0 @@ -{ - "type": "object", - "description": "Schema for writing correct blueprints", - "$defs": { - "type": { - "type": "string", - "enum": ["CORE:Blueprint", "dmss://system/SIMOS/Blueprint"] - }, - "attributeTypes": { - "type": "string", - "enum": [ - "CORE:BlueprintAttribute", - "dmss://system/SIMOS/BlueprintAttribute" - ] - } - }, - "$schema": "http://json-schema.org/draft-07/schema#", - "additionalItems": false, - "properties": { - "name": { - "type": "string" - }, - "type": { - "$ref": "#/$defs/type" - }, - "description": { - "type": "string" - }, - "attributes": { - "type": "array", - "items": { - "type": "object", - "properties": { - "name": { - "type": "string" - }, - "type": { - "$ref": "#/$defs/attributeTypes" - }, - "description": { - "type": "string" - }, - "attributeType": { - "type": "string" - }, - "default": true, - "dimensions": { - "type": "string" - }, - "label": { - "type": "string" - }, - "optional": { - "type": "boolean" - } - }, - "required": ["type", "attributeType"] - } - } - }, - "required": ["name", "type"], - "title": "Blueprint schema" -} diff --git a/_schema/recipe.schema.json b/_schema/recipe.schema.json deleted file mode 100644 index fb5a86e75..000000000 --- a/_schema/recipe.schema.json +++ /dev/null @@ -1,65 +0,0 @@ -{ - "type": "object", - "description": "Schema for writing correct blueprints", - "$defs": { - "type": { - "type": "string", - "enum": ["CORE:RecipeLink", "dmss://system/SIMOS/RecipeLink"] - }, - "uiRecipes": { - "type": "string", - "enum": ["CORE:UiRecipe", "dmss://system/SIMOS/UiRecipe"] - } - }, - "$schema": "http://json-schema.org/draft-07/schema#", - "additionalItems": false, - "properties": { - "type": { - "$ref": "#/$defs/type" - }, - "_blueprintPath_": { - "type": "string" - }, - "initialUiRecipe": { - "type": "object", - "properties": { - "name": { - "type": "string" - }, - "type": { - "$ref": "#/$defs/uiRecipes" - }, - "config": { - "$ref": "recipeConfig.schema.json" - }, - "plugin": { - "type": "string" - } - }, - "required": ["type", "plugin", "config"] - }, - "uiRecipes": { - "type": "array", - "items": { - "type": "object", - "properties": { - "name": { - "type": "string" - }, - "type": { - "type": "string" - }, - "description": { - "type": "string" - }, - "plugin": { - "type": "string" - } - }, - "required": ["type", "plugin"] - } - } - }, - "required": ["type", "_blueprintPath_"], - "title": "Blueprint schema" -} diff --git a/_schema/recipeConfig.schema.json b/_schema/recipeConfig.schema.json deleted file mode 100644 index eb0a7f42c..000000000 --- a/_schema/recipeConfig.schema.json +++ /dev/null @@ -1,104 +0,0 @@ -{ - "type": "object", - "$schema": "http://json-schema.org/draft-07/schema#", - "additionalItems": false, - "allOf": [ - { - "if": { - "properties": { - "type": { - "enum": ["PLUGINS:dm-core-plugins/form/FormInput"] - } - }, - "required": ["type"] - }, - "then": { - "properties": { - "fields": { - "type": "array", - "items": { - "type": "string" - } - }, - "readOnly": { - "type": "boolean" - } - }, - "required": [] - } - }, - { - "if": { - "properties": { - "type": { - "enum": ["PLUGINS:dm-core-plugins/view_selector/ViewSelectorConfig"] - } - }, - "required": ["type"] - }, - "then": { - "properties": { - "asSidebar": { - "type": "boolean" - }, - "childTabsOnRender": { - "type": "boolean" - }, - "items": { - "type": "array", - "items": { - "type": "object", - "properties": { - "type": { - "type": "string" - }, - "label": { - "type": "string" - }, - "scope": { - "type": "string" - }, - "viewConfig": { - "type": "object", - "properties": { - "type": { - "type": "string" - }, - "recipe": { - "type": "object", - "properties": { - "name": { - "type": "string" - }, - "type": { - "type": "string" - }, - "description": { - "type": "string" - }, - "plugin": { - "type": "string" - } - } - } - } - } - } - } - } - }, - "required": ["items"] - } - } - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "PLUGINS:dm-core-plugins/form/FormInput", - "PLUGINS:dm-core-plugins/view_selector/ViewSelectorConfig" - ] - } - }, - "title": "View Config recipe schema" -} diff --git a/example/app/data_source_templates/DemoDataSource.json b/example/app/data_source_templates/DemoDataSource.json new file mode 100644 index 000000000..8e70f6f7e --- /dev/null +++ b/example/app/data_source_templates/DemoDataSource.json @@ -0,0 +1,17 @@ +{ + "name": "DemoDataSource", + "global_folders": ["global"], + "repositories": { + "exampleRepo": { + "type": "mongo-db", + "collection": "default", + "data_types": ["blob"], + "database": "DemoDataSource", + "host": "db", + "password": "maf", + "port": 27017, + "tls": false, + "username": "maf" + } + } +} diff --git a/example/app/data_source_templates/ExtraDataSource.json b/example/app/data_source_templates/ExtraDataSource.json new file mode 100644 index 000000000..5dff5edd3 --- /dev/null +++ b/example/app/data_source_templates/ExtraDataSource.json @@ -0,0 +1,16 @@ +{ + "name": "ExtraDataSource", + "repositories": { + "exampleRepo": { + "type": "mongo-db", + "collection": "default", + "data_types": [], + "database": "ExtraDataSource", + "host": "db", + "password": "maf", + "port": 27017, + "tls": false, + "username": "maf" + } + } +} diff --git a/example/app/data_source_templates/WorkflowDS.json b/example/app/data_source_templates/WorkflowDS.json new file mode 100644 index 000000000..257651673 --- /dev/null +++ b/example/app/data_source_templates/WorkflowDS.json @@ -0,0 +1,16 @@ +{ + "name": "WorkflowDS", + "repositories": { + "forecastDB": { + "type": "mongo-db", + "host": "db", + "port": 27017, + "username": "maf", + "password": "maf", + "tls": false, + "database": "workflowDS", + "collection": "default", + "data_types": [] + } + } +} diff --git a/example/app/data_source_templates/system_DS.json b/example/app/data_source_templates/system_DS.json new file mode 100644 index 000000000..d009ece86 --- /dev/null +++ b/example/app/data_source_templates/system_DS.json @@ -0,0 +1,15 @@ +{ + "name": "system", + "repositories": { + "a": { + "type": "mongo-db", + "host": "db", + "port": 27017, + "username": "maf", + "password": "maf", + "tls": false, + "database": "DMSS-core", + "collection": "DMSS-core" + } + } +} diff --git a/example/app/data_source_templates_radix_demo/DemoDataSource.json b/example/app/data_source_templates_radix_demo/DemoDataSource.json new file mode 100644 index 000000000..eec5bd35b --- /dev/null +++ b/example/app/data_source_templates_radix_demo/DemoDataSource.json @@ -0,0 +1,17 @@ +{ + "name": "DemoDataSource", + "global_folders": ["global"], + "repositories": { + "exampleRepo": { + "type": "mongo-db", + "collection": "default", + "data_types": ["blob"], + "database": "DemoDataSource", + "host": "db", + "password": "$MONGO_PASSWORD", + "port": 27017, + "tls": false, + "username": "maf" + } + } +} diff --git a/example/app/data_source_templates_radix_demo/ExtraDataSource.json b/example/app/data_source_templates_radix_demo/ExtraDataSource.json new file mode 100644 index 000000000..6437c8718 --- /dev/null +++ b/example/app/data_source_templates_radix_demo/ExtraDataSource.json @@ -0,0 +1,16 @@ +{ + "name": "ExtraDataSource", + "repositories": { + "exampleRepo": { + "type": "mongo-db", + "collection": "default", + "data_types": [], + "database": "ExtraDataSource", + "host": "db", + "password": "$MONGO_PASSWORD", + "port": 27017, + "tls": false, + "username": "maf" + } + } +} diff --git a/example/app/data_source_templates_radix_demo/WorkflowDS.json b/example/app/data_source_templates_radix_demo/WorkflowDS.json new file mode 100644 index 000000000..9ecb04ab0 --- /dev/null +++ b/example/app/data_source_templates_radix_demo/WorkflowDS.json @@ -0,0 +1,16 @@ +{ + "name": "WorkflowDS", + "repositories": { + "forecastDB": { + "type": "mongo-db", + "host": "db", + "port": 27017, + "username": "maf", + "password": "$MONGO_PASSWORD", + "tls": false, + "database": "workflowDS", + "collection": "default", + "data_types": [] + } + } +} diff --git a/example/app/data_source_templates_radix_demo/system_DS.json b/example/app/data_source_templates_radix_demo/system_DS.json new file mode 100644 index 000000000..4598425aa --- /dev/null +++ b/example/app/data_source_templates_radix_demo/system_DS.json @@ -0,0 +1,15 @@ +{ + "name": "system", + "repositories": { + "a": { + "type": "mongo-db", + "host": "db", + "port": 27017, + "username": "maf", + "password": "$MONGO_PASSWORD", + "tls": false, + "database": "DMSS-core", + "collection": "DMSS-core" + } + } +} diff --git a/example/reset-app.sh b/example/reset-app.sh index 52bbb1686..b2336134f 100755 --- a/example/reset-app.sh +++ b/example/reset-app.sh @@ -39,8 +39,24 @@ service_is_ready() { done echo "DMSS is ready!" } + +# Replace any $ENV_VAR in file. Write to tmp before moving back +substitute_env_in_file() { + TEMPFILE=$(mktemp) + envsubst < $1 > $TEMPFILE + mv $TEMPFILE $1 +} + service_is_ready +mkdir -p app/data_sources +cp -r app/data_source_templates/* app/data_sources/ + +for ds_file in ./app/data_sources/*; do + substitute_env_in_file $ds_file + dm --url "$VITE_DMSS_URL" --token "$TOKEN" --force ds import $ds_file +done + main () { for ds_file in ./app/data_sources/*; do dm --url "$VITE_DMSS_URL" --token "$TOKEN" --force ds import $ds_file