diff --git a/pipeline/frontend/yaml/compiler/settings/params.go b/pipeline/frontend/yaml/compiler/settings/params.go index 9bbeb5d49..a021d3daa 100644 --- a/pipeline/frontend/yaml/compiler/settings/params.go +++ b/pipeline/frontend/yaml/compiler/settings/params.go @@ -111,6 +111,11 @@ func sanitizeParamValue(v interface{}, secrets map[string]string) (string, error for i := 0; i < vv.Len(); i++ { v := vv.Index(i).Interface() + // if we handle a list with a nil entry we just return a empty list + if v == nil { + continue + } + // ensure each element is not complex if isComplex(reflect.TypeOf(v).Kind()) { containsComplex = true diff --git a/pipeline/frontend/yaml/compiler/settings/params_test.go b/pipeline/frontend/yaml/compiler/settings/params_test.go index 22ab60aa5..37ec227ae 100644 --- a/pipeline/frontend/yaml/compiler/settings/params_test.go +++ b/pipeline/frontend/yaml/compiler/settings/params_test.go @@ -59,6 +59,11 @@ func TestParamsToEnv(t *testing.T) { got := map[string]string{} assert.NoError(t, ParamsToEnv(from, got, secrets)) assert.EqualValues(t, want, got, "Problem converting plugin parameters to environment variables") + + // handle edge cases (#1609) + got = map[string]string{} + assert.NoError(t, ParamsToEnv(map[string]interface{}{"a": []interface{}{"a", nil}}, got, nil)) + assert.EqualValues(t, map[string]string{"PLUGIN_A": "a,"}, got) } func TestSanitizeParamKey(t *testing.T) {