mirror of
				https://gitea.com/Lydanne/buildx.git
				synced 2025-10-30 23:53:48 +08:00 
			
		
		
		
	bake: fix panic for unsupported hcl variable type
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
This commit is contained in:
		| @@ -782,3 +782,15 @@ func TestFunctionNoResult(t *testing.T) { | ||||
| 	_, err := ParseFile(dt, "docker-bake.hcl") | ||||
| 	require.Error(t, err) | ||||
| } | ||||
|  | ||||
| func TestVarUnsupportedType(t *testing.T) { | ||||
| 	dt := []byte(` | ||||
| 		variable "FOO" { | ||||
| 			default = [] | ||||
| 		} | ||||
| 		target "default" {}`) | ||||
|  | ||||
| 	t.Setenv("FOO", "bar") | ||||
| 	_, err := ParseFile(dt, "docker-bake.hcl") | ||||
| 	require.Error(t, err) | ||||
| } | ||||
|   | ||||
| @@ -241,7 +241,7 @@ func (p *parser) resolveValue(name string) (err error) { | ||||
| 			return nil | ||||
| 		} else { | ||||
| 			// TODO: support lists with csv values | ||||
| 			return errors.Errorf("unsupported type %s for variable %s", v.Type(), name) | ||||
| 			return errors.Errorf("unsupported type %s for variable %s", vv.Type().FriendlyName(), name) | ||||
| 		} | ||||
| 	} | ||||
| 	v = &vv | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 CrazyMax
					CrazyMax