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

feat(HACBS-2586): switch from tektonv1beta1 to tektonv1 #251

Merged
merged 1 commit into from
Sep 11, 2023
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
8 changes: 4 additions & 4 deletions controllers/release/adapter.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ import (
applicationapiv1alpha1 "github.com/redhat-appstudio/application-api/api/v1alpha1"

libhandler "github.com/operator-framework/operator-lib/handler"
"github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1"
tektonv1 "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1"
"k8s.io/apimachinery/pkg/api/errors"
"k8s.io/apimachinery/pkg/api/meta"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
Expand Down Expand Up @@ -308,7 +308,7 @@ func (a *adapter) EnsureReleaseProcessingIsTracked() (controller.OperationResult
// annotations, so it triggers Release reconciles whenever it changes. The Pipeline information and the parameters to it
// will be extracted from the given ReleaseStrategy. The Release's Snapshot will also be passed to the release
// PipelineRun.
func (a *adapter) createReleasePipelineRun(resources *loader.ProcessingResources) (*v1beta1.PipelineRun, error) {
func (a *adapter) createReleasePipelineRun(resources *loader.ProcessingResources) (*tektonv1.PipelineRun, error) {
pipelineRun := tekton.NewReleasePipelineRun("release-pipelinerun", resources.ReleaseStrategy.Namespace).
WithObjectReferences(a.release, resources.ReleasePlan,
resources.ReleasePlanAdmission, resources.ReleaseStrategy, resources.Snapshot).
Expand Down Expand Up @@ -459,7 +459,7 @@ func (a *adapter) registerDeploymentStatus(binding *applicationapiv1alpha1.Snaps
}

// registerProcessingData adds all the Release processing information to its Status and marks it as processing.
func (a *adapter) registerProcessingData(releasePipelineRun *v1beta1.PipelineRun, releaseStrategy *v1alpha1.ReleaseStrategy) error {
func (a *adapter) registerProcessingData(releasePipelineRun *tektonv1.PipelineRun, releaseStrategy *v1alpha1.ReleaseStrategy) error {
if releasePipelineRun == nil || releaseStrategy == nil {
return nil
}
Expand All @@ -480,7 +480,7 @@ func (a *adapter) registerProcessingData(releasePipelineRun *v1beta1.PipelineRun
// registerProcessingStatus updates the status of the Release being processed by monitoring the status of the
// associated release PipelineRun and setting the appropriate state in the Release. If the PipelineRun hasn't
// started/succeeded, no action will be taken.
func (a *adapter) registerProcessingStatus(pipelineRun *v1beta1.PipelineRun) error {
func (a *adapter) registerProcessingStatus(pipelineRun *tektonv1.PipelineRun) error {
if pipelineRun != nil && pipelineRun.IsDone() {
patch := client.MergeFrom(a.release.DeepCopy())

Expand Down
24 changes: 12 additions & 12 deletions controllers/release/adapter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ import (
"github.com/redhat-appstudio/release-service/api/v1alpha1"
"github.com/redhat-appstudio/release-service/loader"
"github.com/redhat-appstudio/release-service/metadata"
"github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1"
tektonv1 "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1"
corev1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/runtime/schema"
"k8s.io/apimachinery/pkg/types"
Expand Down Expand Up @@ -521,7 +521,7 @@ var _ = Describe("Release adapter", Ordered, func() {
adapter.ctx = toolkit.GetMockedContext(ctx, []toolkit.MockData{
{
ContextKey: loader.ReleasePipelineRunContextKey,
Resource: &v1beta1.PipelineRun{
Resource: &tektonv1.PipelineRun{
ObjectMeta: metav1.ObjectMeta{
Name: "pipeline-run",
Namespace: "default",
Expand All @@ -540,7 +540,7 @@ var _ = Describe("Release adapter", Ordered, func() {
adapter.ctx = toolkit.GetMockedContext(ctx, []toolkit.MockData{
{
ContextKey: loader.ReleasePipelineRunContextKey,
Resource: &v1beta1.PipelineRun{
Resource: &tektonv1.PipelineRun{
ObjectMeta: metav1.ObjectMeta{
Name: "pipeline-run",
Namespace: "default",
Expand Down Expand Up @@ -694,7 +694,7 @@ var _ = Describe("Release adapter", Ordered, func() {
It("should track the status if the PipelineRun exists", func() {
adapter.release.MarkProcessing("")

pipelineRun := &v1beta1.PipelineRun{
pipelineRun := &tektonv1.PipelineRun{
ObjectMeta: metav1.ObjectMeta{
Name: "pipeline-run",
Namespace: "default",
Expand All @@ -717,7 +717,7 @@ var _ = Describe("Release adapter", Ordered, func() {
It("removes the finalizer if present", func() {
adapter.release.MarkProcessing("")

pipelineRun := &v1beta1.PipelineRun{
pipelineRun := &tektonv1.PipelineRun{
ObjectMeta: metav1.ObjectMeta{
Name: "pipeline-run",
Namespace: "default",
Expand Down Expand Up @@ -757,7 +757,7 @@ var _ = Describe("Release adapter", Ordered, func() {
When("createReleasePipelineRun is called", func() {
var (
adapter *adapter
pipelineRun *v1beta1.PipelineRun
pipelineRun *tektonv1.PipelineRun
)

AfterEach(func() {
Expand All @@ -784,7 +784,7 @@ var _ = Describe("Release adapter", Ordered, func() {
})

It("returns a PipelineRun", func() {
Expect(reflect.TypeOf(pipelineRun)).To(Equal(reflect.TypeOf(&v1beta1.PipelineRun{})))
Expect(reflect.TypeOf(pipelineRun)).To(Equal(reflect.TypeOf(&tektonv1.PipelineRun{})))
})

It("has the release reference", func() {
Expand Down Expand Up @@ -1106,7 +1106,7 @@ var _ = Describe("Release adapter", Ordered, func() {
})

It("does nothing if there is no ReleaseStrategy", func() {
pipelineRun := &v1beta1.PipelineRun{
pipelineRun := &tektonv1.PipelineRun{
ObjectMeta: metav1.ObjectMeta{
Name: "pipeline-run",
Namespace: "default",
Expand All @@ -1117,7 +1117,7 @@ var _ = Describe("Release adapter", Ordered, func() {
})

It("registers the Release processing data", func() {
pipelineRun := &v1beta1.PipelineRun{
pipelineRun := &tektonv1.PipelineRun{
ObjectMeta: metav1.ObjectMeta{
Name: "pipeline-run",
Namespace: "default",
Expand Down Expand Up @@ -1150,13 +1150,13 @@ var _ = Describe("Release adapter", Ordered, func() {
})

It("does nothing if the PipelineRun is not done", func() {
pipelineRun := &v1beta1.PipelineRun{}
pipelineRun := &tektonv1.PipelineRun{}
Expect(adapter.registerProcessingStatus(pipelineRun)).To(Succeed())
Expect(adapter.release.Status.Processing.CompletionTime).To(BeNil())
})

It("sets the Release as succeeded if the PipelineRun succeeded", func() {
pipelineRun := &v1beta1.PipelineRun{}
pipelineRun := &tektonv1.PipelineRun{}
pipelineRun.Status.MarkSucceeded("", "")
adapter.release.MarkProcessing("")

Expand All @@ -1165,7 +1165,7 @@ var _ = Describe("Release adapter", Ordered, func() {
})

It("sets the Release as failed if the PipelineRun didn't succeed", func() {
pipelineRun := &v1beta1.PipelineRun{}
pipelineRun := &tektonv1.PipelineRun{}
pipelineRun.Status.MarkFailed("", "")
adapter.release.MarkProcessing("")

Expand Down
5 changes: 3 additions & 2 deletions controllers/release/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ package release

import (
"context"

"github.com/redhat-appstudio/operator-toolkit/controller"
"github.com/redhat-appstudio/operator-toolkit/predicates"
"sigs.k8s.io/controller-runtime/pkg/cluster"
Expand All @@ -30,7 +31,7 @@ import (
"github.com/redhat-appstudio/release-service/gitops"
"github.com/redhat-appstudio/release-service/loader"
"github.com/redhat-appstudio/release-service/tekton"
"github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1"
tektonv1 "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1"
"k8s.io/apimachinery/pkg/api/errors"
"k8s.io/apimachinery/pkg/runtime/schema"
ctrl "sigs.k8s.io/controller-runtime"
Expand Down Expand Up @@ -99,7 +100,7 @@ func (c *Controller) Register(mgr ctrl.Manager, log *logr.Logger, _ cluster.Clus
Group: "appstudio.redhat.com",
},
}, builder.WithPredicates(predicates.GenerationUnchangedOnUpdatePredicate{}, gitops.DeploymentFinishedPredicate())).
Watches(&source.Kind{Type: &v1beta1.PipelineRun{}}, &libhandler.EnqueueRequestForAnnotation{
Watches(&source.Kind{Type: &tektonv1.PipelineRun{}}, &libhandler.EnqueueRequestForAnnotation{
Type: schema.GroupKind{
Kind: "Release",
Group: "appstudio.redhat.com",
Expand Down
4 changes: 2 additions & 2 deletions controllers/release/suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ import (

ecapiv1alpha1 "github.com/enterprise-contract/enterprise-contract-controller/api/v1alpha1"
appstudiov1alpha1 "github.com/redhat-appstudio/release-service/api/v1alpha1"
tektonv1beta1 "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1"
tektonv1 "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1"
"k8s.io/client-go/kubernetes/scheme"
ctrl "sigs.k8s.io/controller-runtime"
"sigs.k8s.io/controller-runtime/pkg/client"
Expand Down Expand Up @@ -90,7 +90,7 @@ var _ = BeforeSuite(func() {
Expect(cfg).NotTo(BeNil())

Expect(appstudiov1alpha1.AddToScheme(scheme.Scheme)).To(Succeed())
Expect(tektonv1beta1.AddToScheme(scheme.Scheme)).To(Succeed())
Expect(tektonv1.AddToScheme(scheme.Scheme)).To(Succeed())
Expect(ecapiv1alpha1.AddToScheme(scheme.Scheme)).To(Succeed())
Expect(applicationapiv1alpha1.AddToScheme(scheme.Scheme)).To(Succeed())

Expand Down
47 changes: 24 additions & 23 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,59 +4,60 @@ go 1.19

require (
github.com/enterprise-contract/enterprise-contract-controller/api v0.0.0-20230327185456-5befd172d558
github.com/go-logr/logr v1.2.3
github.com/go-logr/logr v1.2.4
github.com/onsi/ginkgo/v2 v2.6.0
github.com/onsi/gomega v1.24.1
github.com/operator-framework/operator-lib v0.10.0
github.com/redhat-appstudio/application-api v0.0.0-20230427114540-a91722251e0a
github.com/redhat-appstudio/operator-toolkit v0.0.0-20230901144515-eeb937692f03
github.com/tektoncd/pipeline v0.41.0
github.com/tektoncd/pipeline v0.49.0
k8s.io/api v0.26.1
k8s.io/apimachinery v0.26.3
k8s.io/apimachinery v0.26.5
k8s.io/client-go v0.26.1
knative.dev/pkg v0.0.0-20221011175852-714b7630a836
knative.dev/pkg v0.0.0-20230221145627-8efb3485adcf
sigs.k8s.io/controller-runtime v0.14.6
)

require (
github.com/emicklei/go-restful/v3 v3.9.0 // indirect
github.com/evanphx/json-patch v5.6.0+incompatible // indirect
github.com/google/gnostic v0.6.9 // indirect
github.com/grpc-ecosystem/grpc-gateway/v2 v2.11.3 // indirect
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
github.com/opencontainers/go-digest v1.0.0 // indirect
golang.org/x/exp v0.0.0-20230307190834-24139beb5833 // indirect
)

require (
contrib.go.opencensus.io/exporter/ocagent v0.7.1-0.20200907061046-05415f1de66d // indirect
contrib.go.opencensus.io/exporter/prometheus v0.4.2 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/blendle/zapdriver v1.3.1 // indirect
github.com/census-instrumentation/opencensus-proto v0.3.0 // indirect
github.com/cespare/xxhash/v2 v2.1.2 // indirect
github.com/census-instrumentation/opencensus-proto v0.4.1 // indirect
github.com/cespare/xxhash/v2 v2.2.0 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/evanphx/json-patch/v5 v5.6.0 // indirect
github.com/fsnotify/fsnotify v1.6.0 // indirect
github.com/go-kit/log v0.2.1 // indirect
github.com/go-logfmt/logfmt v0.5.1 // indirect
github.com/go-logr/zapr v1.2.3 // indirect
github.com/go-openapi/jsonpointer v0.19.5 // indirect
github.com/go-openapi/jsonreference v0.20.0 // indirect
github.com/go-openapi/jsonpointer v0.19.6 // indirect
github.com/go-openapi/jsonreference v0.20.1 // indirect
github.com/go-openapi/swag v0.22.3 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
github.com/golang/protobuf v1.5.2 // indirect
github.com/golang/protobuf v1.5.3 // indirect
github.com/google/go-cmp v0.5.9 // indirect
github.com/google/go-containerregistry v0.12.0 // indirect
github.com/google/go-containerregistry v0.15.2 // indirect
github.com/google/gofuzz v1.2.0 // indirect
github.com/google/uuid v1.3.0 // indirect
github.com/grpc-ecosystem/grpc-gateway v1.16.0 // indirect
github.com/hashicorp/errwrap v1.1.0 // indirect
github.com/hashicorp/go-multierror v1.1.1 // indirect
github.com/imdario/mergo v0.3.13 // indirect
github.com/josharian/intern v1.0.0 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/mailru/easyjson v0.7.7 // indirect
github.com/matttproud/golang_protobuf_extensions v1.0.2 // indirect
github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/pkg/errors v0.9.1
Expand All @@ -67,32 +68,32 @@ require (
github.com/prometheus/statsd_exporter v0.22.8 // indirect
github.com/redhat-appstudio/integration-service v0.0.0-20221130110641-f5453dea9623
github.com/spf13/pflag v1.0.6-0.20210604193023-d5e0c0615ace // indirect
go.opencensus.io v0.23.0 // indirect
go.opencensus.io v0.24.0 // indirect
go.uber.org/atomic v1.10.0 // indirect
go.uber.org/multierr v1.8.0 // indirect
go.uber.org/zap v1.24.0
golang.org/x/net v0.10.0 // indirect
golang.org/x/oauth2 v0.1.0 // indirect
golang.org/x/sync v0.1.0 // indirect
golang.org/x/oauth2 v0.8.0 // indirect
golang.org/x/sync v0.2.0 // indirect
golang.org/x/sys v0.8.0 // indirect
golang.org/x/term v0.8.0 // indirect
golang.org/x/text v0.9.0 // indirect
golang.org/x/time v0.3.0 // indirect
gomodules.xyz/jsonpatch/v2 v2.2.0 // indirect
google.golang.org/api v0.100.0 // indirect
google.golang.org/api v0.121.0 // indirect
google.golang.org/appengine v1.6.7 // indirect
google.golang.org/genproto v0.0.0-20221014213838-99cd37c6964a // indirect
google.golang.org/grpc v1.50.1 // indirect
google.golang.org/protobuf v1.28.1 // indirect
google.golang.org/genproto v0.0.0-20230410155749-daa745c078e1 // indirect
google.golang.org/grpc v1.55.0 // indirect
google.golang.org/protobuf v1.30.0 // indirect
gopkg.in/inf.v0 v0.9.1 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
k8s.io/apiextensions-apiserver v0.26.1 // indirect
k8s.io/component-base v0.26.1 // indirect
k8s.io/klog/v2 v2.80.1 // indirect
k8s.io/kube-openapi v0.0.0-20221012153701-172d655c2280 // indirect
k8s.io/utils v0.0.0-20221128185143-99ec85e7a448
sigs.k8s.io/json v0.0.0-20220713155537-f223a00ba0e2 // indirect
k8s.io/klog/v2 v2.90.1 // indirect
k8s.io/kube-openapi v0.0.0-20230308215209-15aac26d736a // indirect
k8s.io/utils v0.0.0-20230209194617-a36077c30491
sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect
sigs.k8s.io/structured-merge-diff/v4 v4.2.3 // indirect
sigs.k8s.io/yaml v1.3.0 // indirect
)
Loading
Loading