diff --git a/deploy/crds/base/jvmbuildservice.io_dependencybuilds.yaml b/deploy/crds/base/jvmbuildservice.io_dependencybuilds.yaml index 80c7737a7..6fa3f883c 100644 --- a/deploy/crds/base/jvmbuildservice.io_dependencybuilds.yaml +++ b/deploy/crds/base/jvmbuildservice.io_dependencybuilds.yaml @@ -270,76 +270,10 @@ spec: type: string type: object type: array - currentBuildRecipe: - description: BuildRecipe the current build recipe. If build is done - then this recipe was used to get to the current state Deprecated - properties: - additionalDownloads: - items: - properties: - binaryPath: - type: string - fileName: - type: string - packageName: - type: string - sha256: - type: string - type: - type: string - uri: - type: string - required: - - type - type: object - type: array - additionalMemory: - type: integer - allowedDifferences: - items: - type: string - type: array - commandLine: - items: - type: string - type: array - disableSubmodules: - type: boolean - enforceVersion: - type: string - image: - type: string - javaVersion: - type: string - pipeline: - description: Deprecated - type: string - postBuildScript: - type: string - preBuildScript: - type: string - repositories: - items: - type: string - type: array - tool: - type: string - toolVersion: - type: string - toolVersions: - additionalProperties: - type: string - type: object - type: object deployedArtifacts: items: type: string type: array - diagnosticDockerFiles: - description: Deprecated - items: - type: string - type: array discoveryPipelineResults: description: A representation of the Tekton Results records for a pipeline @@ -351,77 +285,10 @@ spec: result: type: string type: object - failedBuildRecipes: - description: FailedBuildRecipes recipes that resulted in a failure - if the current state is failed this may include the current BuildRecipe - Deprecated - items: - properties: - additionalDownloads: - items: - properties: - binaryPath: - type: string - fileName: - type: string - packageName: - type: string - sha256: - type: string - type: - type: string - uri: - type: string - required: - - type - type: object - type: array - additionalMemory: - type: integer - allowedDifferences: - items: - type: string - type: array - commandLine: - items: - type: string - type: array - disableSubmodules: - type: boolean - enforceVersion: - type: string - image: - type: string - javaVersion: - type: string - pipeline: - description: Deprecated - type: string - postBuildScript: - type: string - preBuildScript: - type: string - repositories: - items: - type: string - type: array - tool: - type: string - toolVersion: - type: string - toolVersions: - additionalProperties: - type: string - type: object - type: object - type: array failedVerification: type: boolean hermetic: type: boolean - lastCompletedBuildPipelineRun: - description: Deprecated - type: string message: type: string pipelineRetries: diff --git a/deploy/crds/base/jvmbuildservice.io_jbsconfigs.yaml b/deploy/crds/base/jvmbuildservice.io_jbsconfigs.yaml index c1edffedf..dfadb6a02 100644 --- a/deploy/crds/base/jvmbuildservice.io_jbsconfigs.yaml +++ b/deploy/crds/base/jvmbuildservice.io_jbsconfigs.yaml @@ -96,10 +96,6 @@ spec: type: object hermeticBuilds: type: string - host: - type: string - insecure: - type: boolean mavenBaseLocations: additionalProperties: type: string @@ -111,12 +107,6 @@ spec: username: type: string type: object - owner: - type: string - port: - type: string - prependTag: - type: string registry: properties: host: @@ -167,15 +157,11 @@ spec: - relocationPattern type: object type: array - repository: - type: string requireArtifactVerification: description: If this is true then the build will fail if artifact verification fails otherwise deploy will happen as normal, but a field will be set on the DependencyBuild type: boolean - secretName: - type: string sharedRegistries: items: properties: diff --git a/java-components/adhoc-analyser-tool/src/main/java/com/redhat/hacbs/analyser/kube/ResetDependencyBuildsCommand.java b/java-components/adhoc-analyser-tool/src/main/java/com/redhat/hacbs/analyser/kube/ResetDependencyBuildsCommand.java index 9a55a0012..8a735e139 100644 --- a/java-components/adhoc-analyser-tool/src/main/java/com/redhat/hacbs/analyser/kube/ResetDependencyBuildsCommand.java +++ b/java-components/adhoc-analyser-tool/src/main/java/com/redhat/hacbs/analyser/kube/ResetDependencyBuildsCommand.java @@ -1,6 +1,5 @@ package com.redhat.hacbs.analyser.kube; -import java.util.Collections; import java.util.List; import jakarta.inject.Inject; @@ -33,14 +32,14 @@ public void run() { if (!build.isEmpty()) { DependencyBuild item = client.withName(build).get(); item.getStatus().setState(""); - item.getStatus().setFailedBuildRecipes(Collections.emptyList()); + // item.getStatus().setFailedBuildRecipes(Collections.emptyList()); client.updateStatus(item); } else { List items = client.list().getItems(); for (var request : items) { if (!failedOnly || request.getStatus().getState().equals("DependencyBuildStateFailed")) { request.getStatus().setState(""); - request.getStatus().setFailedBuildRecipes(Collections.emptyList()); + // request.getStatus().setFailedBuildRecipes(Collections.emptyList()); client.updateStatus(request); } } diff --git a/java-components/resource-model/src/main/resources/crds/jvmbuildservice.io_dependencybuilds.yaml b/java-components/resource-model/src/main/resources/crds/jvmbuildservice.io_dependencybuilds.yaml index 80c7737a7..6fa3f883c 100644 --- a/java-components/resource-model/src/main/resources/crds/jvmbuildservice.io_dependencybuilds.yaml +++ b/java-components/resource-model/src/main/resources/crds/jvmbuildservice.io_dependencybuilds.yaml @@ -270,76 +270,10 @@ spec: type: string type: object type: array - currentBuildRecipe: - description: BuildRecipe the current build recipe. If build is done - then this recipe was used to get to the current state Deprecated - properties: - additionalDownloads: - items: - properties: - binaryPath: - type: string - fileName: - type: string - packageName: - type: string - sha256: - type: string - type: - type: string - uri: - type: string - required: - - type - type: object - type: array - additionalMemory: - type: integer - allowedDifferences: - items: - type: string - type: array - commandLine: - items: - type: string - type: array - disableSubmodules: - type: boolean - enforceVersion: - type: string - image: - type: string - javaVersion: - type: string - pipeline: - description: Deprecated - type: string - postBuildScript: - type: string - preBuildScript: - type: string - repositories: - items: - type: string - type: array - tool: - type: string - toolVersion: - type: string - toolVersions: - additionalProperties: - type: string - type: object - type: object deployedArtifacts: items: type: string type: array - diagnosticDockerFiles: - description: Deprecated - items: - type: string - type: array discoveryPipelineResults: description: A representation of the Tekton Results records for a pipeline @@ -351,77 +285,10 @@ spec: result: type: string type: object - failedBuildRecipes: - description: FailedBuildRecipes recipes that resulted in a failure - if the current state is failed this may include the current BuildRecipe - Deprecated - items: - properties: - additionalDownloads: - items: - properties: - binaryPath: - type: string - fileName: - type: string - packageName: - type: string - sha256: - type: string - type: - type: string - uri: - type: string - required: - - type - type: object - type: array - additionalMemory: - type: integer - allowedDifferences: - items: - type: string - type: array - commandLine: - items: - type: string - type: array - disableSubmodules: - type: boolean - enforceVersion: - type: string - image: - type: string - javaVersion: - type: string - pipeline: - description: Deprecated - type: string - postBuildScript: - type: string - preBuildScript: - type: string - repositories: - items: - type: string - type: array - tool: - type: string - toolVersion: - type: string - toolVersions: - additionalProperties: - type: string - type: object - type: object - type: array failedVerification: type: boolean hermetic: type: boolean - lastCompletedBuildPipelineRun: - description: Deprecated - type: string message: type: string pipelineRetries: diff --git a/java-components/resource-model/src/main/resources/crds/jvmbuildservice.io_jbsconfigs.yaml b/java-components/resource-model/src/main/resources/crds/jvmbuildservice.io_jbsconfigs.yaml index c1edffedf..dfadb6a02 100644 --- a/java-components/resource-model/src/main/resources/crds/jvmbuildservice.io_jbsconfigs.yaml +++ b/java-components/resource-model/src/main/resources/crds/jvmbuildservice.io_jbsconfigs.yaml @@ -96,10 +96,6 @@ spec: type: object hermeticBuilds: type: string - host: - type: string - insecure: - type: boolean mavenBaseLocations: additionalProperties: type: string @@ -111,12 +107,6 @@ spec: username: type: string type: object - owner: - type: string - port: - type: string - prependTag: - type: string registry: properties: host: @@ -167,15 +157,11 @@ spec: - relocationPattern type: object type: array - repository: - type: string requireArtifactVerification: description: If this is true then the build will fail if artifact verification fails otherwise deploy will happen as normal, but a field will be set on the DependencyBuild type: boolean - secretName: - type: string sharedRegistries: items: properties: diff --git a/pkg/apis/jvmbuildservice/v1alpha1/dependencybuild_types.go b/pkg/apis/jvmbuildservice/v1alpha1/dependencybuild_types.go index 48d7cd514..46e3a338a 100644 --- a/pkg/apis/jvmbuildservice/v1alpha1/dependencybuild_types.go +++ b/pkg/apis/jvmbuildservice/v1alpha1/dependencybuild_types.go @@ -29,27 +29,15 @@ type DependencyBuildStatus struct { State string `json:"state,omitempty"` Message string `json:"message,omitempty"` Contaminants []Contaminant `json:"contaminates,omitempty"` - //BuildRecipe the current build recipe. If build is done then this recipe was used - //to get to the current state - // Deprecated - DeprecatedCurrentBuildRecipe *BuildRecipe `json:"currentBuildRecipe,omitempty"` // PotentialBuildRecipes additional recipes to try if the current recipe fails - PotentialBuildRecipes []*BuildRecipe `json:"potentialBuildRecipes,omitempty"` - //FailedBuildRecipes recipes that resulted in a failure - //if the current state is failed this may include the current BuildRecipe - //Deprecated - DeprecatedFailedBuildRecipes []*BuildRecipe `json:"failedBuildRecipes,omitempty"` - //Deprecated - DeprecatedLastCompletedBuildPipelineRun string `json:"lastCompletedBuildPipelineRun,omitempty"` - CommitTime int64 `json:"commitTime,omitempty"` - DeployedArtifacts []string `json:"deployedArtifacts,omitempty"` - FailedVerification bool `json:"failedVerification,omitempty"` - Hermetic bool `json:"hermetic,omitempty"` - // Deprecated - DeprecatedDiagnosticDockerFiles []string `json:"diagnosticDockerFiles,omitempty"` - PipelineRetries int `json:"pipelineRetries,omitempty"` - BuildAttempts []*BuildAttempt `json:"buildAttempts,omitempty"` - DiscoveryPipelineResults *PipelineResults `json:"discoveryPipelineResults,omitempty"` + PotentialBuildRecipes []*BuildRecipe `json:"potentialBuildRecipes,omitempty"` + CommitTime int64 `json:"commitTime,omitempty"` + DeployedArtifacts []string `json:"deployedArtifacts,omitempty"` + FailedVerification bool `json:"failedVerification,omitempty"` + Hermetic bool `json:"hermetic,omitempty"` + PipelineRetries int `json:"pipelineRetries,omitempty"` + BuildAttempts []*BuildAttempt `json:"buildAttempts,omitempty"` + DiscoveryPipelineResults *PipelineResults `json:"discoveryPipelineResults,omitempty"` } // +genclient diff --git a/pkg/apis/jvmbuildservice/v1alpha1/jbsconfig_types.go b/pkg/apis/jvmbuildservice/v1alpha1/jbsconfig_types.go index 53b7f95c5..2e44361ce 100644 --- a/pkg/apis/jvmbuildservice/v1alpha1/jbsconfig_types.go +++ b/pkg/apis/jvmbuildservice/v1alpha1/jbsconfig_types.go @@ -48,12 +48,10 @@ type JBSConfigSpec struct { MavenBaseLocations map[string]string `json:"mavenBaseLocations,omitempty"` - SharedRegistries []ImageRegistry `json:"sharedRegistries,omitempty"` - Registry ImageRegistrySpec `json:"registry,omitempty"` - MavenDeployment MavenDeployment `json:"mavenDeployment,omitempty"` - GitSourceArchive GitSourceArchive `json:"gitSourceArchive,omitempty"` - // Deprecated: Replaced by explicit declaration of Registry above. - ImageRegistry `json:",inline,omitempty"` + SharedRegistries []ImageRegistry `json:"sharedRegistries,omitempty"` + Registry ImageRegistrySpec `json:"registry,omitempty"` + MavenDeployment MavenDeployment `json:"mavenDeployment,omitempty"` + GitSourceArchive GitSourceArchive `json:"gitSourceArchive,omitempty"` CacheSettings CacheSettings `json:"cacheSettings,omitempty"` BuildSettings BuildSettings `json:"buildSettings,omitempty"` RelocationPatterns []RelocationPatternElement `json:"relocationPatterns,omitempty"` diff --git a/pkg/apis/jvmbuildservice/v1alpha1/zz_generated.deepcopy.go b/pkg/apis/jvmbuildservice/v1alpha1/zz_generated.deepcopy.go index 5ccd4bded..ec22b012b 100644 --- a/pkg/apis/jvmbuildservice/v1alpha1/zz_generated.deepcopy.go +++ b/pkg/apis/jvmbuildservice/v1alpha1/zz_generated.deepcopy.go @@ -415,11 +415,6 @@ func (in *DependencyBuildStatus) DeepCopyInto(out *DependencyBuildStatus) { (*in)[i].DeepCopyInto(&(*out)[i]) } } - if in.DeprecatedCurrentBuildRecipe != nil { - in, out := &in.DeprecatedCurrentBuildRecipe, &out.DeprecatedCurrentBuildRecipe - *out = new(BuildRecipe) - (*in).DeepCopyInto(*out) - } if in.PotentialBuildRecipes != nil { in, out := &in.PotentialBuildRecipes, &out.PotentialBuildRecipes *out = make([]*BuildRecipe, len(*in)) @@ -431,27 +426,11 @@ func (in *DependencyBuildStatus) DeepCopyInto(out *DependencyBuildStatus) { } } } - if in.DeprecatedFailedBuildRecipes != nil { - in, out := &in.DeprecatedFailedBuildRecipes, &out.DeprecatedFailedBuildRecipes - *out = make([]*BuildRecipe, len(*in)) - for i := range *in { - if (*in)[i] != nil { - in, out := &(*in)[i], &(*out)[i] - *out = new(BuildRecipe) - (*in).DeepCopyInto(*out) - } - } - } if in.DeployedArtifacts != nil { in, out := &in.DeployedArtifacts, &out.DeployedArtifacts *out = make([]string, len(*in)) copy(*out, *in) } - if in.DeprecatedDiagnosticDockerFiles != nil { - in, out := &in.DeprecatedDiagnosticDockerFiles, &out.DeprecatedDiagnosticDockerFiles - *out = make([]string, len(*in)) - copy(*out, *in) - } if in.BuildAttempts != nil { in, out := &in.BuildAttempts, &out.BuildAttempts *out = make([]*BuildAttempt, len(*in)) @@ -619,7 +598,6 @@ func (in *JBSConfigSpec) DeepCopyInto(out *JBSConfigSpec) { in.Registry.DeepCopyInto(&out.Registry) out.MavenDeployment = in.MavenDeployment out.GitSourceArchive = in.GitSourceArchive - out.ImageRegistry = in.ImageRegistry out.CacheSettings = in.CacheSettings out.BuildSettings = in.BuildSettings if in.RelocationPatterns != nil { diff --git a/pkg/reconciler/dependencybuild/dependencybuild.go b/pkg/reconciler/dependencybuild/dependencybuild.go index a589fcf42..04a44302a 100644 --- a/pkg/reconciler/dependencybuild/dependencybuild.go +++ b/pkg/reconciler/dependencybuild/dependencybuild.go @@ -121,11 +121,7 @@ func (r *ReconcileDependencyBuild) Reconcile(ctx context.Context, request reconc switch { case dberr == nil: log = log.WithValues("kind", "DependencyBuild", "db-scm-url", db.Spec.ScmInfo.SCMURL, "db-scm-tag", db.Spec.ScmInfo.Tag) - err, done := r.handleDeprecatedFields(ctx, db) - if done || err != nil { - return reconcile.Result{}, err - } - done, err = r.handleS3SyncDependencyBuild(ctx, &db, log) + done, err := r.handleS3SyncDependencyBuild(ctx, &db, log) if done || err != nil { return reconcile.Result{}, err } @@ -177,30 +173,6 @@ func (r *ReconcileDependencyBuild) Reconcile(ctx context.Context, request reconc return reconcile.Result{}, nil } -func (r *ReconcileDependencyBuild) handleDeprecatedFields(ctx context.Context, db v1alpha1.DependencyBuild) (error, bool) { - deprecatedInfoRemoved := false - if db.Status.DeprecatedCurrentBuildRecipe != nil { - db.Status.DeprecatedCurrentBuildRecipe = nil - deprecatedInfoRemoved = true - } - if db.Status.DeprecatedDiagnosticDockerFiles != nil { - db.Status.DeprecatedDiagnosticDockerFiles = nil - deprecatedInfoRemoved = true - } - if db.Status.DeprecatedFailedBuildRecipes != nil { - db.Status.DeprecatedFailedBuildRecipes = nil - deprecatedInfoRemoved = true - } - if db.Status.DeprecatedLastCompletedBuildPipelineRun != "" { - db.Status.DeprecatedLastCompletedBuildPipelineRun = "" - deprecatedInfoRemoved = true - } - if deprecatedInfoRemoved { - return r.client.Status().Update(ctx, &db), true - } - return nil, false -} - func (r *ReconcileDependencyBuild) handleStateNew(ctx context.Context, log logr.Logger, db *v1alpha1.DependencyBuild) (reconcile.Result, error) { jbsConfig := &v1alpha1.JBSConfig{} err := r.client.Get(ctx, types.NamespacedName{Namespace: db.Namespace, Name: v1alpha1.JBSConfigName}, jbsConfig) diff --git a/pkg/reconciler/jbsconfig/jbsconfig.go b/pkg/reconciler/jbsconfig/jbsconfig.go index 745ecc6c4..451a0cef2 100644 --- a/pkg/reconciler/jbsconfig/jbsconfig.go +++ b/pkg/reconciler/jbsconfig/jbsconfig.go @@ -79,10 +79,6 @@ func (r *ReconcilerJBSConfig) Reconcile(ctx context.Context, request reconcile.R if err != nil { return reconcile.Result{}, err } - err, done := r.handleDeprecatedRegistryDefinition(ctx, &jbsConfig) - if done || err != nil { - return reconcile.Result{}, err - } //TODO do we eventually want to allow more than one JBSConfig per namespace? if jbsConfig.Name == v1alpha1.JBSConfigName { @@ -144,32 +140,6 @@ func (r *ReconcilerJBSConfig) Reconcile(ctx context.Context, request reconcile.R return reconcile.Result{}, nil } -func (r *ReconcilerJBSConfig) handleDeprecatedRegistryDefinition(ctx context.Context, config *v1alpha1.JBSConfig) (error, bool) { - // If anything is set in the deprecated anonymous struct, copy it over to the new one. - // Note that e.g. config.Spec.ImageRegistry.Host is equivalent to config.Spec.Host due to the anonymous definition - // and is only explicit here for clarity. - if config.Spec.ImageRegistry.Host != "" || config.Spec.ImageRegistry.Port != "" || - config.Spec.ImageRegistry.Owner != "" || config.Spec.ImageRegistry.Repository != "" || config.Spec.PrependTag != "" { - - config.Spec.Registry.Host = config.Spec.ImageRegistry.Host - config.Spec.Registry.Port = config.Spec.ImageRegistry.Port - config.Spec.Registry.Owner = config.Spec.ImageRegistry.Owner - config.Spec.Registry.Repository = config.Spec.ImageRegistry.Repository - config.Spec.Registry.Insecure = config.Spec.ImageRegistry.Insecure - config.Spec.Registry.PrependTag = config.Spec.ImageRegistry.PrependTag - - // Clear the old one - config.Spec.ImageRegistry.Host = "" - config.Spec.ImageRegistry.Port = "" - config.Spec.ImageRegistry.Owner = "" - config.Spec.ImageRegistry.Repository = "" - config.Spec.ImageRegistry.PrependTag = "" - - return r.client.Update(ctx, config), true - } - return nil, false -} - func settingOrDefault(setting, def string) string { if len(strings.TrimSpace(setting)) == 0 { return def diff --git a/pkg/reconciler/jbsconfig/jbsconfig_test.go b/pkg/reconciler/jbsconfig/jbsconfig_test.go index 1831f713b..de4f0e203 100644 --- a/pkg/reconciler/jbsconfig/jbsconfig_test.go +++ b/pkg/reconciler/jbsconfig/jbsconfig_test.go @@ -282,18 +282,3 @@ func TestImageRegistryArrayToString(t *testing.T) { g.Expect(ImageRegistriesToString(logr.Discard(), registries1)).To(Equal("quay.io,,nobody,foo,false,")) g.Expect(ImageRegistriesToString(logr.Discard(), registries2)).To(Equal("quay.io,,nobody,foo,false,;quay.io,784,nobody,foo,false,foo")) } - -func TestDeprecatedRegistry(t *testing.T) { - g := NewGomegaWithT(t) - ctx := context.TODO() - jbsConfig := setupJBSConfig() - jbsConfig.Spec.Owner = "tests" - jbsConfig.Spec.Registry.Owner = "" - jbsConfig.Spec.EnableRebuilds = true - objs := []runtimeclient.Object{jbsConfig, setupSystemConfig()} - _, reconciler := setupClientAndReconciler(false, objs...) - _, res := reconciler.handleDeprecatedRegistryDefinition(ctx, jbsConfig) - g.Expect(res).To(Equal(true)) - g.Expect(jbsConfig.Spec.ImageRegistry.Owner).To(Equal("")) - g.Expect(jbsConfig.Spec.Registry.Owner).To(Equal("tests")) -}