Fix devfile 2.0.0 and 2.1.0 versions & add 2.2.0-alpha (#25)

* fix: fix devfile 2.0.0 and 2.1.0 versions

* feat: add devfile 2.2.0-alpha schema

* fix: patch devfile 2.2.0-alpha schemaVersion

* Adapt java tests to newer devfile schemas

* Cleanup in test

Co-authored-by: Sergii Kabashniuk <skabashniuk@redhat.com>
pull/26/head
Serhii Leshchenko 2021-06-09 12:06:13 +03:00 committed by GitHub
parent e03a57c450
commit 14734b6098
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 1704 additions and 172 deletions

View File

@ -24,7 +24,7 @@ public class Constants {
public static final String CURRENT_API_VERSION = "1.0.0";
public static final List<String> SUPPORTED_VERSIONS =
List.of(CURRENT_API_VERSION, "2.0.0", "2.1.0-alpha");
List.of(CURRENT_API_VERSION, "2.0.0", "2.1.0", "2.2.0-alpha");
public static final String EDITOR_COMPONENT_TYPE = "cheEditor";

View File

@ -3243,7 +3243,7 @@
"schemaVersion": {
"description": "Devfile schema version",
"type": "string",
"pattern": "^([2-9])\\.([0-9]+)\\.([0-9]+)(\\-[0-9a-z-]+(\\.[0-9a-z-]+)*)?(\\+[0-9A-Za-z-]+(\\.[0-9A-Za-z-]+)*)?$"
"pattern": "^2\\.0\\.0$"
},
"starterProjects": {
"description": "StarterProjects is a project that can be used as a starting point when bootstrapping new projects",

View File

@ -1,7 +1,7 @@
{
"description": "Devfile describes the structure of a cloud-native devworkspace and development environment.",
"type": "object",
"title": "Devfile schema - Version 2.1.0-alpha",
"title": "Devfile schema - Version 2.1.0",
"required": [
"schemaVersion"
],
@ -654,7 +654,7 @@
"type": "string"
},
"icon": {
"description": "Optional devfile icon",
"description": "Optional devfile icon, can be a URI or a relative path in the project",
"type": "string"
},
"language": {
@ -1303,11 +1303,6 @@
"git"
]
},
{
"required": [
"github"
]
},
{
"required": [
"zip"
@ -1353,48 +1348,12 @@
},
"additionalProperties": false
},
"github": {
"description": "Project's GitHub source. Deprecated, use `Git` instead",
"type": "object",
"properties": {
"checkoutFrom": {
"description": "Defines from what the project should be checked out. Required if there are more than one remote configured",
"type": "object",
"properties": {
"remote": {
"description": "The remote name should be used as init. Required if there are more than one remote configured",
"type": "string"
},
"revision": {
"description": "The revision to checkout from. Should be branch name, tag or commit id. Default branch is used if missing or specified revision is not found.",
"type": "string"
}
},
"additionalProperties": false
},
"remotes": {
"description": "The remotes map which should be initialized in the git project. Must have at least one remote configured",
"type": "object",
"additionalProperties": {
"type": "string"
}
}
},
"additionalProperties": false
},
"name": {
"description": "Project name",
"type": "string",
"maxLength": 63,
"pattern": "^[a-z0-9]([-a-z0-9]*[a-z0-9])?$"
},
"sparseCheckoutDirs": {
"description": "Populate the project sparsely with selected directories.",
"type": "array",
"items": {
"type": "string"
}
},
"zip": {
"description": "Project's Zip source",
"type": "object",
@ -1411,6 +1370,7 @@
}
},
"registryUrl": {
"description": "Registry URL to pull the parent devfile from when using id in the parent reference. To ensure the parent devfile gets resolved consistently in different environments, it is recommended to always specify the `regsitryURL` when `Id` is used.",
"type": "string"
},
"starterProjects": {
@ -1427,11 +1387,6 @@
"git"
]
},
{
"required": [
"github"
]
},
{
"required": [
"zip"
@ -1477,35 +1432,6 @@
},
"additionalProperties": false
},
"github": {
"description": "Project's GitHub source. Deprecated, use `Git` instead",
"type": "object",
"properties": {
"checkoutFrom": {
"description": "Defines from what the project should be checked out. Required if there are more than one remote configured",
"type": "object",
"properties": {
"remote": {
"description": "The remote name should be used as init. Required if there are more than one remote configured",
"type": "string"
},
"revision": {
"description": "The revision to checkout from. Should be branch name, tag or commit id. Default branch is used if missing or specified revision is not found.",
"type": "string"
}
},
"additionalProperties": false
},
"remotes": {
"description": "The remotes map which should be initialized in the git project. Must have at least one remote configured",
"type": "object",
"additionalProperties": {
"type": "string"
}
}
},
"additionalProperties": false
},
"name": {
"description": "Project name",
"type": "string",
@ -1532,7 +1458,7 @@
}
},
"uri": {
"description": "Uri of a Devfile yaml file",
"description": "URI Reference of a parent devfile YAML file. It can be a full URL or a relative URI with the current devfile as the base URI.",
"type": "string"
},
"variables": {
@ -1559,11 +1485,6 @@
"git"
]
},
{
"required": [
"github"
]
},
{
"required": [
"zip"
@ -1612,51 +1533,12 @@
},
"additionalProperties": false
},
"github": {
"description": "Project's GitHub source. Deprecated, use `Git` instead",
"type": "object",
"required": [
"remotes"
],
"properties": {
"checkoutFrom": {
"description": "Defines from what the project should be checked out. Required if there are more than one remote configured",
"type": "object",
"properties": {
"remote": {
"description": "The remote name should be used as init. Required if there are more than one remote configured",
"type": "string"
},
"revision": {
"description": "The revision to checkout from. Should be branch name, tag or commit id. Default branch is used if missing or specified revision is not found.",
"type": "string"
}
},
"additionalProperties": false
},
"remotes": {
"description": "The remotes map which should be initialized in the git project. Must have at least one remote configured",
"type": "object",
"additionalProperties": {
"type": "string"
}
}
},
"additionalProperties": false
},
"name": {
"description": "Project name",
"type": "string",
"maxLength": 63,
"pattern": "^[a-z0-9]([-a-z0-9]*[a-z0-9])?$"
},
"sparseCheckoutDirs": {
"description": "Populate the project sparsely with selected directories.",
"type": "array",
"items": {
"type": "string"
}
},
"zip": {
"description": "Project's Zip source",
"type": "object",
@ -1675,7 +1557,7 @@
"schemaVersion": {
"description": "Devfile schema version",
"type": "string",
"pattern": "^([2-9])\\.([0-9]+)\\.([0-9]+)(\\-[0-9a-z-]+(\\.[0-9a-z-]+)*)?(\\+[0-9A-Za-z-]+(\\.[0-9A-Za-z-]+)*)?$"
"pattern": "^2\\.1\\.0$"
},
"starterProjects": {
"description": "StarterProjects is a project that can be used as a starting point when bootstrapping new projects",
@ -1691,11 +1573,6 @@
"git"
]
},
{
"required": [
"github"
]
},
{
"required": [
"zip"
@ -1744,38 +1621,6 @@
},
"additionalProperties": false
},
"github": {
"description": "Project's GitHub source. Deprecated, use `Git` instead",
"type": "object",
"required": [
"remotes"
],
"properties": {
"checkoutFrom": {
"description": "Defines from what the project should be checked out. Required if there are more than one remote configured",
"type": "object",
"properties": {
"remote": {
"description": "The remote name should be used as init. Required if there are more than one remote configured",
"type": "string"
},
"revision": {
"description": "The revision to checkout from. Should be branch name, tag or commit id. Default branch is used if missing or specified revision is not found.",
"type": "string"
}
},
"additionalProperties": false
},
"remotes": {
"description": "The remotes map which should be initialized in the git project. Must have at least one remote configured",
"type": "object",
"additionalProperties": {
"type": "string"
}
}
},
"additionalProperties": false
},
"name": {
"description": "Project name",
"type": "string",

View File

@ -84,8 +84,9 @@ public class DevfileSchemaValidatorTest {
{"devfile/devfile_v2_sample-devfile.yaml"},
{"devfile/devfile_v2_simple-devfile.yaml"},
{"devfile/devfile_v2_spring-boot-http-booster-devfile.yaml"},
{"devfile/devfile_v2-1-0-alpha_just_schemaVersion.yaml"},
{"devfile/devfile_v2-1-0-alpha_simple-devfile.yaml"},
{"devfile/devfile_v2-1-0_just_schemaVersion.yaml"},
{"devfile/devfile_v2-1-0_simple-devfile.yaml"},
{"devfile/devfile_v2-2-0-alpha_simple-devfile.yaml"},
};
}
@ -263,18 +264,18 @@ public class DevfileSchemaValidatorTest {
},
{
"devfile/devfile_v2_invalid_schemaVersion.yaml",
"Version 'a.b.c' of the devfile is not supported. Supported versions are '[1.0.0, 2.0.0, 2.1.0-alpha]'."
"Version 'a.b.c' of the devfile is not supported. Supported versions are '[1.0.0, 2.0.0, 2.1.0, 2.2.0-alpha]'."
},
{
"devfile/devfile_v2_unsupported_schemaVersion.yaml",
"Version '22.33.44' of the devfile is not supported. Supported versions are '[1.0.0, 2.0.0, 2.1.0-alpha]'."
"Version '22.33.44' of the devfile is not supported. Supported versions are '[1.0.0, 2.0.0, 2.1.0, 2.2.0-alpha]'."
},
{
"devfile/devfile_v2-1-0-alpha_unsupported_schemaVersion.yaml",
"Version '2.1.0-beta' of the devfile is not supported. Supported versions are '[1.0.0, 2.0.0, 2.1.0-alpha]'."
"devfile/devfile_v2-1-0_unsupported_schemaVersion.yaml",
"Version '2.1.0-beta' of the devfile is not supported. Supported versions are '[1.0.0, 2.0.0, 2.1.0, 2.2.0-alpha]'."
},
{
"devfile/devfile_v2-1-0-alpha_with_invalid_plugin_definition.yaml",
"devfile/devfile_v2-1-0_with_invalid_plugin_definition.yaml",
"(/components/0/plugin):The object must not have a property whose name is \"plugin\".(/components/0):The object must have a property whose name is \"name\".Exactly one of the following sets of problems must be resolved.: [(/components/0):The object must have a property whose name is \"container\".(/components/0):The object must have a property whose name is \"kubernetes\".(/components/0):The object must have a property whose name is \"openshift\".(/components/0):The object must have a property whose name is \"volume\".]"
}
};

View File

@ -10,7 +10,7 @@
# Red Hat, Inc. - initial API and implementation
#
schemaVersion: 2.1.0-alpha
schemaVersion: 2.1.0
metadata:
name: spring-petclinic
attributes:

View File

@ -0,0 +1,28 @@
#
# Copyright (c) 2012-2021 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
#
schemaVersion: 2.2.0-alpha
metadata:
name: spring-petclinic
attributes:
example: foo
components:
- name: maven
container:
image: quay.io/eclipse/che-java8-maven:nightly
volumeMounts:
- name: mavenrepo
path: /root/.m2
env:
- name: ENV_VAR
value: value
memoryLimit: 1536M