bake: multi ips support for extra hosts
Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
This commit is contained in:
+2
-4
@@ -125,10 +125,8 @@ func ParseCompose(cfgs []composetypes.ConfigFile, envs map[string]string) (*Conf
|
||||
extraHosts := map[string]*string{}
|
||||
if s.Build.ExtraHosts != nil {
|
||||
for k, v := range s.Build.ExtraHosts {
|
||||
for _, ip := range v {
|
||||
vv := ip
|
||||
extraHosts[k] = &vv
|
||||
}
|
||||
vv := strings.Join(v, ",")
|
||||
extraHosts[k] = &vv
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -34,6 +34,7 @@ services:
|
||||
- type=local,dest=path/to/cache
|
||||
extra_hosts:
|
||||
- "somehost:162.242.195.82"
|
||||
- "somehost:162.242.195.83"
|
||||
- "myhostv6:::1"
|
||||
ssh:
|
||||
- key=/path/to/key
|
||||
@@ -79,7 +80,7 @@ secrets:
|
||||
require.Equal(t, ptrstr("123"), c.Targets[1].Args["buildno"])
|
||||
require.Equal(t, []string{"type=local,src=path/to/cache"}, stringify(c.Targets[1].CacheFrom))
|
||||
require.Equal(t, []string{"type=local,dest=path/to/cache"}, stringify(c.Targets[1].CacheTo))
|
||||
require.Equal(t, map[string]*string{"myhostv6": ptrstr("::1"), "somehost": ptrstr("162.242.195.82")}, c.Targets[1].ExtraHosts)
|
||||
require.Equal(t, map[string]*string{"myhostv6": ptrstr("::1"), "somehost": ptrstr("162.242.195.82,162.242.195.83")}, c.Targets[1].ExtraHosts)
|
||||
require.Equal(t, "none", *c.Targets[1].NetworkMode)
|
||||
require.Equal(t, []string{"default", "key=/path/to/key"}, stringify(c.Targets[1].SSH))
|
||||
require.Equal(t, []string{
|
||||
|
||||
Reference in New Issue
Block a user