build: make annotations work with push flag

Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
This commit is contained in:
CrazyMax
2023-10-26 12:01:10 +02:00
parent deb9dbe9bb
commit f3871b158f
4 changed files with 143 additions and 131 deletions

View File

@ -113,6 +113,7 @@ func (o *buildOptions) toControllerOptions() (*controllerapi.BuildOptions, error
opts := controllerapi.BuildOptions{
Allow: o.allow,
Annotations: o.annotations,
BuildArgs: buildArgs,
CgroupParent: o.cgroupParent,
ContextPath: o.contextPath,
@ -172,16 +173,6 @@ func (o *buildOptions) toControllerOptions() (*controllerapi.BuildOptions, error
}
}
annotations, err := buildflags.ParseAnnotations(o.annotations)
if err != nil {
return nil, err
}
for _, e := range opts.Exports {
for k, v := range annotations {
e.Attrs[k.String()] = v
}
}
opts.CacheFrom, err = buildflags.ParseCacheEntry(o.cacheFrom)
if err != nil {
return nil, err