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

chore(deps): bump github.com/tidwall/gjson from 1.9.3 to 1.14.3 #27

Closed
Closed
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
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ require (
github.com/spf13/pflag v1.0.5
github.com/spf13/viper v1.8.1
github.com/stretchr/testify v1.7.0
github.com/tidwall/gjson v1.9.3
github.com/tidwall/gjson v1.14.3
github.com/valyala/fasthttp v1.22.0 // indirect
github.com/valyala/fasttemplate v1.1.0
github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb // indirect
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1012,8 +1012,8 @@ github.com/subosito/gotenv v1.2.0 h1:Slr1R9HxAlEKefgq5jn9U+DnETlIUa6HfgEzj0g5d7s
github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw=
github.com/tidwall/gjson v1.6.0/go.mod h1:P256ACg0Mn+j1RXIDXoss50DeIABTYK1PULOJHhxOls=
github.com/tidwall/gjson v1.7.5/go.mod h1:5/xDoumyyDNerp2U36lyolv46b3uF/9Bu6OfyQ9GImk=
github.com/tidwall/gjson v1.9.3 h1:hqzS9wAHMO+KVBBkLxYdkEeeFHuqr95GfClRLKlgK0E=
github.com/tidwall/gjson v1.9.3/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk=
github.com/tidwall/gjson v1.14.3 h1:9jvXn7olKEHU1S9vwoMGliaT8jq1vJ7IH/n9zD9Dnlw=
github.com/tidwall/gjson v1.14.3/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk=
github.com/tidwall/match v1.0.1/go.mod h1:LujAq0jyVjBy028G1WhWfIzbpQfMO8bBZ6Tyb0+pL9E=
github.com/tidwall/match v1.0.3/go.mod h1:eRSPERbgtNPcGhD8UCthc6PmLEQXEWd3PRB5JTxsfmM=
github.com/tidwall/match v1.1.1 h1:+Ho715JplO36QYgwN9PGYNhgZvoUSc9X2c80KVTi+GA=
Expand Down
8 changes: 3 additions & 5 deletions workflow/common/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -158,12 +158,10 @@ func ProcessArgs(tmpl *wfv1.Template, args wfv1.ArgumentsProvider, globalParams,
// Performs substitutions of input artifacts
artifacts := newTmpl.Inputs.Artifacts
for i, inArt := range artifacts {
// if artifact has hard-wired location, we prefer that
if inArt.HasLocationOrKey() {
continue
}

argArt := args.GetArtifactByName(inArt.Name)
if !inArt.Optional {

if !inArt.Optional && !inArt.HasLocationOrKey() {
// artifact must be supplied
if argArt == nil {
return nil, errors.Errorf(errors.CodeBadRequest, "inputs.artifacts.%s was not supplied", inArt.Name)
Expand Down
36 changes: 36 additions & 0 deletions workflow/common/util_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -161,3 +161,39 @@ func TestIsDone(t *testing.T) {
},
}}))
}

func TestOverridableDefaultInputArts(t *testing.T) {
tmpl := wfv1.Template{}
tmpl.Name = "artifact-printing"

art := wfv1.Artifact{}
art.Name = "overridable-art"
rawArt := wfv1.RawArtifact{}
rawArt.Data = "default contents"
art.Raw = &rawArt
tmpl.Inputs.Artifacts = []wfv1.Artifact{art}

inputs := wfv1.Inputs{}

inputArt := wfv1.Artifact{}
inputArt.Name = art.Name
inputRawArt := wfv1.RawArtifact{}
inputRawArt.Data = "replacement contents"
inputArt.Raw = &inputRawArt

inputs.Artifacts = []wfv1.Artifact{}

globalParams := make(map[string]string)
localParams := make(map[string]string)

newTmpl, err := ProcessArgs(&tmpl, &inputs, globalParams, localParams, false, "", nil)
assert.Nil(t, err)
assert.NotNil(t, newTmpl)
assert.Equal(t, newTmpl.Inputs.Artifacts[0].Raw.Data, rawArt.Data)

inputs.Artifacts = []wfv1.Artifact{inputArt}
newTmpl, err = ProcessArgs(&tmpl, &inputs, globalParams, localParams, false, "", nil)
assert.Nil(t, err)
assert.NotNil(t, newTmpl)
assert.Equal(t, newTmpl.Inputs.Artifacts[0].Raw.Data, inputRawArt.Data)
}