-
Notifications
You must be signed in to change notification settings - Fork 36
use api override and merging utils to get flatterned devfile #48
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
Merged
Merged
Changes from 11 commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
e1cfa62
test api's override func
maysunfaisal 66a47ae
rebase with master
maysunfaisal ef34115
added parseplugin
yangcao77 0fa0338
parse flatterned devfile and raw devfile
yangcao77 0d08514
commit go mod
yangcao77 1ba75b4
checkout the old devfile
yangcao77 84c2d55
resolve conflict
yangcao77 55a7af2
pull latest api repo
yangcao77 4d02f8b
fix the unit test
yangcao77 be272c3
run go mod tidy
yangcao77 70e85e6
address review comments
yangcao77 b658fa4
add more unit tests
yangcao77 8c7cbd6
block recersive reference
yangcao77 cd34c20
add a new unit test to test for dup uri in multiple references
yangcao77 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package v2 | ||
|
||
import ( | ||
v1 "github.com/devfile/api/pkg/apis/workspaces/v1alpha2" | ||
) | ||
|
||
// GetDevfileWorkspace returns the workspace content for the devfile | ||
func (d *DevfileV2) GetDevfileWorkspace() *v1.DevWorkspaceTemplateSpecContent { | ||
|
||
return &d.DevWorkspaceTemplateSpecContent | ||
} | ||
|
||
// SetDevfileWorkspace sets the workspace content | ||
func (d *DevfileV2) SetDevfileWorkspace(content v1.DevWorkspaceTemplateSpecContent) { | ||
d.DevWorkspaceTemplateSpecContent = content | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
package v2 | ||
|
||
import ( | ||
"reflect" | ||
"testing" | ||
|
||
v1 "github.com/devfile/api/pkg/apis/workspaces/v1alpha2" | ||
) | ||
|
||
func TestDevfile200_SetDevfileWorkspace(t *testing.T) { | ||
|
||
type args struct { | ||
name string | ||
} | ||
tests := []struct { | ||
name string | ||
workspace v1.DevWorkspaceTemplateSpecContent | ||
devfilev2 *DevfileV2 | ||
expectedDevfilev2 *DevfileV2 | ||
}{ | ||
{ | ||
name: "set workspace", | ||
devfilev2: &DevfileV2{ | ||
v1.Devfile{}, | ||
}, | ||
workspace: v1.DevWorkspaceTemplateSpecContent{ | ||
Components: []v1.Component{ | ||
{ | ||
Name: "component1", | ||
ComponentUnion: v1.ComponentUnion{ | ||
Container: &v1.ContainerComponent{}, | ||
}, | ||
}, | ||
{ | ||
Name: "component2", | ||
ComponentUnion: v1.ComponentUnion{ | ||
Volume: &v1.VolumeComponent{}, | ||
}, | ||
}, | ||
}, | ||
}, | ||
expectedDevfilev2: &DevfileV2{ | ||
v1.Devfile{ | ||
DevWorkspaceTemplateSpec: v1.DevWorkspaceTemplateSpec{ | ||
DevWorkspaceTemplateSpecContent: v1.DevWorkspaceTemplateSpecContent{ | ||
Components: []v1.Component{ | ||
{ | ||
Name: "component1", | ||
ComponentUnion: v1.ComponentUnion{ | ||
Container: &v1.ContainerComponent{}, | ||
}, | ||
}, | ||
{ | ||
Name: "component2", | ||
ComponentUnion: v1.ComponentUnion{ | ||
Volume: &v1.VolumeComponent{}, | ||
}, | ||
}, | ||
}, | ||
}, | ||
}, | ||
}, | ||
}, | ||
}, | ||
} | ||
for _, tt := range tests { | ||
t.Run(tt.name, func(t *testing.T) { | ||
tt.devfilev2.SetDevfileWorkspace(tt.workspace) | ||
if !reflect.DeepEqual(tt.devfilev2, tt.expectedDevfilev2) { | ||
t.Errorf("TestDevfile200_SetDevfileWorkspace() expected %v, got %v", tt.expectedDevfilev2, tt.devfilev2) | ||
} | ||
}) | ||
} | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.