Skip to content

Commit

Permalink
chore: Update schemas to Tekton Pipelines 0.56.0 (#660)
Browse files Browse the repository at this point in the history
* chore: Update schemas to Tekton Pipelines 0.56.0

Ref:
  https://github.com/tektoncd/pipeline/blob/v0.56.0/pkg/apis/pipeline/v1beta1/when_types.go#L28-L45
  https://github.com/tektoncd/pipeline/blob/v0.56.0/pkg/apis/pipeline/v1beta1/when_validation.go#L49-L79

* fix: generator ci (go mod tidy)

* fix unit test

Signed-off-by: Stephane Bouchet <[email protected]>

---------

Signed-off-by: Stephane Bouchet <[email protected]>
Co-authored-by: Stephane Bouchet <[email protected]>
  • Loading branch information
l-qing and sbouchet authored Mar 13, 2024
1 parent d8beac8 commit f1c7395
Show file tree
Hide file tree
Showing 36 changed files with 6,581 additions and 3,656 deletions.
44 changes: 37 additions & 7 deletions releng/gen.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ import (
"bytes"
"encoding/json"
"fmt"
"os"
"reflect"

"github.com/iancoleman/orderedmap"
"github.com/redhat-developer/tekton-jsongenerator/jsonschema"
pipelinev1 "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1"
Expand All @@ -12,11 +15,10 @@ import (
triggersv1alpha1 "github.com/tektoncd/triggers/pkg/apis/triggers/v1alpha1"
triggersv1beta1 "github.com/tektoncd/triggers/pkg/apis/triggers/v1beta1"
apiextensionsv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1"
"k8s.io/apimachinery/pkg/apis/meta/v1"
k8sresource "k8s.io/apimachinery/pkg/api/resource"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime"
knative "knative.dev/pkg/apis"
"os"
"reflect"
)

func arrayOrStringMapper(i reflect.Type) *jsonschema.Type {
Expand Down Expand Up @@ -66,18 +68,34 @@ func arrayOrStringMapper(i reflect.Type) *jsonschema.Type {
})
properties.Set("operator", &jsonschema.Type{
Type: "string",
Enum: []interface{}{"in", "notin"},
})
properties.Set("values", &jsonschema.Type{
Type: "array",
Items: &jsonschema.Type{
Type: "string",
},
})
celProperties := orderedmap.New()
celProperties.Set("cel", &jsonschema.Type{
Type: "string",
})
return &jsonschema.Type{
Type: "object",
AdditionalProperties: []byte("false"),
Required: []string{"input", "operator", "values"},
Properties: properties}
OneOf: []*jsonschema.Type{
{
Type: "object",
AdditionalProperties: []byte("false"),
Required: []string{"input", "operator", "values"},
Properties: properties,
},
{
Type: "object",
AdditionalProperties: []byte("false"),
Required: []string{"cel"},
Properties: celProperties,
},
},
}
}
if (i == reflect.TypeOf(runtime.RawExtension{})) {
return &jsonschema.Type{
Expand Down Expand Up @@ -132,6 +150,18 @@ func arrayOrStringMapper(i reflect.Type) *jsonschema.Type {
},
}
}
if (i == reflect.TypeOf(k8sresource.Quantity{})) {
return &jsonschema.Type{
OneOf: []*jsonschema.Type{
{
Type: "string",
},
{
Type: "number",
},
},
}
}
return nil
}

Expand Down
88 changes: 82 additions & 6 deletions releng/go.mod
Original file line number Diff line number Diff line change
@@ -1,14 +1,90 @@
module github.com/redhat-developer/tekton-jsongenerator

go 1.14
go 1.21

toolchain go1.22.0

require (
github.com/iancoleman/orderedmap v0.0.0-20190318233801-ac98e3ecb4b0
github.com/tektoncd/pipeline v0.43.1
github.com/tektoncd/triggers v0.22.0
k8s.io/apiextensions-apiserver v0.25.3
k8s.io/apimachinery v0.25.4
knative.dev/pkg v0.0.0-20221011175852-714b7630a836
github.com/tektoncd/pipeline v0.56.0
github.com/tektoncd/triggers v0.26.0
k8s.io/apiextensions-apiserver v0.27.6
k8s.io/apimachinery v0.29.0
knative.dev/pkg v0.0.0-20231023151236-29775d7c9e5c
)

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/antlr4-go/antlr/v4 v4.13.0 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/blendle/zapdriver v1.3.1 // 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/emicklei/go-restful/v3 v3.10.2 // indirect
github.com/evanphx/json-patch/v5 v5.7.0 // indirect
github.com/go-kit/log v0.2.1 // indirect
github.com/go-logfmt/logfmt v0.6.0 // indirect
github.com/go-logr/logr v1.3.0 // indirect
github.com/go-openapi/jsonpointer v0.19.6 // indirect
github.com/go-openapi/jsonreference v0.20.2 // 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.3 // indirect
github.com/google/cel-go v0.19.0 // indirect
github.com/google/gnostic-models v0.6.8 // indirect
github.com/google/go-cmp v0.6.0 // indirect
github.com/google/go-containerregistry v0.17.0 // indirect
github.com/google/gofuzz v1.2.0 // indirect
github.com/google/pprof v0.0.0-20230228050547-1710fef4ab10 // indirect
github.com/grpc-ecosystem/grpc-gateway/v2 v2.16.0 // indirect
github.com/hashicorp/errwrap v1.1.0 // indirect
github.com/hashicorp/go-multierror v1.1.1 // 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.4 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/opencontainers/go-digest v1.0.0 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/prometheus/client_golang v1.17.0 // indirect
github.com/prometheus/client_model v0.4.1-0.20230718164431-9a2bf3000d16 // indirect
github.com/prometheus/common v0.44.0 // indirect
github.com/prometheus/procfs v0.11.1 // indirect
github.com/prometheus/statsd_exporter v0.22.7 // indirect
github.com/stoewer/go-strcase v1.2.0 // indirect
go.opencensus.io v0.24.0 // indirect
go.uber.org/multierr v1.10.0 // indirect
go.uber.org/zap v1.26.0 // indirect
golang.org/x/exp v0.0.0-20230515195305-f3d0a9c9a5cc // indirect
golang.org/x/net v0.20.0 // indirect
golang.org/x/oauth2 v0.16.0 // indirect
golang.org/x/sync v0.6.0 // indirect
golang.org/x/sys v0.16.0 // indirect
golang.org/x/term v0.16.0 // indirect
golang.org/x/text v0.14.0 // indirect
golang.org/x/time v0.5.0 // indirect
gomodules.xyz/jsonpatch/v2 v2.4.0 // indirect
google.golang.org/api v0.156.0 // indirect
google.golang.org/appengine v1.6.8 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20231212172506-995d672761c0 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20240102182953-50ed04b92917 // indirect
google.golang.org/grpc v1.60.1 // indirect
google.golang.org/protobuf v1.32.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/api v0.27.6 // indirect
k8s.io/client-go v0.27.6 // indirect
k8s.io/klog/v2 v2.110.1 // indirect
k8s.io/kube-openapi v0.0.0-20231010175941-2dd684a91f00 // indirect
k8s.io/utils v0.0.0-20230726121419-3b25d923346b // indirect
sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect
sigs.k8s.io/structured-merge-diff/v4 v4.4.1 // indirect
sigs.k8s.io/yaml v1.4.0 // indirect
)

replace cloud.google.com/go/compute => cloud.google.com/go/compute v1.12.1
Loading

0 comments on commit f1c7395

Please sign in to comment.