Skip to content
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

Update Storage Version to use v1beta1 #1463

Merged
merged 16 commits into from
Feb 20, 2024
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
17 changes: 15 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -215,11 +215,24 @@ jobs:
if [ "${POD_NAME}" != "" ]; then
RESTART_COUNT=$(echo "${PODS}" | jq -r ".items[] | select(.metadata.name == \"${POD_NAME}\") | .status.containerStatuses[0].restartCount")
if [ "${RESTART_COUNT}" != "0" ]; then
echo "# Previous logs:"
echo "# Build Controller Previous logs:"
kubectl -n shipwright-build logs "${POD_NAME}" --previous || true
fi
echo "# Logs:"
echo "# Build Controller Logs:"
kubectl -n shipwright-build logs "${POD_NAME}"
else
echo "# Pod is missing, there are no logs to retrieve, bailing out..."
fi

WEBHOOK_POD_NAME=$(echo "${PODS}" | jq -r '.items[] | select(.metadata.name | startswith("shipwright-build-webhook-")) | .metadata.name')
if [ "${WEBHOOK_POD_NAME}" != "" ]; then
RESTART_COUNT=$(echo "${PODS}" | jq -r ".items[] | select(.metadata.name == \"${WEBHOOK_POD_NAME}\") | .status.containerStatuses[0].restartCount")
if [ "${RESTART_COUNT}" != "0" ]; then
echo "# Build Webhook Previous logs:"
kubectl -n shipwright-build logs "${WEBHOOK_POD_NAME}" --previous || true
fi
echo "# Build Webhook Logs:"
kubectl -n shipwright-build logs "${WEBHOOK_POD_NAME}"
else
echo "# Pod is missing, there are no logs to retrieve, bailing out..."
fi
4 changes: 2 additions & 2 deletions deploy/crds/shipwright.io_buildruns.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6354,7 +6354,7 @@ spec:
- spec
type: object
served: true
storage: true
storage: false
subresources:
status: {}
- additionalPrinterColumns:
Expand Down Expand Up @@ -12580,7 +12580,7 @@ spec:
- spec
type: object
served: true
storage: false
storage: true
subresources:
status: {}

4 changes: 2 additions & 2 deletions deploy/crds/shipwright.io_builds.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2143,7 +2143,7 @@ spec:
- spec
type: object
served: true
storage: true
storage: false
subresources:
status: {}
- additionalPrinterColumns:
Expand Down Expand Up @@ -4197,7 +4197,7 @@ spec:
- spec
type: object
served: true
storage: false
storage: true
subresources:
status: {}

4 changes: 2 additions & 2 deletions deploy/crds/shipwright.io_buildstrategies.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2930,7 +2930,7 @@ spec:
type: object
type: object
served: true
storage: true
storage: false
subresources:
status: {}
- name: v1beta1
Expand Down Expand Up @@ -5026,7 +5026,7 @@ spec:
type: object
type: object
served: true
storage: false
storage: true
subresources:
status: {}

4 changes: 2 additions & 2 deletions deploy/crds/shipwright.io_clusterbuildstrategies.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2930,7 +2930,7 @@ spec:
type: object
type: object
served: true
storage: true
storage: false
subresources:
status: {}
- name: v1beta1
Expand Down Expand Up @@ -5026,7 +5026,7 @@ spec:
type: object
type: object
served: true
storage: false
storage: true
subresources:
status: {}

24 changes: 0 additions & 24 deletions pkg/apis/build/v1alpha1/build_conversion.go

This file was deleted.

