Skip to content

Commit 9934140

Browse files
authored
Prevent v1 devfiles from being used (#3777)
* Remove leftover v1 devfile check Signed-off-by: John Collier <John.J.Collier@ibm.com> * Add integration test Signed-off-by: John Collier <John.J.Collier@ibm.com> * Fix typos Signed-off-by: John Collier <John.J.Collier@ibm.com>
1 parent b0c2aeb commit 9934140

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

pkg/devfile/validate/validate.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ func ValidateDevfileData(data interface{}) error {
1616

1717
switch d := data.(type) {
1818
case *v100.Devfile100:
19-
components = d.GetComponents()
19+
return fmt.Errorf("unsupported devfile version. Only devfiles with schema version 2.0.0 are supported")
2020
case *v200.Devfile200:
2121
components = d.GetComponents()
2222

tests/integration/devfile/cmd_devfile_push_test.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -586,6 +586,16 @@ var _ = Describe("odo devfile push command tests", func() {
586586
Expect(storageSize).To(ContainSubstring("3Gi"))
587587
})
588588

589+
It("should throw a validation error for v1 devfiles", func() {
590+
helper.CmdShouldPass("odo", "create", "java-springboot", "--project", namespace, cmpName)
591+
592+
helper.CopyExampleDevFile(filepath.Join("source", "devfilesV1", "springboot", "devfile-init.yaml"), filepath.Join(context, "devfile.yaml"))
593+
594+
// Verify odo push failed
595+
output := helper.CmdShouldFail("odo", "push", "--context", context)
596+
Expect(output).To(ContainSubstring("unsupported devfile version"))
597+
})
598+
589599
})
590600

591601
Context("when .gitignore file exists", func() {

0 commit comments

Comments
 (0)