From 5c357bc8b2d4af2d8350c18baae485d0761fb7bc Mon Sep 17 00:00:00 2001 From: Max Shaposhnik Date: Tue, 2 Jan 2018 10:57:57 +0200 Subject: [PATCH] Move image name from location to content field in dockerimage recipes (#8076) --- .../e2e/stacks/list-stacks/list-stack.mock.js | 2 +- .../stack-details/stack-details.mock.js | 2 +- .../list-workspaces/list-workspaces.mock.js | 2 +- .../stack-details/stack-validation.service.ts | 12 ++-- .../workspace-select-stack.controller.ts | 2 +- .../api/complete-factory-template.ts | 4 +- .../docker-image-environment-manager.spec.ts | 2 +- .../lib/src/spi/docker/recipebuilder.ts | 2 +- .../src/main/resources/stacks.json | 64 +++++++++---------- ...dockerimage_recipe_location_to_content.sql | 16 +++++ 10 files changed, 62 insertions(+), 46 deletions(-) create mode 100644 wsmaster/che-core-sql-schema/src/main/resources/che-schema/6.0.0/10__move_dockerimage_recipe_location_to_content.sql diff --git a/dashboard/e2e/stacks/list-stacks/list-stack.mock.js b/dashboard/e2e/stacks/list-stacks/list-stack.mock.js index 145c0035b2..3ca3d2c8a1 100644 --- a/dashboard/e2e/stacks/list-stacks/list-stack.mock.js +++ b/dashboard/e2e/stacks/list-stacks/list-stack.mock.js @@ -29,7 +29,7 @@ exports.listStacksTheeEntries = function () { 'installers': ['org.eclipse.che.exec', 'org.eclipse.che.terminal', 'org.eclipse.che.ws-agent', 'org.eclipse.che.ssh'], 'attributes': {'memoryLimitBytes': '2147483648'} } - }, 'recipe': {'location': 'codenvy/node', 'type': 'dockerimage'} + }, 'recipe': {'content': 'codenvy/node', 'type': 'dockerimage'} } }, 'commands': [], 'projects': [], 'defaultEnv': 'default', 'name': 'default', 'links': [] }; diff --git a/dashboard/e2e/stacks/stack-details/stack-details.mock.js b/dashboard/e2e/stacks/stack-details/stack-details.mock.js index 30d9ab1c85..310efb08c1 100644 --- a/dashboard/e2e/stacks/stack-details/stack-details.mock.js +++ b/dashboard/e2e/stacks/stack-details/stack-details.mock.js @@ -26,7 +26,7 @@ exports.dockerimageStack = function () { 'installers': ['org.eclipse.che.exec', 'org.eclipse.che.terminal', 'org.eclipse.che.ws-agent', 'org.eclipse.che.ssh'], 'attributes': {'memoryLimitBytes': '2147483648'} } - }, 'recipe': {'location': 'eclipse/node', 'type': 'dockerimage'} + }, 'recipe': {'content': 'eclipse/node', 'type': 'dockerimage'} } }, 'commands': [], 'projects': [], 'defaultEnv': 'default', 'name': 'default', 'links': [] }; diff --git a/dashboard/e2e/workspaces/list-workspaces/list-workspaces.mock.js b/dashboard/e2e/workspaces/list-workspaces/list-workspaces.mock.js index e0b7c28170..8c9420357b 100644 --- a/dashboard/e2e/workspaces/list-workspaces/list-workspaces.mock.js +++ b/dashboard/e2e/workspaces/list-workspaces/list-workspaces.mock.js @@ -31,7 +31,7 @@ const buildWorkspacesData = function() { servers: {}, agents: ['org.eclipse.che.terminal', 'org.eclipse.che.ws-agent', 'org.eclipse.che.ssh', 'org.eclipse.che.exec'], recipe: { - location: 'eclipse/ubuntu_jdk8', + content: 'eclipse/ubuntu_jdk8', type: 'dockerimage' } } diff --git a/dashboard/src/app/stacks/stack-details/stack-validation.service.ts b/dashboard/src/app/stacks/stack-details/stack-validation.service.ts index 5d6f6e16e4..78dcfc01fa 100644 --- a/dashboard/src/app/stacks/stack-details/stack-validation.service.ts +++ b/dashboard/src/app/stacks/stack-details/stack-validation.service.ts @@ -237,9 +237,9 @@ export class StackValidationService { } if (CheRecipeTypes.DOCKERFILE === recipe.type) { - if (angular.isDefined(recipe.location) && !recipe.location) { + if (angular.isDefined(recipe.content) && !recipe.content) { isValid = false; - errors.push('Unknown recipe location.'); + errors.push('Unknown recipe content.'); } if (!recipe.contentType) { errors.push('Unknown recipe contentType.'); @@ -253,12 +253,12 @@ export class StackValidationService { errors.push('Unknown recipe contentType.'); } } else if (CheRecipeTypes.DOCKERIMAGE === recipe.type) { - if (!recipe.location) { + if (!recipe.content) { isValid = false; - errors.push('Unknown recipe location.'); - } else if (recipe.location.length > 256) { + errors.push('Unknown recipe content.'); + } else if (recipe.content.length > 256) { isValid = false; - errors.push('Location length is invalid.'); + errors.push('Content length is invalid.'); } } else if (CheRecipeTypes.OPENSHIFT === recipe.type) { if (angular.isDefined(recipe.location) && !recipe.location) { diff --git a/dashboard/src/app/workspaces/workspace-details/select-stack/workspace-select-stack.controller.ts b/dashboard/src/app/workspaces/workspace-details/select-stack/workspace-select-stack.controller.ts index a31763f1dc..a20c50ad42 100644 --- a/dashboard/src/app/workspaces/workspace-details/select-stack/workspace-select-stack.controller.ts +++ b/dashboard/src/app/workspaces/workspace-details/select-stack/workspace-select-stack.controller.ts @@ -114,7 +114,7 @@ export class WorkspaceSelectStackController { let type = this.workspaceImportedRecipe.type || 'compose'; if (type === 'dockerimage') { type = 'dockerfile'; - this.recipeScript = 'FROM ' + this.workspaceImportedRecipe.location; + this.recipeScript = 'FROM ' + this.workspaceImportedRecipe.content; this.tabName = 'stack-authoring'; } else if (angular.isDefined(this.workspaceImportedRecipe.location)) { this.tabName = 'stack-import'; diff --git a/dashboard/src/components/api/complete-factory-template.ts b/dashboard/src/components/api/complete-factory-template.ts index cf952a478a..6747196f58 100644 --- a/dashboard/src/components/api/complete-factory-template.ts +++ b/dashboard/src/components/api/complete-factory-template.ts @@ -64,7 +64,7 @@ export class CheFactoryTemplates { } }, 'recipe': { - 'location': 'codenvy/ubuntu_jdk8', + 'content': 'codenvy/ubuntu_jdk8', 'type': 'dockerimage' } } @@ -125,7 +125,7 @@ export class CheFactoryTemplates { } }, 'recipe': { - 'location': 'codenvy/ubuntu_jdk8', + 'content': 'codenvy/ubuntu_jdk8', 'type': 'dockerimage' } } diff --git a/dashboard/src/components/api/environment/docker-image-environment-manager.spec.ts b/dashboard/src/components/api/environment/docker-image-environment-manager.spec.ts index 830dfa69c9..17cd79581e 100644 --- a/dashboard/src/components/api/environment/docker-image-environment-manager.spec.ts +++ b/dashboard/src/components/api/environment/docker-image-environment-manager.spec.ts @@ -41,7 +41,7 @@ describe('DockerImageEnvironmentManager', () => { } }, 'installers': ['ws-agent', 'org.eclipse.che.ws-agent'], 'attributes': {'memoryLimitBytes': '16642998272'} } - }, 'recipe': {'location': 'codenvy/ubuntu_jdk8', 'type': 'dockerimage'} + }, 'recipe': {'content': 'codenvy/ubuntu_jdk8', 'type': 'dockerimage'} }; machines = envManager.getMachines(environment); diff --git a/dockerfiles/lib/src/spi/docker/recipebuilder.ts b/dockerfiles/lib/src/spi/docker/recipebuilder.ts index b6208971e3..fca8e87859 100644 --- a/dockerfiles/lib/src/spi/docker/recipebuilder.ts +++ b/dockerfiles/lib/src/spi/docker/recipebuilder.ts @@ -42,7 +42,7 @@ export class RecipeBuilder { } if (cheStructWorkspace.runtime.docker.image) { - return {"contentType": "text/x-dockerfile", "type": "dockerimage", "location": cheStructWorkspace.runtime.docker.image}; + return {"contentType": "text/x-dockerfile", "type": "dockerimage", "content": cheStructWorkspace.runtime.docker.image}; } else if (cheStructWorkspace.runtime.docker.content) { return { "contentType": "text/x-dockerfile", diff --git a/ide/che-core-ide-stacks/src/main/resources/stacks.json b/ide/che-core-ide-stacks/src/main/resources/stacks.json index 6c9d62e53b..c2c2aacf18 100644 --- a/ide/che-core-ide-stacks/src/main/resources/stacks.json +++ b/ide/che-core-ide-stacks/src/main/resources/stacks.json @@ -235,7 +235,7 @@ } }, "recipe": { - "location": "eclipse/ubuntu_jdk8", + "content": "eclipse/ubuntu_jdk8", "type": "dockerimage" } } @@ -305,7 +305,7 @@ } }, "recipe": { - "location": "eclipse/ubuntu_jdk8", + "content": "eclipse/ubuntu_jdk8", "type": "dockerimage" } } @@ -368,7 +368,7 @@ } }, "recipe": { - "location": "eclipse/ubuntu_android", + "content": "eclipse/ubuntu_android", "type": "dockerimage" } } @@ -439,7 +439,7 @@ } }, "recipe": { - "location": "eclipse/cpp_gcc", + "content": "eclipse/cpp_gcc", "type": "dockerimage" } } @@ -509,7 +509,7 @@ } }, "recipe": { - "location": "eclipse/dotnet_core", + "content": "eclipse/dotnet_core", "type": "dockerimage" } } @@ -587,7 +587,7 @@ } }, "recipe": { - "location": "eclipse/ubuntu_go", + "content": "eclipse/ubuntu_go", "type": "dockerimage" } } @@ -670,7 +670,7 @@ } }, "recipe": { - "location": "eclipse/hadoop-dev", + "content": "eclipse/hadoop-dev", "type": "dockerimage" } } @@ -760,7 +760,7 @@ } }, "recipe": { - "location": "eclipse/node", + "content": "eclipse/node", "type": "dockerimage" } } @@ -843,7 +843,7 @@ } }, "recipe": { - "location": "eclipse/php", + "content": "eclipse/php", "type": "dockerimage" } } @@ -973,7 +973,7 @@ } }, "recipe": { - "location": "eclipse/php:5.6", + "content": "eclipse/php:5.6", "type": "dockerimage" } } @@ -1084,7 +1084,7 @@ } }, "recipe": { - "location": "eclipse/ubuntu_python:latest", + "content": "eclipse/ubuntu_python:latest", "type": "dockerimage" } } @@ -1160,7 +1160,7 @@ } }, "recipe": { - "location": "eclipse/ruby_rails", + "content": "eclipse/ruby_rails", "type": "dockerimage" } } @@ -1228,7 +1228,7 @@ } }, "recipe": { - "location": "eclipse/debian_jdk8", + "content": "eclipse/debian_jdk8", "type": "dockerimage" } } @@ -1278,7 +1278,7 @@ } }, "recipe": { - "location": "eclipse/debian_jdk8", + "content": "eclipse/debian_jdk8", "type": "dockerimage" } } @@ -1348,7 +1348,7 @@ } }, "recipe": { - "location": "eclipse/centos_jdk8", + "content": "eclipse/centos_jdk8", "type": "dockerimage" } } @@ -1424,7 +1424,7 @@ } }, "recipe": { - "location": "eclipse/debian_jdk8", + "content": "eclipse/debian_jdk8", "type": "dockerimage" } } @@ -1512,7 +1512,7 @@ } }, "recipe": { - "location": "eclipse/php:gae", + "content": "eclipse/php:gae", "type": "dockerimage" } } @@ -1587,7 +1587,7 @@ } }, "recipe": { - "location": "eclipse/ubuntu_python:2.7", + "content": "eclipse/ubuntu_python:2.7", "type": "dockerimage" } } @@ -1659,7 +1659,7 @@ } }, "recipe": { - "location": "eclipse/ubuntu_python:gae_python2.7", + "content": "eclipse/ubuntu_python:gae_python2.7", "type": "dockerimage" } } @@ -1762,7 +1762,7 @@ } }, "recipe": { - "location": "eclipse/selenium", + "content": "eclipse/selenium", "type": "dockerimage" } } @@ -1827,7 +1827,7 @@ } }, "recipe": { - "location": "tomitribe/ubuntu_tomee_173_jdk8", + "content": "tomitribe/ubuntu_tomee_173_jdk8", "type": "dockerimage" } } @@ -1878,7 +1878,7 @@ } }, "recipe": { - "location": "eclipse/ubuntu_jdk8", + "content": "eclipse/ubuntu_jdk8", "type": "dockerimage" } } @@ -1956,7 +1956,7 @@ } }, "recipe": { - "location": "kaloyanraev/che-zendserver", + "content": "kaloyanraev/che-zendserver", "type": "dockerimage" } } @@ -2073,7 +2073,7 @@ } }, "recipe": { - "location": "eclipse/platformio:latest", + "content": "eclipse/platformio:latest", "type": "dockerimage" } } @@ -2196,7 +2196,7 @@ } }, "recipe": { - "location": "registry.centos.org/che-stacks/vertx", + "content": "registry.centos.org/che-stacks/vertx", "type": "dockerimage" } } @@ -2273,7 +2273,7 @@ "environments": { "default": { "recipe": { - "location": "registry.centos.org/che-stacks/spring-boot", + "content": "registry.centos.org/che-stacks/spring-boot", "type": "dockerimage" }, "machines": { @@ -2371,7 +2371,7 @@ "environments": { "default": { "recipe": { - "location": "registry.centos.org/che-stacks/wildfly-swarm", + "content": "registry.centos.org/che-stacks/wildfly-swarm", "type": "dockerimage" }, "machines": { @@ -2462,7 +2462,7 @@ "environments": { "default": { "recipe": { - "location": "registry.centos.org/che-stacks/centos-nodejs", + "content": "registry.centos.org/che-stacks/centos-nodejs", "type": "dockerimage" }, "machines": { @@ -2570,7 +2570,7 @@ } }, "recipe": { - "location": "eclipse/kotlin", + "content": "eclipse/kotlin", "type": "dockerimage" } } @@ -2624,7 +2624,7 @@ } }, "recipe": { - "location": "registry.centos.org/che-stacks/centos-go", + "content": "registry.centos.org/che-stacks/centos-go", "type": "dockerimage" } } @@ -2682,7 +2682,7 @@ } }, "recipe": { - "location": "registry.centos.org/che-stacks/centos-stack-base", + "content": "registry.centos.org/che-stacks/centos-stack-base", "type": "dockerimage" } } @@ -2779,7 +2779,7 @@ } }, "recipe": { - "location": "registry.centos.org/che-stacks/centos-ceylon-nodejs-dart", + "content": "registry.centos.org/che-stacks/centos-ceylon-nodejs-dart", "type": "dockerimage" } } diff --git a/wsmaster/che-core-sql-schema/src/main/resources/che-schema/6.0.0/10__move_dockerimage_recipe_location_to_content.sql b/wsmaster/che-core-sql-schema/src/main/resources/che-schema/6.0.0/10__move_dockerimage_recipe_location_to_content.sql new file mode 100644 index 0000000000..ac1e7f1aa3 --- /dev/null +++ b/wsmaster/che-core-sql-schema/src/main/resources/che-schema/6.0.0/10__move_dockerimage_recipe_location_to_content.sql @@ -0,0 +1,16 @@ +-- +-- Copyright (c) 2012-2017 Red Hat, Inc. +-- All rights reserved. This program and the accompanying materials +-- are made available under the terms of the Eclipse Public License v1.0 +-- which accompanies this distribution, and is available at +-- http://www.eclipse.org/legal/epl-v10.html +-- +-- Contributors: +-- Red Hat, Inc. - initial API and implementation +-- + +--Moving location of 'dockerimage' type recipes into content +UPDATE environment + SET content=location, + location = null +WHERE type = 'dockerimage'