-
Notifications
You must be signed in to change notification settings - Fork 113
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Convert for BuildStrategy and ClusterBuildStrategy
Add convertion functions Ensure converter knows about Strategies Minor fix for test cases
- Loading branch information
Showing
8 changed files
with
469 additions
and
23 deletions.
There are no files selected for viewing
This file contains 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,24 @@ | ||
// Copyright The Shipwright Contributors | ||
// | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
package v1alpha1 | ||
|
||
import ( | ||
"context" | ||
"fmt" | ||
|
||
"github.com/shipwright-io/build/pkg/webhook" | ||
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" | ||
) | ||
|
||
// ensure v1beta1 implements the Conversion interface | ||
var _ webhook.Conversion = (*BuildRun)(nil) | ||
|
||
func (src *BuildRun) ConvertTo(ctx context.Context, obj *unstructured.Unstructured) error { | ||
return fmt.Errorf("v1alpha1 is the current storage version, nothing to convert to") | ||
} | ||
|
||
func (src *BuildRun) ConvertFrom(ctx context.Context, obj *unstructured.Unstructured) error { | ||
return fmt.Errorf("v1alpha1 is the current storage version, nothing to convert from") | ||
} |
This file contains 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,24 @@ | ||
// Copyright The Shipwright Contributors | ||
// | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
package v1alpha1 | ||
|
||
import ( | ||
"context" | ||
"fmt" | ||
|
||
"github.com/shipwright-io/build/pkg/webhook" | ||
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" | ||
) | ||
|
||
// ensure v1beta1 implements the Conversion interface | ||
var _ webhook.Conversion = (*BuildStrategy)(nil) | ||
|
||
func (src *BuildStrategy) ConvertTo(ctx context.Context, obj *unstructured.Unstructured) error { | ||
return fmt.Errorf("v1alpha1 is the current storage version, nothing to convert to") | ||
} | ||
|
||
func (src *BuildStrategy) ConvertFrom(ctx context.Context, obj *unstructured.Unstructured) error { | ||
return fmt.Errorf("v1alpha1 is the current storage version, nothing to convert from") | ||
} |
24 changes: 24 additions & 0 deletions
24
pkg/apis/build/v1alpha1/clusterbuildstrategy_conversion.go
This file contains 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,24 @@ | ||
// Copyright The Shipwright Contributors | ||
// | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
package v1alpha1 | ||
|
||
import ( | ||
"context" | ||
"fmt" | ||
|
||
"github.com/shipwright-io/build/pkg/webhook" | ||
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" | ||
) | ||
|
||
// ensure v1beta1 implements the Conversion interface | ||
var _ webhook.Conversion = (*ClusterBuildStrategy)(nil) | ||
|
||
func (src *ClusterBuildStrategy) ConvertTo(ctx context.Context, obj *unstructured.Unstructured) error { | ||
return fmt.Errorf("v1alpha1 is the current storage version, nothing to convert to") | ||
} | ||
|
||
func (src *ClusterBuildStrategy) ConvertFrom(ctx context.Context, obj *unstructured.Unstructured) error { | ||
return fmt.Errorf("v1alpha1 is the current storage version, nothing to convert from") | ||
} |
This file contains 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 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.