Skip to content

Commit

Permalink
Empty lists/maps should match list/maps of any types (flyteorg#433)
Browse files Browse the repository at this point in the history
  • Loading branch information
EngHabu authored May 5, 2022
1 parent 6967837 commit 0301f2a
Show file tree
Hide file tree
Showing 11 changed files with 338 additions and 114 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@ jobs:
name: Lint
uses: flyteorg/flytetools/.github/workflows/lint.yml@master
with:
go-version: 1.17
go-version: 1.18

tests:
name: Unit Tests
uses: flyteorg/flytetools/.github/workflows/tests.yml@master
secrets:
FLYTE_BOT_PAT: ${{ secrets.FLYTE_BOT_PAT }}
with:
go-version: 1.17
go-version: 1.18

docker-build:
name: Docker Build Images
Expand All @@ -42,13 +42,13 @@ jobs:
uses: flyteorg/flytetools/.github/workflows/integration.yml@master
with:
cache_key: ${{ needs.docker-build.outputs.cache_key }}
go-version: 1.17
go-version: 1.18

generate:
name: Check Go Generate
uses: flyteorg/flytetools/.github/workflows/go_generate.yml@master
with:
go-version: 1.17
go-version: 1.18

bump_version:
name: Bump Version
Expand All @@ -63,7 +63,7 @@ jobs:
needs: [ bump_version ] # Only to ensure it can successfully build
uses: flyteorg/flytetools/.github/workflows/goreleaser.yml@master
with:
go-version: 1.17
go-version: 1.18
secrets:
FLYTE_BOT_PAT: ${{ secrets.FLYTE_BOT_PAT }}

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/upgrade_automation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@ jobs:
uses: flyteorg/flytetools/.github/workflows/flyte_automation.yml@master
with:
component: ${{ github.event.inputs.component }}
go-version: 1.17
go-version: 1.18
secrets:
FLYTE_BOT_PAT: ${{ secrets.FLYTE_BOT_PAT }}
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#
# TO OPT OUT OF UPDATES, SEE https://github.com/lyft/boilerplate/blob/master/Readme.rst

FROM golang:1.16.0-alpine3.13 as builder
FROM golang:1.18.0-alpine3.15 as builder
RUN apk add git openssh-client make curl

# COPY only the go mod files for efficient caching
Expand All @@ -24,7 +24,7 @@ RUN make linux_compile
ENV PATH="/artifacts:${PATH}"

# This will eventually move to centurylink/ca-certs:latest for minimum possible image size
FROM alpine:3.13
FROM alpine:3.15
LABEL org.opencontainers.image.source https://github.com/flyteorg/flytepropeller

COPY --from=builder /artifacts /bin
Expand Down
111 changes: 110 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/flyteorg/flytepropeller

go 1.16
go 1.18

require (
github.com/DiSiqueira/GoTree v1.0.1-0.20180907134536-53a8e837f295
Expand All @@ -24,6 +24,7 @@ require (
github.com/spf13/cobra v1.1.1
github.com/spf13/pflag v1.0.5
github.com/stretchr/testify v1.7.0
golang.org/x/exp v0.0.0-20220428152302-39d4317da171
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c
golang.org/x/time v0.0.0-20210220033141-f8bda1e9f3ba
google.golang.org/grpc v1.36.0
Expand All @@ -36,4 +37,112 @@ require (
sigs.k8s.io/controller-runtime v0.8.2
)

require (
cloud.google.com/go v0.78.0 // indirect
cloud.google.com/go/storage v1.12.0 // indirect
github.com/Azure/azure-sdk-for-go v62.3.0+incompatible // indirect
github.com/Azure/azure-sdk-for-go/sdk/azcore v0.21.1 // indirect
github.com/Azure/azure-sdk-for-go/sdk/internal v0.8.3 // indirect
github.com/Azure/azure-sdk-for-go/sdk/storage/azblob v0.3.0 // indirect
github.com/Azure/go-autorest v14.2.0+incompatible // indirect
github.com/Azure/go-autorest/autorest v0.11.17 // indirect
github.com/Azure/go-autorest/autorest/adal v0.9.10 // indirect
github.com/Azure/go-autorest/autorest/date v0.3.0 // indirect
github.com/Azure/go-autorest/logger v0.2.0 // indirect
github.com/Azure/go-autorest/tracing v0.6.0 // indirect
github.com/GoogleCloudPlatform/spark-on-k8s-operator v0.0.0-20200723154620-6f35a1152625 // indirect
github.com/Masterminds/semver v1.5.0 // indirect
github.com/PuerkitoBio/purell v1.1.1 // indirect
github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578 // indirect
github.com/aws/amazon-sagemaker-operator-for-k8s v1.0.1-0.20210303003444-0fb33b1fd49d // indirect
github.com/aws/aws-sdk-go v1.37.3 // indirect
github.com/aws/aws-sdk-go-v2 v1.2.0 // indirect
github.com/aws/aws-sdk-go-v2/config v1.0.0 // indirect
github.com/aws/aws-sdk-go-v2/credentials v1.0.0 // indirect
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.0.0 // indirect
github.com/aws/aws-sdk-go-v2/service/athena v1.0.0 // indirect
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.0.0 // indirect
github.com/aws/aws-sdk-go-v2/service/sts v1.0.0 // indirect
github.com/aws/smithy-go v1.1.0 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/cespare/xxhash v1.1.0 // indirect
github.com/cespare/xxhash/v2 v2.1.1 // indirect
github.com/coocood/freecache v1.1.1 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/emicklei/go-restful v2.9.6+incompatible // indirect
github.com/evanphx/json-patch v4.9.0+incompatible // indirect
github.com/flyteorg/stow v0.3.3 // indirect
github.com/form3tech-oss/jwt-go v3.2.2+incompatible // indirect
github.com/fsnotify/fsnotify v1.4.9 // indirect
github.com/go-logr/logr v0.4.0 // indirect
github.com/go-openapi/jsonpointer v0.19.5 // indirect
github.com/go-openapi/jsonreference v0.19.5 // indirect
github.com/go-openapi/spec v0.20.3 // indirect
github.com/go-openapi/swag v0.19.14 // indirect
github.com/gofrs/uuid v4.2.0+incompatible // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e // indirect
github.com/google/go-cmp v0.5.6 // indirect
github.com/google/gofuzz v1.2.0 // indirect
github.com/googleapis/gax-go/v2 v2.0.5 // indirect
github.com/googleapis/gnostic v0.5.1 // indirect
github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0 // indirect
github.com/grpc-ecosystem/grpc-gateway v1.16.0 // indirect
github.com/hashicorp/golang-lru v0.5.4 // indirect
github.com/hashicorp/hcl v1.0.0 // indirect
github.com/inconshreveable/mousetrap v1.0.0 // indirect
github.com/jmespath/go-jmespath v0.4.0 // indirect
github.com/josharian/intern v1.0.0 // indirect
github.com/json-iterator/go v1.1.10 // indirect
github.com/jstemmer/go-junit-report v0.9.1 // indirect
github.com/kubeflow/common v0.4.0 // indirect
github.com/kubeflow/mpi-operator/v2 v2.0.0-20210920181600-c5c0c3ef99ec // indirect
github.com/kubeflow/pytorch-operator v0.6.0 // indirect
github.com/kubeflow/tf-operator v0.5.3 // indirect
github.com/mailru/easyjson v0.7.6 // indirect
github.com/mattn/go-colorable v0.1.8 // indirect
github.com/mattn/go-isatty v0.0.12 // indirect
github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.1 // indirect
github.com/ncw/swift v1.0.53 // indirect
github.com/pelletier/go-toml v1.8.1 // indirect
github.com/pkg/browser v0.0.0-20210115035449-ce105d075bb4 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/prometheus/client_model v0.2.0 // indirect
github.com/prometheus/common v0.18.0 // indirect
github.com/prometheus/procfs v0.6.0 // indirect
github.com/spf13/afero v1.5.1 // indirect
github.com/spf13/cast v1.3.1 // indirect
github.com/spf13/jwalterweatherman v1.1.0 // indirect
github.com/spf13/viper v1.7.1 // indirect
github.com/stretchr/objx v0.3.0 // indirect
github.com/subosito/gotenv v1.2.0 // indirect
go.opencensus.io v0.22.6 // indirect
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519 // indirect
golang.org/x/lint v0.0.0-20201208152925-83fdc39ff7b5 // indirect
golang.org/x/mod v0.6.0-dev.0.20220106191415-9b9b3d81d5e3 // indirect
golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f // indirect
golang.org/x/oauth2 v0.0.0-20210220000619-9bb904979d93 // indirect
golang.org/x/sys v0.0.0-20211019181941-9d821ace8654 // indirect
golang.org/x/term v0.0.0-20210220032956-6a3ed077a48d // indirect
golang.org/x/text v0.3.7 // indirect
golang.org/x/tools v0.1.10 // indirect
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 // indirect
gomodules.xyz/jsonpatch/v2 v2.1.0 // indirect
google.golang.org/api v0.40.0 // indirect
google.golang.org/appengine v1.6.7 // indirect
google.golang.org/genproto v0.0.0-20210222152913-aa3ee6e6a81c // indirect
gopkg.in/inf.v0 v0.9.1 // indirect
gopkg.in/ini.v1 v1.62.0 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect
k8s.io/component-base v0.20.2 // indirect
k8s.io/klog/v2 v2.5.0 // indirect
k8s.io/kube-openapi v0.0.0-20201113171705-d219536bb9fd // indirect
k8s.io/utils v0.0.0-20210111153108-fddb29f9d009 // indirect
sigs.k8s.io/structured-merge-diff/v4 v4.0.3 // indirect
sigs.k8s.io/yaml v1.2.0 // indirect
)

replace github.com/aws/amazon-sagemaker-operator-for-k8s => github.com/aws/amazon-sagemaker-operator-for-k8s v1.0.1-0.20210303003444-0fb33b1fd49d
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -844,6 +844,8 @@ golang.org/x/exp v0.0.0-20191227195350-da58074b4299/go.mod h1:2RIsYlXP63K8oxa1u0
golang.org/x/exp v0.0.0-20200119233911-0405dc783f0a/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4=
golang.org/x/exp v0.0.0-20200207192155-f17229e696bd/go.mod h1:J/WKrq2StrnmMY6+EHIKF9dgMWnmCNThgcyBT1FY9mM=
golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6/go.mod h1:3jZMyOhIsHpP37uCMkUooju7aAi5cS1Q23tOzKc+0MU=
golang.org/x/exp v0.0.0-20220428152302-39d4317da171 h1:TfdoLivD44QwvssI9Sv1xwa5DcL5XQr4au4sZ2F2NV4=
golang.org/x/exp v0.0.0-20220428152302-39d4317da171/go.mod h1:lgLbSvA5ygNOMpwM/9anMpWVlVJ7Z+cHWq/eFuinpGE=
golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js=
golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0=
golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
Expand Down
2 changes: 1 addition & 1 deletion pkg/compiler/typing/variable.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ type Variable struct {
Index *int
}

// Parses var names
// ParseVarName parses var names
func ParseVarName(varName string) (v Variable, err error) {
allMatches := arrayVarMatcher.FindAllStringSubmatch(varName, -1)
if len(allMatches) != 1 {
Expand Down
40 changes: 40 additions & 0 deletions pkg/compiler/validators/bindings_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,46 @@ import (
"github.com/stretchr/testify/mock"
)

// LiteralToBinding converts a literal to a non-promise binding data.
func LiteralToBinding(l *core.Literal) *core.BindingData {
switch l.GetValue().(type) {
case *core.Literal_Scalar:
return &core.BindingData{
Value: &core.BindingData_Scalar{
Scalar: l.GetScalar(),
},
}
case *core.Literal_Collection:
x := make([]*core.BindingData, 0, len(l.GetCollection().Literals))
for _, sub := range l.GetCollection().Literals {
x = append(x, LiteralToBinding(sub))
}

return &core.BindingData{
Value: &core.BindingData_Collection{
Collection: &core.BindingDataCollection{
Bindings: x,
},
},
}
case *core.Literal_Map:
x := make(map[string]*core.BindingData, len(l.GetMap().Literals))
for key, val := range l.GetMap().Literals {
x[key] = LiteralToBinding(val)
}

return &core.BindingData{
Value: &core.BindingData_Map{
Map: &core.BindingDataMap{
Bindings: x,
},
},
}
}

return nil
}

func TestValidateBindings(t *testing.T) {
t.Run("Empty", func(t *testing.T) {
wf := &mocks.WorkflowBuilder{}
Expand Down
Loading

0 comments on commit 0301f2a

Please sign in to comment.