Add experimental way to set a target platform when building
Add an --experimental-platform flag to the do command to allow overriding the default auto-detected build platform until we find the time to think about the definitive multi-platform builds UX Signed-off-by: Marcos Lilljedahl <marcosnils@gmail.com>
This commit is contained in:
@@ -44,6 +44,8 @@ type Config struct {
|
||||
|
||||
CacheExports []bk.CacheOptionsEntry
|
||||
CacheImports []bk.CacheOptionsEntry
|
||||
|
||||
TargetPlatform *specs.Platform
|
||||
}
|
||||
|
||||
func New(ctx context.Context, host string, cfg Config) (*Client, error) {
|
||||
@@ -81,8 +83,9 @@ func (c *Client) Do(ctx context.Context, pctx *plancontext.Context, fn DoFunc) e
|
||||
lg := log.Ctx(ctx)
|
||||
eg, gctx := errgroup.WithContext(ctx)
|
||||
|
||||
// if platform is set through plan config, skip detection.
|
||||
if !pctx.Platform.IsSet() {
|
||||
if c.cfg.TargetPlatform != nil {
|
||||
pctx.Platform.Set(*c.cfg.TargetPlatform)
|
||||
} else {
|
||||
p, err := c.detectPlatform(ctx)
|
||||
if err != nil {
|
||||
return err
|
||||
|
Reference in New Issue
Block a user