mirror of
https://github.com/redhat-developer/odo.git
synced 2025-10-19 03:06:19 +03:00
Warning if version of Devfile is different from 2.2.0 (#7065)
* Warning if version of Devfile is different from 2.2.0 * Fix unit tests
This commit is contained in:
@@ -1642,6 +1642,7 @@ components:
|
|||||||
type: object
|
type: object
|
||||||
required:
|
required:
|
||||||
- content
|
- content
|
||||||
|
- version
|
||||||
- commands
|
- commands
|
||||||
- containers
|
- containers
|
||||||
- images
|
- images
|
||||||
@@ -1652,6 +1653,8 @@ components:
|
|||||||
properties:
|
properties:
|
||||||
content:
|
content:
|
||||||
type: string
|
type: string
|
||||||
|
version:
|
||||||
|
type: string
|
||||||
commands:
|
commands:
|
||||||
type: array
|
type: array
|
||||||
items:
|
items:
|
||||||
|
|||||||
3
pkg/apiserver-gen/go/model_devfile_content.go
generated
3
pkg/apiserver-gen/go/model_devfile_content.go
generated
@@ -12,6 +12,8 @@ package openapi
|
|||||||
type DevfileContent struct {
|
type DevfileContent struct {
|
||||||
Content string `json:"content"`
|
Content string `json:"content"`
|
||||||
|
|
||||||
|
Version string `json:"version"`
|
||||||
|
|
||||||
Commands []Command `json:"commands"`
|
Commands []Command `json:"commands"`
|
||||||
|
|
||||||
Containers []Container `json:"containers"`
|
Containers []Container `json:"containers"`
|
||||||
@@ -31,6 +33,7 @@ type DevfileContent struct {
|
|||||||
func AssertDevfileContentRequired(obj DevfileContent) error {
|
func AssertDevfileContentRequired(obj DevfileContent) error {
|
||||||
elements := map[string]interface{}{
|
elements := map[string]interface{}{
|
||||||
"content": obj.Content,
|
"content": obj.Content,
|
||||||
|
"version": obj.Version,
|
||||||
"commands": obj.Commands,
|
"commands": obj.Commands,
|
||||||
"containers": obj.Containers,
|
"containers": obj.Containers,
|
||||||
"images": obj.Images,
|
"images": obj.Images,
|
||||||
|
|||||||
@@ -83,6 +83,7 @@ components:
|
|||||||
metadata: {}
|
metadata: {}
|
||||||
schemaVersion: 2.2.0
|
schemaVersion: 2.2.0
|
||||||
`,
|
`,
|
||||||
|
Version: "2.2.0",
|
||||||
Commands: []Command{
|
Commands: []Command{
|
||||||
{
|
{
|
||||||
Name: "an-exec-command",
|
Name: "an-exec-command",
|
||||||
@@ -183,6 +184,7 @@ components:
|
|||||||
metadata: {}
|
metadata: {}
|
||||||
schemaVersion: 2.2.0
|
schemaVersion: 2.2.0
|
||||||
`,
|
`,
|
||||||
|
Version: "2.2.0",
|
||||||
Commands: []Command{
|
Commands: []Command{
|
||||||
{
|
{
|
||||||
Name: "an-apply-command",
|
Name: "an-apply-command",
|
||||||
@@ -311,6 +313,7 @@ components:
|
|||||||
metadata: {}
|
metadata: {}
|
||||||
schemaVersion: 2.2.0
|
schemaVersion: 2.2.0
|
||||||
`,
|
`,
|
||||||
|
Version: "2.2.0",
|
||||||
Commands: []Command{
|
Commands: []Command{
|
||||||
{
|
{
|
||||||
Name: "an-exec-command",
|
Name: "an-exec-command",
|
||||||
@@ -440,6 +443,7 @@ func TestDevfileState_DeleteCommand(t *testing.T) {
|
|||||||
metadata: {}
|
metadata: {}
|
||||||
schemaVersion: 2.2.0
|
schemaVersion: 2.2.0
|
||||||
`,
|
`,
|
||||||
|
Version: "2.2.0",
|
||||||
Commands: []Command{},
|
Commands: []Command{},
|
||||||
Containers: []Container{
|
Containers: []Container{
|
||||||
{
|
{
|
||||||
@@ -655,6 +659,7 @@ func TestDevfileState_MoveCommand(t *testing.T) {
|
|||||||
metadata: {}
|
metadata: {}
|
||||||
schemaVersion: 2.2.0
|
schemaVersion: 2.2.0
|
||||||
`,
|
`,
|
||||||
|
Version: "2.2.0",
|
||||||
Commands: []Command{
|
Commands: []Command{
|
||||||
{
|
{
|
||||||
Name: "an-exec-command",
|
Name: "an-exec-command",
|
||||||
@@ -742,6 +747,7 @@ func TestDevfileState_SetDefaultCommand(t *testing.T) {
|
|||||||
metadata: {}
|
metadata: {}
|
||||||
schemaVersion: 2.2.0
|
schemaVersion: 2.2.0
|
||||||
`,
|
`,
|
||||||
|
Version: "2.2.0",
|
||||||
Commands: []Command{
|
Commands: []Command{
|
||||||
{
|
{
|
||||||
Name: "an-exec-command",
|
Name: "an-exec-command",
|
||||||
@@ -831,6 +837,7 @@ func TestDevfileState_UnsetDefaultCommand(t *testing.T) {
|
|||||||
metadata: {}
|
metadata: {}
|
||||||
schemaVersion: 2.2.0
|
schemaVersion: 2.2.0
|
||||||
`,
|
`,
|
||||||
|
Version: "2.2.0",
|
||||||
Commands: []Command{
|
Commands: []Command{
|
||||||
{
|
{
|
||||||
Name: "an-exec-command",
|
Name: "an-exec-command",
|
||||||
|
|||||||
@@ -78,6 +78,7 @@ func TestDevfileState_AddContainer(t *testing.T) {
|
|||||||
metadata: {}
|
metadata: {}
|
||||||
schemaVersion: 2.2.0
|
schemaVersion: 2.2.0
|
||||||
`,
|
`,
|
||||||
|
Version: "2.2.0",
|
||||||
Commands: []Command{},
|
Commands: []Command{},
|
||||||
Containers: []Container{
|
Containers: []Container{
|
||||||
{
|
{
|
||||||
@@ -150,6 +151,7 @@ schemaVersion: 2.2.0
|
|||||||
metadata: {}
|
metadata: {}
|
||||||
schemaVersion: 2.2.0
|
schemaVersion: 2.2.0
|
||||||
`,
|
`,
|
||||||
|
Version: "2.2.0",
|
||||||
Commands: []Command{},
|
Commands: []Command{},
|
||||||
Containers: []Container{
|
Containers: []Container{
|
||||||
{
|
{
|
||||||
@@ -243,6 +245,7 @@ func TestDevfileState_DeleteContainer(t *testing.T) {
|
|||||||
Content: `metadata: {}
|
Content: `metadata: {}
|
||||||
schemaVersion: 2.2.0
|
schemaVersion: 2.2.0
|
||||||
`,
|
`,
|
||||||
|
Version: "2.2.0",
|
||||||
Commands: []Command{},
|
Commands: []Command{},
|
||||||
Containers: []Container{},
|
Containers: []Container{},
|
||||||
Images: []Image{},
|
Images: []Image{},
|
||||||
@@ -349,6 +352,7 @@ func TestDevfileState_AddImage(t *testing.T) {
|
|||||||
metadata: {}
|
metadata: {}
|
||||||
schemaVersion: 2.2.0
|
schemaVersion: 2.2.0
|
||||||
`,
|
`,
|
||||||
|
Version: "2.2.0",
|
||||||
Commands: []Command{},
|
Commands: []Command{},
|
||||||
Containers: []Container{},
|
Containers: []Container{},
|
||||||
Images: []Image{
|
Images: []Image{
|
||||||
@@ -424,6 +428,7 @@ func TestDevfileState_DeleteImage(t *testing.T) {
|
|||||||
Content: `metadata: {}
|
Content: `metadata: {}
|
||||||
schemaVersion: 2.2.0
|
schemaVersion: 2.2.0
|
||||||
`,
|
`,
|
||||||
|
Version: "2.2.0",
|
||||||
Commands: []Command{},
|
Commands: []Command{},
|
||||||
Containers: []Container{},
|
Containers: []Container{},
|
||||||
Images: []Image{},
|
Images: []Image{},
|
||||||
@@ -507,6 +512,7 @@ func TestDevfileState_AddResource(t *testing.T) {
|
|||||||
metadata: {}
|
metadata: {}
|
||||||
schemaVersion: 2.2.0
|
schemaVersion: 2.2.0
|
||||||
`,
|
`,
|
||||||
|
Version: "2.2.0",
|
||||||
Commands: []Command{},
|
Commands: []Command{},
|
||||||
Containers: []Container{},
|
Containers: []Container{},
|
||||||
Images: []Image{},
|
Images: []Image{},
|
||||||
@@ -539,6 +545,7 @@ schemaVersion: 2.2.0
|
|||||||
metadata: {}
|
metadata: {}
|
||||||
schemaVersion: 2.2.0
|
schemaVersion: 2.2.0
|
||||||
`,
|
`,
|
||||||
|
Version: "2.2.0",
|
||||||
Commands: []Command{},
|
Commands: []Command{},
|
||||||
Containers: []Container{},
|
Containers: []Container{},
|
||||||
Images: []Image{},
|
Images: []Image{},
|
||||||
@@ -607,6 +614,7 @@ func TestDevfileState_Deleteresource(t *testing.T) {
|
|||||||
Content: `metadata: {}
|
Content: `metadata: {}
|
||||||
schemaVersion: 2.2.0
|
schemaVersion: 2.2.0
|
||||||
`,
|
`,
|
||||||
|
Version: "2.2.0",
|
||||||
Commands: []Command{},
|
Commands: []Command{},
|
||||||
Containers: []Container{},
|
Containers: []Container{},
|
||||||
Images: []Image{},
|
Images: []Image{},
|
||||||
@@ -688,6 +696,7 @@ func TestDevfileState_AddVolume(t *testing.T) {
|
|||||||
metadata: {}
|
metadata: {}
|
||||||
schemaVersion: 2.2.0
|
schemaVersion: 2.2.0
|
||||||
`,
|
`,
|
||||||
|
Version: "2.2.0",
|
||||||
Commands: []Command{},
|
Commands: []Command{},
|
||||||
Containers: []Container{},
|
Containers: []Container{},
|
||||||
Images: []Image{},
|
Images: []Image{},
|
||||||
@@ -753,6 +762,7 @@ func TestDevfileState_DeleteVolume(t *testing.T) {
|
|||||||
Content: `metadata: {}
|
Content: `metadata: {}
|
||||||
schemaVersion: 2.2.0
|
schemaVersion: 2.2.0
|
||||||
`,
|
`,
|
||||||
|
Version: "2.2.0",
|
||||||
Commands: []Command{},
|
Commands: []Command{},
|
||||||
Containers: []Container{},
|
Containers: []Container{},
|
||||||
Images: []Image{},
|
Images: []Image{},
|
||||||
|
|||||||
@@ -54,6 +54,7 @@ func (o *DevfileState) GetContent() (DevfileContent, error) {
|
|||||||
|
|
||||||
return DevfileContent{
|
return DevfileContent{
|
||||||
Content: string(result),
|
Content: string(result),
|
||||||
|
Version: o.Devfile.Data.GetSchemaVersion(),
|
||||||
Commands: commands,
|
Commands: commands,
|
||||||
Containers: containers,
|
Containers: containers,
|
||||||
Images: images,
|
Images: images,
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ func TestDevfileState_GetContent(t *testing.T) {
|
|||||||
},
|
},
|
||||||
want: DevfileContent{
|
want: DevfileContent{
|
||||||
Content: "metadata: {}\nschemaVersion: 2.2.0\n",
|
Content: "metadata: {}\nschemaVersion: 2.2.0\n",
|
||||||
|
Version: "2.2.0",
|
||||||
Commands: []Command{},
|
Commands: []Command{},
|
||||||
Containers: []Container{},
|
Containers: []Container{},
|
||||||
Images: []Image{},
|
Images: []Image{},
|
||||||
|
|||||||
@@ -35,6 +35,7 @@ func TestDevfileState_UpdateEvents(t *testing.T) {
|
|||||||
metadata: {}
|
metadata: {}
|
||||||
schemaVersion: 2.2.0
|
schemaVersion: 2.2.0
|
||||||
`,
|
`,
|
||||||
|
Version: "2.2.0",
|
||||||
Commands: []Command{},
|
Commands: []Command{},
|
||||||
Containers: []Container{},
|
Containers: []Container{},
|
||||||
Images: []Image{},
|
Images: []Image{},
|
||||||
@@ -67,6 +68,7 @@ schemaVersion: 2.2.0
|
|||||||
metadata: {}
|
metadata: {}
|
||||||
schemaVersion: 2.2.0
|
schemaVersion: 2.2.0
|
||||||
`,
|
`,
|
||||||
|
Version: "2.2.0",
|
||||||
Commands: []Command{},
|
Commands: []Command{},
|
||||||
Containers: []Container{},
|
Containers: []Container{},
|
||||||
Images: []Image{},
|
Images: []Image{},
|
||||||
|
|||||||
@@ -71,6 +71,7 @@ func TestDevfileState_SetMetadata(t *testing.T) {
|
|||||||
website: http://example.com
|
website: http://example.com
|
||||||
schemaVersion: 2.2.0
|
schemaVersion: 2.2.0
|
||||||
`,
|
`,
|
||||||
|
Version: "2.2.0",
|
||||||
Commands: []Command{},
|
Commands: []Command{},
|
||||||
Containers: []Container{},
|
Containers: []Container{},
|
||||||
Images: []Image{},
|
Images: []Image{},
|
||||||
|
|||||||
@@ -1642,6 +1642,7 @@ components:
|
|||||||
type: object
|
type: object
|
||||||
required:
|
required:
|
||||||
- content
|
- content
|
||||||
|
- version
|
||||||
- commands
|
- commands
|
||||||
- containers
|
- containers
|
||||||
- images
|
- images
|
||||||
@@ -1652,6 +1653,8 @@ components:
|
|||||||
properties:
|
properties:
|
||||||
content:
|
content:
|
||||||
type: string
|
type: string
|
||||||
|
version:
|
||||||
|
type: string
|
||||||
commands:
|
commands:
|
||||||
type: array
|
type: array
|
||||||
items:
|
items:
|
||||||
|
|||||||
2
pkg/apiserver-impl/ui/index.html
generated
2
pkg/apiserver-impl/ui/index.html
generated
@@ -11,6 +11,6 @@
|
|||||||
<body class="mat-typography">
|
<body class="mat-typography">
|
||||||
<div id="loading">Loading, please wait...</div>
|
<div id="loading">Loading, please wait...</div>
|
||||||
<app-root></app-root>
|
<app-root></app-root>
|
||||||
<script src="runtime.1289ea0acffcdc5e.js" type="module"></script><script src="polyfills.8b3b37cedaf377c3.js" type="module"></script><script src="main.113aa354c1f3bda4.js" type="module"></script>
|
<script src="runtime.1289ea0acffcdc5e.js" type="module"></script><script src="polyfills.8b3b37cedaf377c3.js" type="module"></script><script src="main.4d8dc3ef32c88ca3.js" type="module"></script>
|
||||||
|
|
||||||
</body></html>
|
</body></html>
|
||||||
File diff suppressed because one or more lines are too long
1
ui/src/app/api-gen/model/devfileContent.ts
generated
1
ui/src/app/api-gen/model/devfileContent.ts
generated
@@ -20,6 +20,7 @@ import { Image } from './image';
|
|||||||
|
|
||||||
export interface DevfileContent {
|
export interface DevfileContent {
|
||||||
content: string;
|
content: string;
|
||||||
|
version: string;
|
||||||
commands: Array<Command>;
|
commands: Array<Command>;
|
||||||
containers: Array<Container>;
|
containers: Array<Container>;
|
||||||
images: Array<Image>;
|
images: Array<Image>;
|
||||||
|
|||||||
@@ -84,6 +84,10 @@ export class AppComponent implements OnInit {
|
|||||||
console.log(error);
|
console.log(error);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (newContent.version != "2.2.0") {
|
||||||
|
this.snackbar.open("The version of the Devfile is "+newContent.version+".\nOnly version 2.2.0 is supported", "ok")
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
this.sse.subscribeTo(['DevfileUpdated']).subscribe(event => {
|
this.sse.subscribeTo(['DevfileUpdated']).subscribe(event => {
|
||||||
|
|||||||
Reference in New Issue
Block a user