Skip to content

Commit 12f8991

Browse files
committed
Apply Outerloop PR feedback
Signed-off-by: Maysun J Faisal <[email protected]>
1 parent 468c2fe commit 12f8991

38 files changed

+1849
-1646
lines changed

crds/workspace.devfile.io_devworkspaces.v1beta1.yaml

+156-142
Large diffs are not rendered by default.

crds/workspace.devfile.io_devworkspaces.yaml

+156-142
Large diffs are not rendered by default.

crds/workspace.devfile.io_devworkspacetemplates.v1beta1.yaml

+148-137
Large diffs are not rendered by default.

crds/workspace.devfile.io_devworkspacetemplates.yaml

+148-137
Large diffs are not rendered by default.

pkg/apis/workspaces/v1alpha1/commands_conversion.go

+37-36
Original file line numberDiff line numberDiff line change
@@ -58,47 +58,48 @@ func getGroup(dc v1alpha2.Command) *v1alpha2.CommandGroup {
5858
}
5959

6060
func convertCommandFrom_v1alpha2(src *v1alpha2.Command, dest *Command) error {
61-
if src != nil {
62-
id := src.Key()
61+
if src == nil {
62+
return nil
63+
}
6364

64-
srcCmdGroup := getGroup(*src)
65-
if srcCmdGroup != nil && srcCmdGroup.Kind == v1alpha2.DeployCommandGroupKind {
66-
// skip converting deploy kind commands as deploy kind commands are not supported in v1alpha1
67-
return nil
68-
}
65+
id := src.Key()
6966

70-
jsonCommand, err := json.Marshal(src)
71-
if err != nil {
72-
return err
73-
}
74-
err = json.Unmarshal(jsonCommand, dest)
67+
srcCmdGroup := getGroup(*src)
68+
if srcCmdGroup != nil && srcCmdGroup.Kind == v1alpha2.DeployCommandGroupKind {
69+
// skip converting deploy kind commands as deploy kind commands are not supported in v1alpha1
70+
return nil
71+
}
72+
73+
jsonCommand, err := json.Marshal(src)
74+
if err != nil {
75+
return err
76+
}
77+
err = json.Unmarshal(jsonCommand, dest)
78+
if err != nil {
79+
return err
80+
}
81+
var destAttributes map[string]string
82+
if src.Attributes != nil {
83+
destAttributes = make(map[string]string)
84+
err = convertAttributesFrom_v1alpha2(&src.Attributes, destAttributes)
7585
if err != nil {
7686
return err
7787
}
78-
var destAttributes map[string]string
79-
if src.Attributes != nil {
80-
destAttributes = make(map[string]string)
81-
err = convertAttributesFrom_v1alpha2(&src.Attributes, destAttributes)
82-
if err != nil {
83-
return err
84-
}
85-
}
88+
}
8689

87-
switch {
88-
case dest.Apply != nil:
89-
dest.Apply.Attributes = destAttributes
90-
dest.Apply.Id = id
91-
case dest.Composite != nil:
92-
dest.Composite.Attributes = destAttributes
93-
dest.Composite.Id = id
94-
case dest.Custom != nil:
95-
dest.Custom.Attributes = destAttributes
96-
dest.Custom.Id = id
97-
case dest.Exec != nil:
98-
dest.Exec.Attributes = destAttributes
99-
dest.Exec.Id = id
100-
}
101-
return err
90+
switch {
91+
case dest.Apply != nil:
92+
dest.Apply.Attributes = destAttributes
93+
dest.Apply.Id = id
94+
case dest.Composite != nil:
95+
dest.Composite.Attributes = destAttributes
96+
dest.Composite.Id = id
97+
case dest.Custom != nil:
98+
dest.Custom.Attributes = destAttributes
99+
dest.Custom.Id = id
100+
case dest.Exec != nil:
101+
dest.Exec.Attributes = destAttributes
102+
dest.Exec.Id = id
102103
}
103-
return nil
104+
return err
104105
}

pkg/apis/workspaces/v1alpha2/component_image_dockerfile.go

+17-16
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,31 @@
11
package v1alpha2
22

3-
// DockerfileLocationType describes the type of
4-
// the location for the Dockerfile outerloop build.
3+
// DockerfileSrcType describes the type of
4+
// the src for the Dockerfile outerloop build.
55
// Only one of the following location type may be specified.
6-
// +kubebuilder:validation:Enum=Uri;Registry;Git
7-
type DockerfileLocationType string
6+
// +kubebuilder:validation:Enum=Uri;DevfileRegistry;Git
7+
type DockerfileSrcType string
88

99
const (
10-
UriLikeDockerfileLocationType DockerfileLocationType = "Uri"
11-
RegistryLikeDockerfileLocationType DockerfileLocationType = "Registry"
12-
GitLikeDockerfileLocationType DockerfileLocationType = "Git"
10+
UriLikeDockerfileSrcType DockerfileSrcType = "Uri"
11+
DevfileRegistryLikeDockerfileSrcType DockerfileSrcType = "DevfileRegistry"
12+
GitLikeDockerfileSrcType DockerfileSrcType = "Git"
1313
)
1414

1515
// Dockerfile Image type to specify the outerloop build using a Dockerfile
1616
type DockerfileImage struct {
17-
BaseImage `json:",inline"`
18-
DockerfileLocation `json:",inline"`
19-
Dockerfile `json:",inline"`
17+
BaseImage `json:",inline"`
18+
DockerfileSrc `json:",inline"`
19+
Dockerfile `json:",inline"`
2020
}
2121

2222
// +union
23-
type DockerfileLocation struct {
24-
// Type of Dockerfile location
23+
type DockerfileSrc struct {
24+
// Type of Dockerfile src
2525
// +
2626
// +unionDiscriminator
2727
// +optional
28-
LocationType DockerfileLocationType `json:"locationType,omitempty"`
28+
SrcType DockerfileSrcType `json:"srcType,omitempty"`
2929

3030
// URI Reference of a Dockerfile.
3131
// It can be a full URL or a relative URI from the current devfile as the base URI.
@@ -34,7 +34,7 @@ type DockerfileLocation struct {
3434

3535
// Dockerfile's Devfile Registry source
3636
// +optional
37-
Registry *DockerfileDevfileRegistrySource `json:"registry,omitempty"`
37+
DevfileRegistry *DockerfileDevfileRegistrySource `json:"devfileRegistry,omitempty"`
3838

3939
// Dockerfile's Git source
4040
// +optional
@@ -66,7 +66,7 @@ type DockerfileDevfileRegistrySource struct {
6666
// To ensure the Dockerfile gets resolved consistently in different environments,
6767
// it is recommended to always specify the `devfileRegistryUrl` when `Id` is used.
6868
// +optional
69-
DevfileRegistryUrl string `json:"devfileRegistryUrl,omitempty"`
69+
RegistryUrl string `json:"registryUrl,omitempty"`
7070
}
7171

7272
type DockerfileGitProjectSource struct {
@@ -75,6 +75,7 @@ type DockerfileGitProjectSource struct {
7575
GitProjectSource `json:",inline"`
7676

7777
// Location of the Dockerfile in the Git repository when using git as Dockerfile src.
78+
// Defaults to Dockerfile.
7879
// +optional
79-
GitLocation string `json:"gitLocation,omitempty"`
80+
FileLocation string `json:"fileLocation,omitempty"`
8081
}

pkg/apis/workspaces/v1alpha2/projects.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ type GitLikeProjectSource struct {
110110
CheckoutFrom *CheckoutFrom `json:"checkoutFrom,omitempty"`
111111

112112
// The remotes map which should be initialized in the git project.
113-
// Projects must have at least one remote configured while StarterProjects can only have at most one remote configured.
113+
// Projects must have at least one remote configured while StarterProjects & Image Component's Git source can only have at most one remote configured.
114114
Remotes map[string]string `json:"remotes"`
115115
}
116116

0 commit comments

Comments
 (0)