Skip to content

Commit

Permalink
Ensure conversion for local source takes place
Browse files Browse the repository at this point in the history
Add code to move out data from spec.sources into spec.source
  • Loading branch information
qu1queee committed Oct 13, 2023
1 parent 4bd3b46 commit 3305fd7
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
10 changes: 9 additions & 1 deletion pkg/apis/build/v1beta1/build_conversion.go
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,15 @@ func (dest *BuildSpec) ConvertFrom(orig *v1alpha1.BuildSpec) error {

func (dest *BuildSpec) ConvertTo(bs *v1alpha1.BuildSpec) error {
// Handle BuildSpec Source
bs.Source = getAlphaBuildSource(*dest)
if dest.Source.Type == LocalType {
bs.Sources = []v1alpha1.BuildSource{}
bs.Sources = append(bs.Sources, v1alpha1.BuildSource{
Name: dest.Source.LocalSource.Name,
Type: v1alpha1.LocalCopy,
})
} else {
bs.Source = getAlphaBuildSource(*dest)
}

// Handle BuildSpec Trigger
if dest.Trigger != nil {
Expand Down
9 changes: 9 additions & 0 deletions pkg/apis/build/v1beta1/source.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ type Local struct {
//
// +optional
Timeout *metav1.Duration `json:"timeout,omitempty"`

// Name of the local step
//
Name string `json:"name,omitempty"`
}

// Git describes the git repository to pull
Expand Down Expand Up @@ -101,4 +105,9 @@ type Source struct {
//
// +optional
GitSource *Git `json:"git,omitempty"`

// LocalSource
//
// +optional
LocalSource *Local `json:"local,omitempty"`
}

0 comments on commit 3305fd7

Please sign in to comment.