Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Warning if version of Devfile is different from 2.2.0 #7065

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions ododevapispec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1642,6 +1642,7 @@ components:
type: object
required:
- content
- version
- commands
- containers
- images
Expand All @@ -1652,6 +1653,8 @@ components:
properties:
content:
type: string
version:
type: string
commands:
type: array
items:
Expand Down
3 changes: 3 additions & 0 deletions pkg/apiserver-gen/go/model_devfile_content.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions pkg/apiserver-impl/devstate/commands_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ components:
metadata: {}
schemaVersion: 2.2.0
`,
Version: "2.2.0",
Commands: []Command{
{
Name: "an-exec-command",
Expand Down Expand Up @@ -183,6 +184,7 @@ components:
metadata: {}
schemaVersion: 2.2.0
`,
Version: "2.2.0",
Commands: []Command{
{
Name: "an-apply-command",
Expand Down Expand Up @@ -311,6 +313,7 @@ components:
metadata: {}
schemaVersion: 2.2.0
`,
Version: "2.2.0",
Commands: []Command{
{
Name: "an-exec-command",
Expand Down Expand Up @@ -440,6 +443,7 @@ func TestDevfileState_DeleteCommand(t *testing.T) {
metadata: {}
schemaVersion: 2.2.0
`,
Version: "2.2.0",
Commands: []Command{},
Containers: []Container{
{
Expand Down Expand Up @@ -655,6 +659,7 @@ func TestDevfileState_MoveCommand(t *testing.T) {
metadata: {}
schemaVersion: 2.2.0
`,
Version: "2.2.0",
Commands: []Command{
{
Name: "an-exec-command",
Expand Down Expand Up @@ -742,6 +747,7 @@ func TestDevfileState_SetDefaultCommand(t *testing.T) {
metadata: {}
schemaVersion: 2.2.0
`,
Version: "2.2.0",
Commands: []Command{
{
Name: "an-exec-command",
Expand Down Expand Up @@ -831,6 +837,7 @@ func TestDevfileState_UnsetDefaultCommand(t *testing.T) {
metadata: {}
schemaVersion: 2.2.0
`,
Version: "2.2.0",
Commands: []Command{
{
Name: "an-exec-command",
Expand Down
10 changes: 10 additions & 0 deletions pkg/apiserver-impl/devstate/components_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ func TestDevfileState_AddContainer(t *testing.T) {
metadata: {}
schemaVersion: 2.2.0
`,
Version: "2.2.0",
Commands: []Command{},
Containers: []Container{
{
Expand Down Expand Up @@ -150,6 +151,7 @@ schemaVersion: 2.2.0
metadata: {}
schemaVersion: 2.2.0
`,
Version: "2.2.0",
Commands: []Command{},
Containers: []Container{
{
Expand Down Expand Up @@ -243,6 +245,7 @@ func TestDevfileState_DeleteContainer(t *testing.T) {
Content: `metadata: {}
schemaVersion: 2.2.0
`,
Version: "2.2.0",
Commands: []Command{},
Containers: []Container{},
Images: []Image{},
Expand Down Expand Up @@ -349,6 +352,7 @@ func TestDevfileState_AddImage(t *testing.T) {
metadata: {}
schemaVersion: 2.2.0
`,
Version: "2.2.0",
Commands: []Command{},
Containers: []Container{},
Images: []Image{
Expand Down Expand Up @@ -424,6 +428,7 @@ func TestDevfileState_DeleteImage(t *testing.T) {
Content: `metadata: {}
schemaVersion: 2.2.0
`,
Version: "2.2.0",
Commands: []Command{},
Containers: []Container{},
Images: []Image{},
Expand Down Expand Up @@ -507,6 +512,7 @@ func TestDevfileState_AddResource(t *testing.T) {
metadata: {}
schemaVersion: 2.2.0
`,
Version: "2.2.0",
Commands: []Command{},
Containers: []Container{},
Images: []Image{},
Expand Down Expand Up @@ -539,6 +545,7 @@ schemaVersion: 2.2.0
metadata: {}
schemaVersion: 2.2.0
`,
Version: "2.2.0",
Commands: []Command{},
Containers: []Container{},
Images: []Image{},
Expand Down Expand Up @@ -607,6 +614,7 @@ func TestDevfileState_Deleteresource(t *testing.T) {
Content: `metadata: {}
schemaVersion: 2.2.0
`,
Version: "2.2.0",
Commands: []Command{},
Containers: []Container{},
Images: []Image{},
Expand Down Expand Up @@ -688,6 +696,7 @@ func TestDevfileState_AddVolume(t *testing.T) {
metadata: {}
schemaVersion: 2.2.0
`,
Version: "2.2.0",
Commands: []Command{},
Containers: []Container{},
Images: []Image{},
Expand Down Expand Up @@ -753,6 +762,7 @@ func TestDevfileState_DeleteVolume(t *testing.T) {
Content: `metadata: {}
schemaVersion: 2.2.0
`,
Version: "2.2.0",
Commands: []Command{},
Containers: []Container{},
Images: []Image{},
Expand Down
1 change: 1 addition & 0 deletions pkg/apiserver-impl/devstate/content.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ func (o *DevfileState) GetContent() (DevfileContent, error) {

return DevfileContent{
Content: string(result),
Version: o.Devfile.Data.GetSchemaVersion(),
Commands: commands,
Containers: containers,
Images: images,
Expand Down
1 change: 1 addition & 0 deletions pkg/apiserver-impl/devstate/content_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ func TestDevfileState_GetContent(t *testing.T) {
},
want: DevfileContent{
Content: "metadata: {}\nschemaVersion: 2.2.0\n",
Version: "2.2.0",
Commands: []Command{},
Containers: []Container{},
Images: []Image{},
Expand Down
2 changes: 2 additions & 0 deletions pkg/apiserver-impl/devstate/events_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ func TestDevfileState_UpdateEvents(t *testing.T) {
metadata: {}
schemaVersion: 2.2.0
`,
Version: "2.2.0",
Commands: []Command{},
Containers: []Container{},
Images: []Image{},
Expand Down Expand Up @@ -67,6 +68,7 @@ schemaVersion: 2.2.0
metadata: {}
schemaVersion: 2.2.0
`,
Version: "2.2.0",
Commands: []Command{},
Containers: []Container{},
Images: []Image{},
Expand Down
1 change: 1 addition & 0 deletions pkg/apiserver-impl/devstate/state_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ func TestDevfileState_SetMetadata(t *testing.T) {
website: http://example.com
schemaVersion: 2.2.0
`,
Version: "2.2.0",
Commands: []Command{},
Containers: []Container{},
Images: []Image{},
Expand Down
3 changes: 3 additions & 0 deletions pkg/apiserver-impl/swagger-ui/swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1642,6 +1642,7 @@ components:
type: object
required:
- content
- version
- commands
- containers
- images
Expand All @@ -1652,6 +1653,8 @@ components:
properties:
content:
type: string
version:
type: string
commands:
type: array
items:
Expand Down
2 changes: 1 addition & 1 deletion pkg/apiserver-impl/ui/index.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions ui/src/app/api-gen/model/devfileContent.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions ui/src/app/app.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,10 @@ export class AppComponent implements OnInit {
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 => {
Expand Down