Updates name and id field in the devfile schema#3872
Updates name and id field in the devfile schema#3872openshift-merge-robot merged 2 commits intoredhat-developer:masterfrom
Conversation
|
Skipping CI for Draft Pull Request. |
e3bbcc2 to
5ed43e6
Compare
5ed43e6 to
7bf7c50
Compare
f85b4cc to
ec7ae47
Compare
| func validateCompositeCommand(data data.DevfileData, compositeCommand *common.Composite, parentCommands map[string]string, devfileCommands map[string]common.DevfileCommand) error { | ||
| if compositeCommand.Group != nil && compositeCommand.Group.Kind == common.RunCommandGroupType { | ||
| func validateCompositeCommand(data data.DevfileData, compositeCommand *common.DevfileCommand, parentCommands map[string]string, devfileCommands map[string]common.DevfileCommand) error { | ||
| if compositeCommand.Composite.Group != nil && compositeCommand.Composite.Group.Kind == common.RunCommandGroupType { |
There was a problem hiding this comment.
not important currently, compositeCommand.Composite.Group looking repetitive, parameter compositeCommand could be renamed to command.
There was a problem hiding this comment.
OK let's handle this in a separate issue.
2529968 to
de7d6bc
Compare
de7d6bc to
309677f
Compare
|
/approve |
|
/hold cancel |
| isComponentValid := false | ||
| for _, component := range components { | ||
| if command.Exec.Component == component.Container.Name { | ||
| if command.Exec.Component == component.Name { |
There was a problem hiding this comment.
I'm sorry, I was just glancing through. But does this mean the above statement is true if i have a volume component whose name matches the command exec component?
There was a problem hiding this comment.
Because i was working on a clean up PR #3912 that was touching these files
There was a problem hiding this comment.
@maysunfaisal Because of the new format for component names, I don't believe it's valid any more to have two components of different types, but with the same name.
There was a problem hiding this comment.
@maysunfaisal As mentioned by @johnmcollier, I don't think it will be possible with the new schema.
There was a problem hiding this comment.
No i meant what if I have an invalid devfile like this:
components:
- name: tools
container:
image: maysunfaisal/springbootbuild
memoryLimit: 768Mi
command: ['tail']
args: [ '-f', '/dev/null']
volumeMounts:
- name: springbootpvc
path: /data
mountSources: true
- name: springbootpvc
volume: {}
commands:
- id: defaultBuild
exec:
component: springbootpvc
commandLine: "/artifacts/bin/build-container-full.sh"
workingDir: /projects
group:
kind: build
isDefault: true
but i realized that component is coming from components := GetDevfileContainerComponents(data), so we're good :)
| @@ -4,10 +4,8 @@ import "strings" | |||
|
|
|||
| // GetID returns the ID of the command | |||
| func (dc DevfileCommand) GetID() string { | |||
There was a problem hiding this comment.
Wondering if we even need GetID anymore? It was mostly needed when the ID wasn't stored at the top level part of the command and we had to check either Composite or Exec to get it.
But TBH, we can remove in a later PR. It's fine to leave in now.
There was a problem hiding this comment.
Yeah, let's remove that in a later PR
There was a problem hiding this comment.
I think we can keep it in, its always neat to have helper funcs even if we can get it directly now :)
|
Just so everyone else knows, this explains the errors I've been getting: [odo] ✗ invalid devfile schema. errors :
[odo] - commands.0: Additional property id is not allowed
[odo] - commands.0.exec: id is required
[odo] - commands.1: Additional property id is not allowed
[odo] - commands.1.exec: id is required
[odo] - commands.2: Additional property id is not allowed
[odo] - commands.2.exec: id is required
[odo] - commands.3: Additional property id is not allowed
[odo] - commands.3.exec: id is required
[odo] - components.0: Additional property name is not allowed
[odo] - components.0.container: name is required
[odo] |
|
/approve Went through the code and all of this looks good to me. Tests pass. Lets get this merged! |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: cdrage, kadel The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
johnmcollier
left a comment
There was a problem hiding this comment.
Looked through changes, all looks fine to me, don't see anything glaring that couldn't wait for another PR later. Also tested manually seems to work fine.
Let's get this one in if there's no objections.
/lgtm
Codecov Report
@@ Coverage Diff @@
## master #3872 +/- ##
==========================================
+ Coverage 44.60% 44.78% +0.18%
==========================================
Files 143 143
Lines 13860 13911 +51
==========================================
+ Hits 6182 6230 +48
Misses 7089 7089
- Partials 589 592 +3
Continue to review full report at Codecov.
|
What type of PR is this?
/kind api-change
What does does this PR do / why we need it:
Updates the schema and changes the code according to it.
Which issue(s) this PR fixes:
Fixes #3822
PR acceptance criteria:
Unit test
Integration test
Documentation
I have read the test guidelines
How to test changes / Special notes to the reviewer: