K8s-like devfile naming (#13490)

`specVersion` is now `apiVersion` and is bumped to 1.0.0
`name` is now nested under the new `metadata` element.

Signed-off-by: Lukas Krejci <lkrejci@redhat.com>
7.20.x
Lukas Krejci 2019-06-10 23:23:45 +02:00 committed by GitHub
parent f601f16527
commit caae00e21b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
68 changed files with 531 additions and 186 deletions

View File

@ -17,14 +17,13 @@ import java.util.Map;
/** Defines Devfile. */
public interface Devfile {
/** Returns Specification Version. It is required. */
String getSpecVersion();
/** Returns the name of the devfile. Shortcut for {@code getMetadata().getName()}. */
default String getName() {
return getMetadata() == null ? null : getMetadata().getName();
}
/**
* Returns the name of the devfile. Workspaces created from devfile, will inherit this name. It is
* required.
*/
String getName();
/** Returns Devfile API Version. It is required. */
String getApiVersion();
/**
* Returns projects configurations which are related to the devfile, when devfile doesn't contain
@ -46,4 +45,7 @@ public interface Devfile {
/** Returns devfile attributes. Devfile attributes must not contain null keys or values. */
Map<String, String> getAttributes();
/** Returns the metadata of the devfile. */
Metadata getMetadata();
}

View File

@ -0,0 +1,19 @@
/*
* Copyright (c) 2012-2018 Red Hat, Inc.
* This program and the accompanying materials are made
* available under the terms of the Eclipse Public License 2.0
* which is available at https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Red Hat, Inc. - initial API and implementation
*/
package org.eclipse.che.api.core.model.workspace.devfile;
/** Defines the metadata of a devfile. */
public interface Metadata {
/** @return the name of the devfile */
String getName();
}

View File

@ -1,5 +1,6 @@
specVersion: 0.0.1
name: dashboard-in-che
apiVersion: 1.0.0
metadata:
name: dashboard-in-che
projects:
- name: che
source:

View File

@ -333,12 +333,15 @@ declare namespace che {
}
export interface IWorkspaceDevfile {
specVersion: string;
apiVersion: string;
name: string;
components: Array<any>;
projects?: Array <any>;
commands?: Array <any>;
attributes?: che.IWorkspaceConfigAttributes;
metadata: {
name: string
}
}
export interface IWorkspaceEnvironment {

View File

@ -1,5 +1,6 @@
specVersion: 0.0.1
name: che-in-che
apiVersion: 1.0.0
metadata:
name: che-in-che
projects:
- name: che
source:

View File

@ -1,5 +1,6 @@
specVersion: 0.0.1
name: workspace-loader
apiVersion: 1.0.0
metadata:
name: workspace-loader
projects:
- name: che
source:

View File

@ -56,8 +56,9 @@ public class DefaultFactoryParameterResolverTest {
private static final String DEVFILE =
""
+ "specVersion: 0.0.1\n"
+ "name: test\n"
+ "apiVersion: 1.0.0\n"
+ "metadata:\n"
+ " name: test\n"
+ "components:\n"
+ "- type: kubernetes\n"
+ " alias: component\n"

View File

@ -20,18 +20,11 @@ import org.eclipse.che.dto.shared.DTO;
@DTO
public interface DevfileDto extends Devfile {
@Override
String getSpecVersion();
String getApiVersion();
void setSpecVersion(String specVersion);
void setApiVersion(String apiVersion);
DevfileDto withSpecVersion(String specVersion);
@Override
String getName();
void setName(String name);
DevfileDto withName(String name);
DevfileDto withApiVersion(String apiVersion);
@Override
List<ProjectDto> getProjects();
@ -60,4 +53,11 @@ public interface DevfileDto extends Devfile {
void setAttributes(Map<String, String> attributes);
DevfileDto withAttributes(Map<String, String> attributes);
@Override
MetadataDto getMetadata();
void setMetadata(MetadataDto metadata);
DevfileDto withMetadata(MetadataDto metadata);
}

View File

@ -0,0 +1,26 @@
/*
* Copyright (c) 2012-2018 Red Hat, Inc.
* This program and the accompanying materials are made
* available under the terms of the Eclipse Public License 2.0
* which is available at https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Red Hat, Inc. - initial API and implementation
*/
package org.eclipse.che.api.workspace.shared.dto.devfile;
import org.eclipse.che.api.core.model.workspace.devfile.Metadata;
import org.eclipse.che.dto.shared.DTO;
@DTO
public interface MetadataDto extends Metadata {
@Override
String getName();
void setName(String name);
MetadataDto withName(String name);
}

View File

@ -23,8 +23,9 @@ Example of the minimal devfile with project and standard plugins set (Theia edit
```
---
specVersion: 0.0.1
name: petclinic-dev-environment
apiVersion: 1.0.0
metadata:
name: petclinic-dev-environment
projects:
- name: petclinic
source:
@ -74,8 +75,9 @@ cloned to.
As an example, consider this devfile:
```yaml
specVersion: 0.0.1
name: example-devfile
apiVersion: 1.0.0
metadata:
name: example-devfile
projects:
- name: frontend
source:
@ -306,8 +308,9 @@ If editor is not specified Devfile then default one will be provided. In case wh
Default value is `false` and means that Devfile needs default editor to be provisioned if no one is defined.
Example of Devfile without editor
```yaml
specVersion: 0.0.1
name: petclinic-dev-environment
apiVersion: 1.0.0
metadata:
name: petclinic-dev-environment
components:
- alias: myApp
type: kubernetes
@ -322,8 +325,9 @@ Sometimes it may be needed to disable data persistence for some reasons, like wh
To achieve it the `persistVolumes` devfile attribute should be used. Default value is `true`, and in case of `false` `emptyDir` volumes will be used for configured volumes and PVC.
Example of Devfile with ephemeral mode enabled
```yaml
specVersion: 0.0.1
name: petclinic-dev-environment
apiVersion: 1.0.0
metadata:
name: petclinic-dev-environment
projects:
- name: petclinic
source:

View File

@ -34,6 +34,7 @@ import org.eclipse.che.api.core.model.workspace.devfile.Devfile;
import org.eclipse.che.api.core.model.workspace.devfile.Endpoint;
import org.eclipse.che.api.core.model.workspace.devfile.Entrypoint;
import org.eclipse.che.api.core.model.workspace.devfile.Env;
import org.eclipse.che.api.core.model.workspace.devfile.Metadata;
import org.eclipse.che.api.core.model.workspace.devfile.Project;
import org.eclipse.che.api.core.model.workspace.devfile.Source;
import org.eclipse.che.api.core.model.workspace.runtime.Machine;
@ -63,6 +64,7 @@ import org.eclipse.che.api.workspace.shared.dto.devfile.DevfileVolumeDto;
import org.eclipse.che.api.workspace.shared.dto.devfile.EndpointDto;
import org.eclipse.che.api.workspace.shared.dto.devfile.EntrypointDto;
import org.eclipse.che.api.workspace.shared.dto.devfile.EnvDto;
import org.eclipse.che.api.workspace.shared.dto.devfile.MetadataDto;
import org.eclipse.che.api.workspace.shared.dto.devfile.ProjectDto;
import org.eclipse.che.api.workspace.shared.dto.devfile.SourceDto;
import org.eclipse.che.api.workspace.shared.dto.stack.StackComponentDto;
@ -110,12 +112,12 @@ public final class DtoConverter {
List<ProjectDto> projects =
devfile.getProjects().stream().map(DtoConverter::asDto).collect(toList());
return newDto(DevfileDto.class)
.withName(devfile.getName())
.withSpecVersion(devfile.getSpecVersion())
.withApiVersion(devfile.getApiVersion())
.withCommands(commands)
.withComponents(components)
.withProjects(projects)
.withAttributes(devfile.getAttributes());
.withAttributes(devfile.getAttributes())
.withMetadata(asDto(devfile.getMetadata()));
}
private static ProjectDto asDto(Project project) {
@ -416,5 +418,10 @@ public final class DtoConverter {
return machineDto;
}
/** Converts {@link Metadata} to {@link MetadataDto}. */
public static MetadataDto asDto(Metadata metadata) {
return newDto(MetadataDto.class).withName(metadata.getName());
}
private DtoConverter() {}
}

View File

@ -17,7 +17,7 @@ public class Constants {
public static final String SCHEMA_LOCATION = "schema/devfile.json";
public static final String CURRENT_SPEC_VERSION = "0.0.1";
public static final String CURRENT_API_VERSION = "1.0.0";
public static final String EDITOR_COMPONENT_TYPE = "cheEditor";

View File

@ -13,9 +13,10 @@ package org.eclipse.che.api.workspace.server.devfile.convert;
import static com.google.common.base.Preconditions.checkArgument;
import static java.lang.String.format;
import static java.util.Collections.singleton;
import static java.util.stream.Collectors.toCollection;
import static org.eclipse.che.api.workspace.server.devfile.Components.getIdentifiableComponentName;
import static org.eclipse.che.api.workspace.server.devfile.Constants.CURRENT_SPEC_VERSION;
import static org.eclipse.che.api.workspace.server.devfile.Constants.CURRENT_API_VERSION;
import com.google.common.base.Strings;
import java.util.ArrayList;
@ -90,7 +91,7 @@ public class DevfileConverter {
}
DevfileImpl devfile = new DevfileImpl();
devfile.setSpecVersion(CURRENT_SPEC_VERSION);
devfile.setApiVersion(CURRENT_API_VERSION);
devfile.setName(wsConfig.getName());
// Manage projects
@ -181,12 +182,15 @@ public class DevfileConverter {
}
private static void validateCurrentVersion(Devfile devFile) throws DevfileFormatException {
if (Strings.isNullOrEmpty(devFile.getSpecVersion())) {
throw new DevfileFormatException("Provided Devfile has no spec version specified");
if (Strings.isNullOrEmpty(devFile.getApiVersion())) {
throw new DevfileFormatException("Provided Devfile has no API version specified");
}
if (!CURRENT_SPEC_VERSION.equals(devFile.getSpecVersion())) {
if (!CURRENT_API_VERSION.equals(devFile.getApiVersion())) {
throw new DevfileFormatException(
format("Provided Devfile has unsupported version '%s'", devFile.getSpecVersion()));
format(
"Provided Devfile has unsupported version '%s'. The following versions are"
+ " supported: %s",
devFile.getApiVersion(), singleton(CURRENT_API_VERSION)));
}
}
}

View File

@ -220,7 +220,7 @@ public class WorkspaceImpl implements Workspace {
/** Returns the name of workspace. It can be stored by workspace config or devfile. */
public String getName() {
if (devfile != null) {
return devfile.getName();
return devfile.getMetadata().getName();
} else if (config != null) {
return config.getName();
} else {

View File

@ -22,6 +22,7 @@ import javax.persistence.CascadeType;
import javax.persistence.CollectionTable;
import javax.persistence.Column;
import javax.persistence.ElementCollection;
import javax.persistence.Embedded;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
@ -33,6 +34,7 @@ import javax.persistence.Table;
import org.eclipse.che.api.core.model.workspace.devfile.Command;
import org.eclipse.che.api.core.model.workspace.devfile.Component;
import org.eclipse.che.api.core.model.workspace.devfile.Devfile;
import org.eclipse.che.api.core.model.workspace.devfile.Metadata;
import org.eclipse.che.api.core.model.workspace.devfile.Project;
/** @author Sergii Leshchenko */
@ -45,11 +47,8 @@ public class DevfileImpl implements Devfile {
@Column(name = "id")
private Long id;
@Column(name = "spec_version", nullable = false)
private String specVersion;
@Column(name = "name", nullable = false)
private String name;
@Column(name = "api_version", nullable = false)
private String apiVersion;
@OneToMany(cascade = CascadeType.ALL, orphanRemoval = true, fetch = FetchType.EAGER)
@JoinColumn(name = "devfile_id")
@ -69,17 +68,18 @@ public class DevfileImpl implements Devfile {
@Column(name = "value", columnDefinition = "TEXT")
private Map<String, String> attributes;
@Embedded private MetadataImpl metadata;
public DevfileImpl() {}
public DevfileImpl(
String specVersion,
String name,
String apiVersion,
List<? extends Project> projects,
List<? extends Component> components,
List<? extends Command> commands,
Map<String, String> attributes) {
this.specVersion = specVersion;
this.name = name;
Map<String, String> attributes,
Metadata metadata) {
this.apiVersion = apiVersion;
if (projects != null) {
this.projects = projects.stream().map(ProjectImpl::new).collect(toCollection(ArrayList::new));
}
@ -93,34 +93,33 @@ public class DevfileImpl implements Devfile {
if (attributes != null) {
this.attributes = new HashMap<>(attributes);
}
if (metadata != null) {
this.metadata = new MetadataImpl(metadata);
}
}
public DevfileImpl(Devfile devfile) {
this(
devfile.getSpecVersion(),
devfile.getName(),
devfile.getApiVersion(),
devfile.getProjects(),
devfile.getComponents(),
devfile.getCommands(),
devfile.getAttributes());
devfile.getAttributes(),
devfile.getMetadata());
}
@Override
public String getSpecVersion() {
return specVersion;
public String getApiVersion() {
return apiVersion;
}
public void setSpecVersion(String specVersion) {
this.specVersion = specVersion;
}
@Override
public String getName() {
return name;
public void setApiVersion(String apiVersion) {
this.apiVersion = apiVersion;
}
public void setName(String name) {
this.name = name;
getMetadata().setName(name);
}
@Override
@ -171,6 +170,18 @@ public class DevfileImpl implements Devfile {
this.attributes = attributes;
}
@Override
public MetadataImpl getMetadata() {
if (metadata == null) {
metadata = new MetadataImpl();
}
return metadata;
}
public void setMetadata(MetadataImpl metadata) {
this.metadata = metadata;
}
@Override
public boolean equals(Object o) {
if (this == o) {
@ -181,18 +192,24 @@ public class DevfileImpl implements Devfile {
}
DevfileImpl devfile = (DevfileImpl) o;
return Objects.equals(id, devfile.id)
&& Objects.equals(specVersion, devfile.specVersion)
&& Objects.equals(name, devfile.name)
&& Objects.equals(apiVersion, devfile.apiVersion)
&& Objects.equals(getProjects(), devfile.getProjects())
&& Objects.equals(getComponents(), devfile.getComponents())
&& Objects.equals(getCommands(), devfile.getCommands())
&& Objects.equals(getAttributes(), devfile.getAttributes());
&& Objects.equals(getAttributes(), devfile.getAttributes())
&& Objects.equals(getMetadata(), devfile.getMetadata());
}
@Override
public int hashCode() {
return Objects.hash(
id, specVersion, name, getProjects(), getComponents(), getCommands(), getAttributes());
id,
apiVersion,
getProjects(),
getComponents(),
getCommands(),
getAttributes(),
getMetadata());
}
@Override
@ -201,11 +218,8 @@ public class DevfileImpl implements Devfile {
+ "id='"
+ id
+ '\''
+ ", specVersion='"
+ specVersion
+ '\''
+ ", name='"
+ name
+ ", apiVersion='"
+ apiVersion
+ '\''
+ ", projects="
+ projects
@ -215,6 +229,8 @@ public class DevfileImpl implements Devfile {
+ commands
+ ", attributes="
+ attributes
+ ", metadata="
+ metadata
+ '}';
}
}

View File

@ -0,0 +1,65 @@
/*
* Copyright (c) 2012-2018 Red Hat, Inc.
* This program and the accompanying materials are made
* available under the terms of the Eclipse Public License 2.0
* which is available at https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Red Hat, Inc. - initial API and implementation
*/
package org.eclipse.che.api.workspace.server.model.impl.devfile;
import java.util.Objects;
import javax.persistence.Column;
import javax.persistence.Embeddable;
import org.eclipse.che.api.core.model.workspace.devfile.Metadata;
@Embeddable
public class MetadataImpl implements Metadata {
@Column(name = "meta_name")
private String name;
public MetadataImpl() {}
public MetadataImpl(String name) {
this.name = name;
}
public MetadataImpl(Metadata metadata) {
this.name = metadata.getName();
}
@Override
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
MetadataImpl metadata = (MetadataImpl) o;
return name.equals(metadata.name);
}
@Override
public int hashCode() {
return Objects.hash(name);
}
@Override
public String toString() {
return "MetadataImpl{'name='" + name + '\'' + '}';
}
}

View File

@ -27,25 +27,33 @@
}
},
"required": [
"specVersion",
"name"
"apiVersion",
"metadata"
],
"additionalProperties": false,
"properties": {
"specVersion": {
"apiVersion": {
"type": "string",
"title": "Devfile Specification Version",
"title": "Devfile API Version",
"examples": [
"0.0.1"
"1.0.0"
]
},
"name": {
"type": "string",
"title": "Devfile Name",
"description": "The name of the devfile. Workspaces created from devfile, will inherit this name",
"examples": [
"petclinic-dev-environment"
]
"metadata": {
"type": "object",
"properties": {
"name": {
"type": "string",
"minLength": 1,
"title": "Devfile Name",
"description": "The name of the devfile. Workspaces created from devfile, will inherit this name",
"examples": [
"petclinic-dev-environment"
]
}
},
"additionalProperties": false,
"required": ["name"]
},
"projects": {
"type": "array",

View File

@ -86,6 +86,7 @@ import org.eclipse.che.api.workspace.shared.dto.SourceStorageDto;
import org.eclipse.che.api.workspace.shared.dto.WorkspaceConfigDto;
import org.eclipse.che.api.workspace.shared.dto.WorkspaceDto;
import org.eclipse.che.api.workspace.shared.dto.devfile.DevfileDto;
import org.eclipse.che.api.workspace.shared.dto.devfile.MetadataDto;
import org.eclipse.che.api.workspace.shared.dto.devfile.ProjectDto;
import org.eclipse.che.api.workspace.shared.dto.devfile.SourceDto;
import org.eclipse.che.commons.env.EnvironmentContext;
@ -1354,8 +1355,8 @@ public class WorkspaceServiceTest {
private DevfileDtoImpl createDevfileDto() {
return (DevfileDtoImpl)
newDto(DevfileDto.class)
.withSpecVersion("0.0.1")
.withName("ws")
.withApiVersion("0.0.1")
.withMetadata(newDto(MetadataDto.class).withName("ws"))
.withProjects(
singletonList(
newDto(ProjectDto.class)

View File

@ -11,7 +11,7 @@
*/
package org.eclipse.che.api.workspace.server.devfile.convert;
import static org.eclipse.che.api.workspace.server.devfile.Constants.CURRENT_SPEC_VERSION;
import static org.eclipse.che.api.workspace.server.devfile.Constants.CURRENT_API_VERSION;
import static org.eclipse.che.api.workspace.shared.Constants.PERSIST_VOLUMES_ATTRIBUTE;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.doReturn;
@ -98,7 +98,7 @@ public class DevfileConverterTest {
DevfileImpl devfile = devfileConverter.workspaceToDevFile(wsConfig);
// then
assertEquals(devfile.getSpecVersion(), CURRENT_SPEC_VERSION);
assertEquals(devfile.getApiVersion(), CURRENT_API_VERSION);
}
@Test
@ -277,9 +277,9 @@ public class DevfileConverterTest {
@Test(
expectedExceptions = DevfileFormatException.class,
expectedExceptionsMessageRegExp = "Provided Devfile has no spec version specified")
expectedExceptionsMessageRegExp = "Provided Devfile has no API version specified")
public void
shouldThrowAnExceptionIfDevfileSpecVersionIsMissingDuringConvertingDevfileToWorkspaceConfig()
shouldThrowAnExceptionIfDevfileApiVersionIsMissingDuringConvertingDevfileToWorkspaceConfig()
throws Exception {
// given
FileContentProvider fileContentProvider = mock(FileContentProvider.class);
@ -293,14 +293,14 @@ public class DevfileConverterTest {
@Test(
expectedExceptions = DevfileFormatException.class,
expectedExceptionsMessageRegExp =
"Provided Devfile has unsupported version '1\\.0\\.0-non-supported'")
"Provided Devfile has unsupported version '1\\.0\\.0-non-supported'. The following versions are supported: .*")
public void
shouldThrowAnExceptionIfDevfileSpecVersionIsNotSupportedDuringConvertingDevfileToWorkspaceConfig()
shouldThrowAnExceptionIfDevfileApiVersionIsNotSupportedDuringConvertingDevfileToWorkspaceConfig()
throws Exception {
// given
FileContentProvider fileContentProvider = mock(FileContentProvider.class);
DevfileImpl devfile = new DevfileImpl();
devfile.setSpecVersion("1.0.0-non-supported");
devfile.setApiVersion("1.0.0-non-supported");
devfile.setName("petclinic");
// when
@ -334,7 +334,7 @@ public class DevfileConverterTest {
private DevfileImpl newDevfile(String name) {
DevfileImpl devfile = new DevfileImpl();
devfile.setSpecVersion(CURRENT_SPEC_VERSION);
devfile.setApiVersion(CURRENT_API_VERSION);
devfile.setName(name);
return devfile;
}

View File

@ -88,12 +88,24 @@ public class DevfileSchemaValidatorTest {
return new Object[][] {
// Devfile model testing
{
"devfile/devfile_missing_name.yaml",
"The object must have a property whose name is \"name\"."
"devfile/devfile_empty_metadata.yaml",
"(/metadata):The object must have a property whose name is \"name\"."
},
{
"devfile/devfile_missing_spec_version.yaml",
"The object must have a property whose name is \"specVersion\"."
"devfile/devfile_null_metadata.yaml",
"(/metadata):The value must be of object type, but actual type is null."
},
{
"devfile/devfile_missing_metadata.yaml",
"The object must have a property whose name is \"metadata\"."
},
{
"devfile/devfile_missing_name.yaml",
"(/metadata/something):The object must not have a property whose name is \"something\".(/metadata):The object must have a property whose name is \"name\"."
},
{
"devfile/devfile_missing_api_version.yaml",
"The object must have a property whose name is \"apiVersion\"."
},
{
"devfile/devfile_with_undeclared_field.yaml",

View File

@ -166,6 +166,60 @@ public class JpaWorkspaceDaoTest {
assertEquals(result.getConfig().getProjects().get(0).getAttributes().size(), 3);
}
@Test(expectedExceptions = IllegalStateException.class)
public void shouldNotSaveDevfileWithoutMetadata() {
final AccountImpl account = new AccountImpl("accountId", "namespace", "test");
final WorkspaceImpl workspace = createWorkspaceFromDevfile("id", account, "name");
workspace.getDevfile().setMetadata(null);
try {
// persist the workspace
manager.getTransaction().begin();
manager.persist(account);
manager.persist(workspace);
manager.getTransaction().commit();
} finally {
manager.getTransaction().rollback();
manager.clear();
}
}
@Test(expectedExceptions = IllegalStateException.class)
public void shouldNotSaveDevfileWithoutMetadataName() {
final AccountImpl account = new AccountImpl("accountId", "namespace", "test");
final WorkspaceImpl workspace = createWorkspaceFromDevfile("id", account, "name");
workspace.getDevfile().getMetadata().setName(null);
try {
// persist the workspace
manager.getTransaction().begin();
manager.persist(account);
manager.persist(workspace);
manager.getTransaction().commit();
} finally {
manager.getTransaction().rollback();
manager.clear();
}
}
@Test(expectedExceptions = IllegalStateException.class)
public void shouldNotSaveDevfileWithEmptyMetadataName() {
final AccountImpl account = new AccountImpl("accountId", "namespace", "test");
final WorkspaceImpl workspace = createWorkspaceFromDevfile("id", account, "name");
workspace.getDevfile().getMetadata().setName("");
try {
// persist the workspace
manager.getTransaction().begin();
manager.persist(account);
manager.persist(workspace);
manager.getTransaction().commit();
} finally {
manager.getTransaction().rollback();
manager.clear();
}
}
private long asLong(String query) {
return manager.createQuery(query, Long.class).getSingleResult();
}

View File

@ -58,6 +58,7 @@ import org.eclipse.che.api.workspace.server.model.impl.devfile.DevfileImpl;
import org.eclipse.che.api.workspace.server.model.impl.devfile.EndpointImpl;
import org.eclipse.che.api.workspace.server.model.impl.devfile.EntrypointImpl;
import org.eclipse.che.api.workspace.server.model.impl.devfile.EnvImpl;
import org.eclipse.che.api.workspace.server.model.impl.devfile.MetadataImpl;
import org.eclipse.che.api.workspace.server.model.impl.devfile.ProjectImpl;
import org.eclipse.che.api.workspace.server.model.impl.devfile.SourceImpl;
import org.eclipse.che.api.workspace.server.spi.WorkspaceDao;
@ -945,11 +946,11 @@ public class WorkspaceDaoTest {
DevfileImpl devfile =
new DevfileImpl(
"0.0.1",
name,
asList(project1, project2),
asList(component1, component2),
asList(command1, command2),
singletonMap("attribute1", "value1"));
singletonMap("attribute1", "value1"),
new MetadataImpl(name));
return devfile;
}

View File

@ -11,8 +11,9 @@
#
---
specVersion: 0.0.1
name: petclinic-dev-environment
apiVersion: 1.0.0
metadata:
name: petclinic-dev-environment
projects:
- name: petclinic
source:

View File

@ -11,8 +11,9 @@
#
---
specVersion: 0.0.1
name: petclinic-dev-environment
apiVersion: 1.0.0
metadata:
name: petclinic-dev-environment
components:
- alias: theia
type: cheEditor

View File

@ -11,8 +11,9 @@
#
---
specVersion: 0.0.1
name: petclinic-dev-environment
apiVersion: 1.0.0
metadata:
name: petclinic-dev-environment
components:
- alias: theia
type: cheEditor

View File

@ -11,8 +11,9 @@
#
---
specVersion: 0.0.1
name: petclinic-dev-environment
apiVersion: 1.0.0
metadata:
name: petclinic-dev-environment
components:
- alias: theia
type: cheEditor

View File

@ -11,8 +11,9 @@
#
---
specVersion: 0.0.1
name: petclinic-dev-environment
apiVersion: 1.0.0
metadata:
name: petclinic-dev-environment
components:
- alias: mysql
type: openshift

View File

@ -11,8 +11,9 @@
#
---
specVersion: 0.0.1
name: petclinic-dev-environment
apiVersion: 1.0.0
metadata:
name: petclinic-dev-environment
components:
- type: chePlugin
alias: maven

View File

@ -11,8 +11,9 @@
#
---
specVersion: 0.0.1
name: petclinic-dev-environment
apiVersion: 1.0.0
metadata:
name: petclinic-dev-environment
components:
- alias: maven
id: eclipse/chemaven-jdk8/1.0.0

View File

@ -11,8 +11,9 @@
#
---
specVersion: 0.0.1
name: petclinic-dev-environment
apiVersion: 1.0.0
metadata:
name: petclinic-dev-environment
components:
- alias: maven
id: org.eclipse.chemaven-jdk8:1.0.0

View File

@ -11,8 +11,9 @@
#
---
specVersion: 0.0.1
name: petclinic-dev-environment
apiVersion: 1.0.0
metadata:
name: petclinic-dev-environment
projects:
- name: petclinic
source:

View File

@ -0,0 +1,15 @@
#
# Copyright (c) 2012-2018 Red Hat, Inc.
# This program and the accompanying materials are made
# available under the terms of the Eclipse Public License 2.0
# which is available at https://www.eclipse.org/legal/epl-2.0/
#
# SPDX-License-Identifier: EPL-2.0
#
# Contributors:
# Red Hat, Inc. - initial API and implementation
#
---
metadata:
name: petclinic-dev-environment

View File

@ -0,0 +1,14 @@
#
# Copyright (c) 2012-2018 Red Hat, Inc.
# This program and the accompanying materials are made
# available under the terms of the Eclipse Public License 2.0
# which is available at https://www.eclipse.org/legal/epl-2.0/
#
# SPDX-License-Identifier: EPL-2.0
#
# Contributors:
# Red Hat, Inc. - initial API and implementation
#
---
apiVersion: 1.0.0

View File

@ -11,4 +11,6 @@
#
---
specVersion: 0.0.1
apiVersion: 1.0.0
metadata:
something: else

View File

@ -0,0 +1,15 @@
#
# Copyright (c) 2012-2018 Red Hat, Inc.
# This program and the accompanying materials are made
# available under the terms of the Eclipse Public License 2.0
# which is available at https://www.eclipse.org/legal/epl-2.0/
#
# SPDX-License-Identifier: EPL-2.0
#
# Contributors:
# Red Hat, Inc. - initial API and implementation
#
---
apiVersion: 1.0.0
metadata:

View File

@ -11,6 +11,7 @@
#
---
specVersion: 0.0.1
name: petclinic-dev-environment
apiVersion: 1.0.0
metadata:
name: petclinic-dev-environment
unknown: blah-blah

View File

@ -11,8 +11,9 @@
#
---
specVersion: 0.0.1
name: petclinic-dev-environment
apiVersion: 1.0.0
metadata:
name: petclinic-dev-environment
components:
- type: dockerimage
image: eclipe/maven-jdk8:latest

View File

@ -11,8 +11,9 @@
#
---
specVersion: 0.0.1
name: petclinic-dev-environment
apiVersion: 1.0.0
metadata:
name: petclinic-dev-environment
components:
- type: dockerimage
image: eclipe/maven-jdk8:latest

View File

@ -11,8 +11,9 @@
#
---
specVersion: 0.0.1
name: petclinic-dev-environment
apiVersion: 1.0.0
metadata:
name: petclinic-dev-environment
components:
- type: dockerimage
memoryLimit: 1G

View File

@ -11,8 +11,9 @@
#
---
specVersion: 0.0.1
name: petclinic-dev-environment
apiVersion: 1.0.0
metadata:
name: petclinic-dev-environment
components:
- type: dockerimage
image: org.eclipse.cheubuntu-jdk:latest

View File

@ -11,8 +11,9 @@
#
---
specVersion: 0.0.1
name: petclinic-dev-environment
apiVersion: 1.0.0
metadata:
name: petclinic-dev-environment
components:
- type: dockerimage
image: eclipe/maven-jdk8:latest

View File

@ -11,8 +11,9 @@
#
---
specVersion: 0.0.1
name: petclinic-dev-environment
apiVersion: 1.0.0
metadata:
name: petclinic-dev-environment
components:
- type: cheEditor
id: eclipse/theia/dev

View File

@ -10,8 +10,9 @@
# Red Hat, Inc. - initial API and implementation
#
specVersion: 0.0.1
name: terminal-sample
apiVersion: 1.0.0
metadata:
name: terminal-sample
components:
- type: cheEditor
registryUrl: https://che-plugin-registry.openshift.io/

View File

@ -10,8 +10,9 @@
# Red Hat, Inc. - initial API and implementation
#
specVersion: 0.0.1
name: terminal-sample
apiVersion: 1.0.0
metadata:
name: terminal-sample
components:
- type: cheEditor
reference: https://gist.githubusercontent.com/sleshchenko/e132bd9d37e8cf8f2c0a2b4929ecda3e/raw/9c28962cc3a24dcaf357b5716d98068734f51165/meta.yaml

View File

@ -11,8 +11,9 @@
#
---
specVersion: 0.0.1
name: petclinic-dev-environment
apiVersion: 1.0.0
metadata:
name: petclinic-dev-environment
components:
- type: cheEditor
id: eclipse/theia/0.0.3

View File

@ -11,7 +11,8 @@
#
---
specVersion: 0.0.1
name: petclinic-dev-environment
apiVersion: 1.0.0
metadata:
name: petclinic-dev-environment
components:
- type: cheEditor

View File

@ -11,8 +11,9 @@
#
---
specVersion: 0.0.1
name: petclinic-dev-environment
apiVersion: 1.0.0
metadata:
name: petclinic-dev-environment
components:
- type: cheEditor
id: eclipse/theia/dev:v1

View File

@ -11,8 +11,9 @@
#
---
specVersion: 0.0.1
name: petclinic-dev-environment
apiVersion: 1.0.0
metadata:
name: petclinic-dev-environment
components:
- type: cheEditor
id: https://myregistry.com/eclipse/theia/dev:v1

View File

@ -11,8 +11,9 @@
#
---
specVersion: 0.0.1
name: petclinic-dev-environment
apiVersion: 1.0.0
metadata:
name: petclinic-dev-environment
components:
- type: cheEditor
id: eclipse/theia

View File

@ -11,8 +11,9 @@
#
---
specVersion: 0.0.1
name: petclinic-dev-environment
apiVersion: 1.0.0
metadata:
name: petclinic-dev-environment
projects:
- name: petclinic
source:

View File

@ -10,8 +10,9 @@
# Red Hat, Inc. - initial API and implementation
#
specVersion: 0.0.1
name: terminal-sample
apiVersion: 1.0.0
metadata:
name: terminal-sample
components:
- type: chePlugin
id: publisher/terminal-sample/0.0.1

View File

@ -10,8 +10,9 @@
# Red Hat, Inc. - initial API and implementation
#
specVersion: 0.0.1
name: terminal-sample
apiVersion: 1.0.0
metadata:
name: terminal-sample
components:
- type: chePlugin
id: check/terminal-sample/0.0.1

View File

@ -10,8 +10,9 @@
# Red Hat, Inc. - initial API and implementation
#
specVersion: 0.0.1
name: terminal-sample
apiVersion: 1.0.0
metadata:
name: terminal-sample
components:
- type: chePlugin
reference: https://raw.githubusercontent.com/eclipse/che-plugin-registry/myplugin/meta.yaml
reference: https://raw.githubusercontent.com/eclipse/che-plugin-registry/myplugin/meta.yaml

View File

@ -10,8 +10,9 @@
# Red Hat, Inc. - initial API and implementation
#
specVersion: 0.0.1
name: terminal-sample
apiVersion: 1.0.0
metadata:
name: terminal-sample
components:
- type: chePlugin
id: check/terminal-sample/0.0.1

View File

@ -11,8 +11,9 @@
#
---
specVersion: 0.0.1
name: petclinic-dev-environment
apiVersion: 1.0.0
metadata:
name: petclinic-dev-environment
components:
- alias: mysql
type: kubernetes

View File

@ -11,8 +11,9 @@
#
---
specVersion: 0.0.1
name: petclinic-dev-environment
apiVersion: 1.0.0
metadata:
name: petclinic-dev-environment
components:
- alias: mysql
type: kubernetes

View File

@ -11,8 +11,9 @@
#
---
specVersion: 0.0.1
name: petclinic-dev-environment
apiVersion: 1.0.0
metadata:
name: petclinic-dev-environment
components:
- alias: mysql
type: kubernetes

View File

@ -11,8 +11,9 @@
#
---
specVersion: 0.0.1
name: petclinic-dev-environment
apiVersion: 1.0.0
metadata:
name: petclinic-dev-environment
components:
- type: kubernetes
reference: petclinic.yaml

View File

@ -11,8 +11,9 @@
#
---
specVersion: 0.0.1
name: petclinic-dev-environment
apiVersion: 1.0.0
metadata:
name: petclinic-dev-environment
components:
- alias: mysql
type: openshift

View File

@ -11,8 +11,9 @@
#
---
specVersion: 0.0.1
name: petclinic-dev-environment
apiVersion: 1.0.0
metadata:
name: petclinic-dev-environment
components:
- alias: mysql
type: openshift

View File

@ -11,8 +11,9 @@
#
---
specVersion: 0.0.1
name: petclinic-dev-environment
apiVersion: 1.0.0
metadata:
name: petclinic-dev-environment
components:
- type: openshift
referenceContent: it is supposed to be a content of the file specified in the local field

View File

@ -11,8 +11,9 @@
#
---
specVersion: 0.0.1
name: petclinic-dev-environment
apiVersion: 1.0.0
metadata:
name: petclinic-dev-environment
components:
- type: openshift
referenceContent: |

View File

@ -11,8 +11,9 @@
#
---
specVersion: 0.0.1
name: petclinic-dev-environment
apiVersion: 1.0.0
metadata:
name: petclinic-dev-environment
components:
- alias: mysql
type: openshift

View File

@ -11,7 +11,8 @@
#
---
specVersion: 0.0.1
name: petclinic-dev-environment
apiVersion: 1.0.0
metadata:
name: petclinic-dev-environment
components:
- type: openshift

View File

@ -0,0 +1,14 @@
--
-- Copyright (c) 2012-2019 Red Hat, Inc.
-- This program and the accompanying materials are made
-- available under the terms of the Eclipse Public License 2.0
-- which is available at https://www.eclipse.org/legal/epl-2.0/
--
-- SPDX-License-Identifier: EPL-2.0
--
-- Contributors:
-- Red Hat, Inc. - initial API and implementation
--
ALTER TABLE devfile RENAME COLUMN spec_version TO api_version;
ALTER TABLE devfile RENAME COLUMN name TO meta_name;

View File

@ -0,0 +1,14 @@
--
-- Copyright (c) 2012-2019 Red Hat, Inc.
-- This program and the accompanying materials are made
-- available under the terms of the Eclipse Public License 2.0
-- which is available at https://www.eclipse.org/legal/epl-2.0/
--
-- SPDX-License-Identifier: EPL-2.0
--
-- Contributors:
-- Red Hat, Inc. - initial API and implementation
--
ALTER TABLE devfile CHANGE spec_version api_version VARCHAR(255) NOT NULL;
ALTER TABLE devfile CHANGE name meta_name VARCHAR(255) NOT NULL;

View File

@ -23,6 +23,7 @@ import java.util.Map;
import org.eclipse.che.account.shared.model.Account;
import org.eclipse.che.account.spi.AccountImpl;
import org.eclipse.che.api.core.model.workspace.WorkspaceStatus;
import org.eclipse.che.api.core.model.workspace.devfile.Metadata;
import org.eclipse.che.api.core.model.workspace.runtime.MachineStatus;
import org.eclipse.che.api.core.model.workspace.runtime.ServerStatus;
import org.eclipse.che.api.ssh.server.model.impl.SshPairImpl;
@ -43,6 +44,7 @@ import org.eclipse.che.api.workspace.server.model.impl.devfile.ActionImpl;
import org.eclipse.che.api.workspace.server.model.impl.devfile.ComponentImpl;
import org.eclipse.che.api.workspace.server.model.impl.devfile.DevfileImpl;
import org.eclipse.che.api.workspace.server.model.impl.devfile.EntrypointImpl;
import org.eclipse.che.api.workspace.server.model.impl.devfile.MetadataImpl;
import org.eclipse.che.api.workspace.server.model.impl.devfile.ProjectImpl;
import org.eclipse.che.api.workspace.server.model.impl.devfile.SourceImpl;
import org.eclipse.che.api.workspace.server.model.impl.stack.StackComponentImpl;
@ -102,12 +104,12 @@ public final class TestObjectsFactory {
public static DevfileImpl createDevfile(String id) {
return new DevfileImpl(
"0.0.1",
id + "name",
asList(createDevfileProject(id + "-project1"), createDevfileProject(id + "-project2")),
asList(
createDevfileComponent(id + "-component1"), createDevfileComponent(id + "-component2")),
asList(createDevfileCommand(id + "-command1"), createDevfileCommand(id + "-command2")),
singletonMap("attribute1", "value1"));
singletonMap("attribute1", "value1"),
createMetadata(id + "name"));
}
private static ComponentImpl createDevfileComponent(String name) {
@ -263,5 +265,9 @@ public final class TestObjectsFactory {
ImmutableMap.of("key", "value"))));
}
public static Metadata createMetadata(String name) {
return new MetadataImpl(name);
}
private TestObjectsFactory() {}
}