Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions api/definitions/v1.imagesource/description.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
ImageSource is used to describe build source that will be extracted from an image. A reference of
type ImageStreamTag, ImageStreamImage or DockerImage may be used. A pull secret can be specified
to pull the image from an external registry or override the default service account secret if pulling
from the internal registry. A list of paths to copy from the image and their respective destination
within the build directory must be specified in the paths array.
3 changes: 3 additions & 0 deletions api/definitions/v1.imagesourcepath/description.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
ImageSourcePath specifies the absolute path of a file or directory within a source image
to be copied to a relative directory of the build home. If a source directory is specified, all
files and directories under that directory are copied from the image.
45 changes: 45 additions & 0 deletions api/swagger-spec/oapi-v1.json
Original file line number Diff line number Diff line change
Expand Up @@ -14703,6 +14703,10 @@
"$ref": "v1.GitBuildSource",
"description": "optional information about git build source"
},
"image": {
"$ref": "v1.ImageSource",
"description": "optional image build source"
},
"contextDir": {
"type": "string",
"description": "specifies sub-directory where the source code for the application exists, allows for sources to be built from a directory other than the root of a repository"
Expand Down Expand Up @@ -14746,6 +14750,47 @@
}
}
},
"v1.ImageSource": {
"id": "v1.ImageSource",
"required": [
"from",
"paths"
],
"properties": {
"from": {
"$ref": "v1.ObjectReference",
"description": "reference to ImageStreamTag, ImageStreamImage, or DockerImage"
},
"paths": {
"type": "array",
"items": {
"$ref": "v1.ImageSourcePath"
},
"description": "paths to copy from image"
},
"pullSecret": {
"$ref": "v1.LocalObjectReference",
"description": "overrides the default pull secret for the source image"
}
}
},
"v1.ImageSourcePath": {
"id": "v1.ImageSourcePath",
"required": [
"sourcePath",
"destinationDir"
],
"properties": {
"sourcePath": {
"type": "string",
"description": "source path (directory or file) inside image"
},
"destinationDir": {
"type": "string",
"description": "relative destination directory in build home"
}
}
},
"v1.LocalObjectReference": {
"id": "v1.LocalObjectReference",
"description": "LocalObjectReference contains enough information to let you locate the referenced object inside the same namespace.",
Expand Down
44 changes: 44 additions & 0 deletions pkg/api/deep_copy_generated.go
Original file line number Diff line number Diff line change
Expand Up @@ -966,6 +966,14 @@ func deepCopy_api_BuildSource(in buildapi.BuildSource, out *buildapi.BuildSource
} else {
out.Git = nil
}
if in.Image != nil {
out.Image = new(buildapi.ImageSource)
if err := deepCopy_api_ImageSource(*in.Image, out.Image, c); err != nil {
return err
}
} else {
out.Image = nil
}
out.ContextDir = in.ContextDir
if in.SourceSecret != nil {
if newVal, err := c.DeepCopy(in.SourceSecret); err != nil {
Expand Down Expand Up @@ -1219,6 +1227,40 @@ func deepCopy_api_ImageChangeTrigger(in buildapi.ImageChangeTrigger, out *builda
return nil
}

func deepCopy_api_ImageSource(in buildapi.ImageSource, out *buildapi.ImageSource, c *conversion.Cloner) error {
if newVal, err := c.DeepCopy(in.From); err != nil {
return err
} else {
out.From = newVal.(pkgapi.ObjectReference)
}
if in.Paths != nil {
out.Paths = make([]buildapi.ImageSourcePath, len(in.Paths))
for i := range in.Paths {
if err := deepCopy_api_ImageSourcePath(in.Paths[i], &out.Paths[i], c); err != nil {
return err
}
}
} else {
out.Paths = nil
}
if in.PullSecret != nil {
if newVal, err := c.DeepCopy(in.PullSecret); err != nil {
return err
} else {
out.PullSecret = newVal.(*pkgapi.LocalObjectReference)
}
} else {
out.PullSecret = nil
}
return nil
}

func deepCopy_api_ImageSourcePath(in buildapi.ImageSourcePath, out *buildapi.ImageSourcePath, c *conversion.Cloner) error {
out.SourcePath = in.SourcePath
out.DestinationDir = in.DestinationDir
return nil
}

func deepCopy_api_SecretSpec(in buildapi.SecretSpec, out *buildapi.SecretSpec, c *conversion.Cloner) error {
if newVal, err := c.DeepCopy(in.SecretSource); err != nil {
return err
Expand Down Expand Up @@ -2896,6 +2938,8 @@ func init() {
deepCopy_api_GitBuildSource,
deepCopy_api_GitSourceRevision,
deepCopy_api_ImageChangeTrigger,
deepCopy_api_ImageSource,
deepCopy_api_ImageSourcePath,
deepCopy_api_SecretSpec,
deepCopy_api_SourceBuildStrategy,
deepCopy_api_SourceControlUser,
Expand Down
110 changes: 110 additions & 0 deletions pkg/api/v1/conversion_generated.go
Original file line number Diff line number Diff line change
Expand Up @@ -1418,6 +1418,14 @@ func autoconvert_api_BuildSource_To_v1_BuildSource(in *buildapi.BuildSource, out
} else {
out.Git = nil
}
if in.Image != nil {
out.Image = new(apiv1.ImageSource)
if err := convert_api_ImageSource_To_v1_ImageSource(in.Image, out.Image, s); err != nil {
return err
}
} else {
out.Image = nil
}
out.ContextDir = in.ContextDir
if in.SourceSecret != nil {
out.SourceSecret = new(pkgapiv1.LocalObjectReference)
Expand Down Expand Up @@ -1696,6 +1704,51 @@ func convert_api_ImageChangeTrigger_To_v1_ImageChangeTrigger(in *buildapi.ImageC
return autoconvert_api_ImageChangeTrigger_To_v1_ImageChangeTrigger(in, out, s)
}

func autoconvert_api_ImageSource_To_v1_ImageSource(in *buildapi.ImageSource, out *apiv1.ImageSource, s conversion.Scope) error {
if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found {
defaulting.(func(*buildapi.ImageSource))(in)
}
if err := convert_api_ObjectReference_To_v1_ObjectReference(&in.From, &out.From, s); err != nil {
return err
}
if in.Paths != nil {
out.Paths = make([]apiv1.ImageSourcePath, len(in.Paths))
for i := range in.Paths {
if err := convert_api_ImageSourcePath_To_v1_ImageSourcePath(&in.Paths[i], &out.Paths[i], s); err != nil {
return err
}
}
} else {
out.Paths = nil
}
if in.PullSecret != nil {
out.PullSecret = new(pkgapiv1.LocalObjectReference)
if err := convert_api_LocalObjectReference_To_v1_LocalObjectReference(in.PullSecret, out.PullSecret, s); err != nil {
return err
}
} else {
out.PullSecret = nil
}
return nil
}

func convert_api_ImageSource_To_v1_ImageSource(in *buildapi.ImageSource, out *apiv1.ImageSource, s conversion.Scope) error {
return autoconvert_api_ImageSource_To_v1_ImageSource(in, out, s)
}

func autoconvert_api_ImageSourcePath_To_v1_ImageSourcePath(in *buildapi.ImageSourcePath, out *apiv1.ImageSourcePath, s conversion.Scope) error {
if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found {
defaulting.(func(*buildapi.ImageSourcePath))(in)
}
out.SourcePath = in.SourcePath
out.DestinationDir = in.DestinationDir
return nil
}

func convert_api_ImageSourcePath_To_v1_ImageSourcePath(in *buildapi.ImageSourcePath, out *apiv1.ImageSourcePath, s conversion.Scope) error {
return autoconvert_api_ImageSourcePath_To_v1_ImageSourcePath(in, out, s)
}

func autoconvert_api_SecretSpec_To_v1_SecretSpec(in *buildapi.SecretSpec, out *apiv1.SecretSpec, s conversion.Scope) error {
if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found {
defaulting.(func(*buildapi.SecretSpec))(in)
Expand Down Expand Up @@ -2132,6 +2185,14 @@ func autoconvert_v1_BuildSource_To_api_BuildSource(in *apiv1.BuildSource, out *b
} else {
out.Git = nil
}
if in.Image != nil {
out.Image = new(buildapi.ImageSource)
if err := convert_v1_ImageSource_To_api_ImageSource(in.Image, out.Image, s); err != nil {
return err
}
} else {
out.Image = nil
}
out.ContextDir = in.ContextDir
if in.SourceSecret != nil {
out.SourceSecret = new(pkgapi.LocalObjectReference)
Expand Down Expand Up @@ -2411,6 +2472,51 @@ func convert_v1_ImageChangeTrigger_To_api_ImageChangeTrigger(in *apiv1.ImageChan
return autoconvert_v1_ImageChangeTrigger_To_api_ImageChangeTrigger(in, out, s)
}

func autoconvert_v1_ImageSource_To_api_ImageSource(in *apiv1.ImageSource, out *buildapi.ImageSource, s conversion.Scope) error {
if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found {
defaulting.(func(*apiv1.ImageSource))(in)
}
if err := convert_v1_ObjectReference_To_api_ObjectReference(&in.From, &out.From, s); err != nil {
return err
}
if in.Paths != nil {
out.Paths = make([]buildapi.ImageSourcePath, len(in.Paths))
for i := range in.Paths {
if err := convert_v1_ImageSourcePath_To_api_ImageSourcePath(&in.Paths[i], &out.Paths[i], s); err != nil {
return err
}
}
} else {
out.Paths = nil
}
if in.PullSecret != nil {
out.PullSecret = new(pkgapi.LocalObjectReference)
if err := convert_v1_LocalObjectReference_To_api_LocalObjectReference(in.PullSecret, out.PullSecret, s); err != nil {
return err
}
} else {
out.PullSecret = nil
}
return nil
}

func convert_v1_ImageSource_To_api_ImageSource(in *apiv1.ImageSource, out *buildapi.ImageSource, s conversion.Scope) error {
return autoconvert_v1_ImageSource_To_api_ImageSource(in, out, s)
}

func autoconvert_v1_ImageSourcePath_To_api_ImageSourcePath(in *apiv1.ImageSourcePath, out *buildapi.ImageSourcePath, s conversion.Scope) error {
if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found {
defaulting.(func(*apiv1.ImageSourcePath))(in)
}
out.SourcePath = in.SourcePath
out.DestinationDir = in.DestinationDir
return nil
}

func convert_v1_ImageSourcePath_To_api_ImageSourcePath(in *apiv1.ImageSourcePath, out *buildapi.ImageSourcePath, s conversion.Scope) error {
return autoconvert_v1_ImageSourcePath_To_api_ImageSourcePath(in, out, s)
}

func autoconvert_v1_SecretSpec_To_api_SecretSpec(in *apiv1.SecretSpec, out *buildapi.SecretSpec, s conversion.Scope) error {
if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found {
defaulting.(func(*apiv1.SecretSpec))(in)
Expand Down Expand Up @@ -5289,6 +5395,8 @@ func init() {
autoconvert_api_Identity_To_v1_Identity,
autoconvert_api_ImageChangeTrigger_To_v1_ImageChangeTrigger,
autoconvert_api_ImageList_To_v1_ImageList,
autoconvert_api_ImageSourcePath_To_v1_ImageSourcePath,
autoconvert_api_ImageSource_To_v1_ImageSource,
autoconvert_api_ImageStreamImage_To_v1_ImageStreamImage,
autoconvert_api_ImageStreamList_To_v1_ImageStreamList,
autoconvert_api_ImageStreamMapping_To_v1_ImageStreamMapping,
Expand Down Expand Up @@ -5398,6 +5506,8 @@ func init() {
autoconvert_v1_Identity_To_api_Identity,
autoconvert_v1_ImageChangeTrigger_To_api_ImageChangeTrigger,
autoconvert_v1_ImageList_To_api_ImageList,
autoconvert_v1_ImageSourcePath_To_api_ImageSourcePath,
autoconvert_v1_ImageSource_To_api_ImageSource,
autoconvert_v1_ImageStreamImage_To_api_ImageStreamImage,
autoconvert_v1_ImageStreamList_To_api_ImageStreamList,
autoconvert_v1_ImageStreamMapping_To_api_ImageStreamMapping,
Expand Down
44 changes: 44 additions & 0 deletions pkg/api/v1/deep_copy_generated.go
Original file line number Diff line number Diff line change
Expand Up @@ -991,6 +991,14 @@ func deepCopy_v1_BuildSource(in apiv1.BuildSource, out *apiv1.BuildSource, c *co
} else {
out.Git = nil
}
if in.Image != nil {
out.Image = new(apiv1.ImageSource)
if err := deepCopy_v1_ImageSource(*in.Image, out.Image, c); err != nil {
return err
}
} else {
out.Image = nil
}
out.ContextDir = in.ContextDir
if in.SourceSecret != nil {
if newVal, err := c.DeepCopy(in.SourceSecret); err != nil {
Expand Down Expand Up @@ -1245,6 +1253,40 @@ func deepCopy_v1_ImageChangeTrigger(in apiv1.ImageChangeTrigger, out *apiv1.Imag
return nil
}

func deepCopy_v1_ImageSource(in apiv1.ImageSource, out *apiv1.ImageSource, c *conversion.Cloner) error {
if newVal, err := c.DeepCopy(in.From); err != nil {
return err
} else {
out.From = newVal.(pkgapiv1.ObjectReference)
}
if in.Paths != nil {
out.Paths = make([]apiv1.ImageSourcePath, len(in.Paths))
for i := range in.Paths {
if err := deepCopy_v1_ImageSourcePath(in.Paths[i], &out.Paths[i], c); err != nil {
return err
}
}
} else {
out.Paths = nil
}
if in.PullSecret != nil {
if newVal, err := c.DeepCopy(in.PullSecret); err != nil {
return err
} else {
out.PullSecret = newVal.(*pkgapiv1.LocalObjectReference)
}
} else {
out.PullSecret = nil
}
return nil
}

func deepCopy_v1_ImageSourcePath(in apiv1.ImageSourcePath, out *apiv1.ImageSourcePath, c *conversion.Cloner) error {
out.SourcePath = in.SourcePath
out.DestinationDir = in.DestinationDir
return nil
}

func deepCopy_v1_SecretSpec(in apiv1.SecretSpec, out *apiv1.SecretSpec, c *conversion.Cloner) error {
if newVal, err := c.DeepCopy(in.SecretSource); err != nil {
return err
Expand Down Expand Up @@ -2811,6 +2853,8 @@ func init() {
deepCopy_v1_GitBuildSource,
deepCopy_v1_GitSourceRevision,
deepCopy_v1_ImageChangeTrigger,
deepCopy_v1_ImageSource,
deepCopy_v1_ImageSourcePath,
deepCopy_v1_SecretSpec,
deepCopy_v1_SourceBuildStrategy,
deepCopy_v1_SourceControlUser,
Expand Down
Loading