1 change: 0 additions & 1 deletion pkg/apis/build/v1alpha1/build_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,6 @@ type BuildStatus struct {

// Build is the Schema representing a Build definition
// +kubebuilder:subresource:status
// +kubebuilder:storageversion
// +kubebuilder:resource:path=builds,scope=Namespaced
// +kubebuilder:printcolumn:name="Registered",type="string",JSONPath=".status.registered",description="The register status of the Build"
// +kubebuilder:printcolumn:name="Reason",type="string",JSONPath=".status.reason",description="The reason of the registered Build, either an error or succeed message"
Expand Down
24 changes: 0 additions & 24 deletions pkg/apis/build/v1alpha1/buildrun_conversion.go

This file was deleted.

1 change: 0 additions & 1 deletion pkg/apis/build/v1alpha1/buildrun_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,6 @@ type ServiceAccount struct {

// BuildRun is the Schema representing an instance of build execution
// +kubebuilder:subresource:status
// +kubebuilder:storageversion
// +kubebuilder:resource:path=buildruns,scope=Namespaced,shortName=br;brs
// +kubebuilder:printcolumn:name="Succeeded",type="string",JSONPath=".status.conditions[?(@.type==\"Succeeded\")].status",description="The Succeeded status of the BuildRun"
// +kubebuilder:printcolumn:name="Reason",type="string",JSONPath=".status.conditions[?(@.type==\"Succeeded\")].reason",description="The Succeeded reason of the BuildRun"
Expand Down
24 changes: 0 additions & 24 deletions pkg/apis/build/v1alpha1/buildstrategy_conversion.go

This file was deleted.

1 change: 0 additions & 1 deletion pkg/apis/build/v1alpha1/buildstrategy_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ const (

// BuildStrategy is the Schema representing a strategy in the namespace scope to build images from source code.
// +kubebuilder:subresource:status
// +kubebuilder:storageversion
// +kubebuilder:resource:path=buildstrategies,scope=Namespaced,shortName=bs;bss
type BuildStrategy struct {
metav1.TypeMeta `json:",inline"`
Expand Down
24 changes: 0 additions & 24 deletions pkg/apis/build/v1alpha1/clusterbuildstrategy_conversion.go

This file was deleted.

1 change: 0 additions & 1 deletion pkg/apis/build/v1alpha1/clusterbuildstrategy_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ const (

// ClusterBuildStrategy is the Schema representing a strategy in the cluster scope to build images from source code.
// +kubebuilder:subresource:status
// +kubebuilder:storageversion
// +kubebuilder:resource:path=clusterbuildstrategies,scope=Cluster,shortName=cbs;cbss
type ClusterBuildStrategy struct {
metav1.TypeMeta `json:",inline"`
Expand Down
16 changes: 16 additions & 0 deletions pkg/apis/build/v1beta1/build_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,7 @@ type BuildStatus struct {

// Build is the Schema representing a Build definition
// +kubebuilder:subresource:status
// +kubebuilder:storageversion
// +kubebuilder:resource:path=builds,scope=Namespaced
// +kubebuilder:printcolumn:name="Registered",type="string",JSONPath=".status.registered",description="The register status of the Build"
// +kubebuilder:printcolumn:name="Reason",type="string",JSONPath=".status.reason",description="The reason of the registered Build, either an error or succeed message"
Expand Down Expand Up @@ -274,3 +275,18 @@ type BuildRetention struct {
func init() {
SchemeBuilder.Register(&Build{}, &BuildList{})
}

// GetSourceCredentials returns the secret name for a Build Source
func (b Build) GetSourceCredentials() *string {
switch b.Spec.Source.Type {
case OCIArtifactType:
if b.Spec.Source.OCIArtifact != nil && b.Spec.Source.OCIArtifact.PullSecret != nil {
return b.Spec.Source.OCIArtifact.PullSecret
}
default:
if b.Spec.Source.GitSource != nil && b.Spec.Source.GitSource.CloneSecret != nil {
return b.Spec.Source.GitSource.CloneSecret
}
}
return nil
}
1 change: 1 addition & 0 deletions pkg/apis/build/v1beta1/buildrun_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,7 @@ type FailureDetails struct {

// BuildRun is the Schema representing an instance of build execution
// +kubebuilder:subresource:status
// +kubebuilder:storageversion
// +kubebuilder:resource:path=buildruns,scope=Namespaced,shortName=br;brs
// +kubebuilder:printcolumn:name="Succeeded",type="string",JSONPath=".status.conditions[?(@.type==\"Succeeded\")].status",description="The Succeeded status of the BuildRun"
// +kubebuilder:printcolumn:name="Reason",type="string",JSONPath=".status.conditions[?(@.type==\"Succeeded\")].reason",description="The Succeeded reason of the BuildRun"
Expand Down
1 change: 1 addition & 0 deletions pkg/apis/build/v1beta1/buildstrategy_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ const (

// BuildStrategy is the Schema representing a strategy in the namespace scope to build images from source code.
// +kubebuilder:subresource:status
// +kubebuilder:storageversion
// +kubebuilder:resource:path=buildstrategies,scope=Namespaced,shortName=bs;bss
type BuildStrategy struct {
metav1.TypeMeta `json:",inline"`
Expand Down
1 change: 1 addition & 0 deletions pkg/apis/build/v1beta1/clusterbuildstrategy_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ const (

// ClusterBuildStrategy is the Schema representing a strategy in the cluster scope to build images from source code.
// +kubebuilder:subresource:status
// +kubebuilder:storageversion
// +kubebuilder:resource:path=clusterbuildstrategies,scope=Cluster,shortName=cbs;cbss
type ClusterBuildStrategy struct {
metav1.TypeMeta `json:",inline"`
Expand Down
2 changes: 1 addition & 1 deletion pkg/image/delete_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import (
"github.com/google/go-containerregistry/pkg/v1/random"
"github.com/google/go-containerregistry/pkg/v1/remote"
"github.com/shipwright-io/build/pkg/image"
utils "github.com/shipwright-io/build/test/utils/v1alpha1"
utils "github.com/shipwright-io/build/test/utils/v1beta1"

. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
Expand Down
4 changes: 2 additions & 2 deletions pkg/reconciler/build/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import (
"sigs.k8s.io/controller-runtime/pkg/manager"
"sigs.k8s.io/controller-runtime/pkg/reconcile"

build "github.com/shipwright-io/build/pkg/apis/build/v1alpha1"
build "github.com/shipwright-io/build/pkg/apis/build/v1beta1"
"github.com/shipwright-io/build/pkg/config"
"github.com/shipwright-io/build/pkg/ctxlog"
buildmetrics "github.com/shipwright-io/build/pkg/metrics"
Expand All @@ -28,7 +28,7 @@ var validationTypes = [...]string{
validate.SourceURL,
validate.Secrets,
validate.Strategies,
validate.Sources,
validate.Source,
validate.BuildName,
validate.Envs,
validate.Triggers,
Expand Down
Loading
Loading