-
Notifications
You must be signed in to change notification settings - Fork 66
Dockerfile Outerloop Support #580
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 all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
1227010
Add Image Comp, add Deploy Cmd Kind & handle conversion to v1alpha1
maysunfaisal b0da511
Move GitLocation into Git project source
amisevsk 2c6e194
Address PR reviews, update src
maysunfaisal 7270526
Add variable subs for image component
maysunfaisal 468c2fe
Add more tests for the new image component
maysunfaisal 12f8991
Apply Outerloop PR feedback
maysunfaisal da87678
Review feedback: Update var name, nesting and test coverage
maysunfaisal 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
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
496 changes: 488 additions & 8 deletions
496
crds/workspace.devfile.io_devworkspacetemplates.v1beta1.yaml
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
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,38 @@ | ||
package v1alpha2 | ||
|
||
// ImageType describes the type of image. | ||
// Only one of the following image type may be specified. | ||
// +kubebuilder:validation:Enum=Dockerfile | ||
type ImageType string | ||
|
||
const ( | ||
DockerfileImageType ImageType = "Dockerfile" | ||
) | ||
|
||
type BaseImage struct { | ||
} | ||
|
||
// Component that allows the developer to build a runtime image for outerloop | ||
type ImageComponent struct { | ||
BaseComponent `json:",inline"` | ||
Image `json:",inline"` | ||
} | ||
|
||
type Image struct { | ||
// Name of the image for the resulting outerloop build | ||
ImageName string `json:"imageName"` | ||
ImageUnion `json:",inline"` | ||
} | ||
|
||
// +union | ||
type ImageUnion struct { | ||
// Type of image | ||
// | ||
// +unionDiscriminator | ||
// +optional | ||
ImageType ImageType `json:"imageType,omitempty"` | ||
|
||
// Allows specifying dockerfile type build | ||
// +optional | ||
Dockerfile *DockerfileImage `json:"dockerfile,omitempty"` | ||
} |
81 changes: 81 additions & 0 deletions
81
pkg/apis/workspaces/v1alpha2/component_image_dockerfile.go
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,81 @@ | ||
package v1alpha2 | ||
|
||
// DockerfileSrcType describes the type of | ||
// the src for the Dockerfile outerloop build. | ||
// Only one of the following location type may be specified. | ||
// +kubebuilder:validation:Enum=Uri;DevfileRegistry;Git | ||
type DockerfileSrcType string | ||
|
||
const ( | ||
UriLikeDockerfileSrcType DockerfileSrcType = "Uri" | ||
DevfileRegistryLikeDockerfileSrcType DockerfileSrcType = "DevfileRegistry" | ||
GitLikeDockerfileSrcType DockerfileSrcType = "Git" | ||
) | ||
|
||
// Dockerfile Image type to specify the outerloop build using a Dockerfile | ||
type DockerfileImage struct { | ||
BaseImage `json:",inline"` | ||
DockerfileSrc `json:",inline"` | ||
Dockerfile `json:",inline"` | ||
} | ||
|
||
// +union | ||
type DockerfileSrc struct { | ||
// Type of Dockerfile src | ||
// + | ||
// +unionDiscriminator | ||
// +optional | ||
SrcType DockerfileSrcType `json:"srcType,omitempty"` | ||
|
||
// URI Reference of a Dockerfile. | ||
// It can be a full URL or a relative URI from the current devfile as the base URI. | ||
// +optional | ||
Uri string `json:"uri,omitempty"` | ||
|
||
// Dockerfile's Devfile Registry source | ||
// +optional | ||
DevfileRegistry *DockerfileDevfileRegistrySource `json:"devfileRegistry,omitempty"` | ||
|
||
// Dockerfile's Git source | ||
// +optional | ||
Git *DockerfileGitProjectSource `json:"git,omitempty"` | ||
} | ||
|
||
type Dockerfile struct { | ||
// Path of source directory to establish build context. Defaults to ${PROJECT_ROOT} in the container | ||
// +optional | ||
BuildContext string `json:"buildContext,omitempty"` | ||
|
||
// The arguments to supply to the dockerfile build. | ||
// +optional | ||
Args []string `json:"args,omitempty" patchStrategy:"replace"` | ||
|
||
// Specify if a privileged builder pod is required. | ||
// | ||
// Default value is `false` | ||
// +optional | ||
RootRequired *bool `json:"rootRequired,omitempty"` | ||
} | ||
|
||
type DockerfileDevfileRegistrySource struct { | ||
// Id in a devfile registry that contains a Dockerfile. The src in the OCI registry | ||
maysunfaisal marked this conversation as resolved.
Show resolved
Hide resolved
|
||
// required for the Dockerfile build will be downloaded for building the image. | ||
Id string `json:"id"` | ||
|
||
// Devfile Registry URL to pull the Dockerfile from when using the Devfile Registry as Dockerfile src. | ||
// To ensure the Dockerfile gets resolved consistently in different environments, | ||
// it is recommended to always specify the `devfileRegistryUrl` when `Id` is used. | ||
// +optional | ||
RegistryUrl string `json:"registryUrl,omitempty"` | ||
} | ||
|
||
type DockerfileGitProjectSource struct { | ||
// Git src for the Dockerfile build. The src required for the Dockerfile build will need to be | ||
// cloned for building the image. | ||
GitProjectSource `json:",inline"` | ||
|
||
// Location of the Dockerfile in the Git repository when using git as Dockerfile src. | ||
// Defaults to Dockerfile. | ||
// +optional | ||
FileLocation string `json:"fileLocation,omitempty"` | ||
} |
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
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.