[LXD] Allow arch override to ensure that correct image is selected for sub-arch
@@ -25,6 +25,7 @@ import (
)
var (
+ lxdArchOverride = ""
lxdLimitCPU = "2"
lxdLimitCPUBurst = false
lxdLimitDisk = "10GB"
@@ -44,6 +45,7 @@ var (
lxdSecurityPrivileged = "false"
lxdHelp = map[string]string{
+ "ARCH_OVERRIDE": fmt.Sprintf("override arch value from job config (default %q)", lxdArchOverride),
"EXEC_CMD": fmt.Sprintf("command to run via exec/ssh (default %q)", lxdExecCmd),
"EXEC_UID": fmt.Sprintf("UID of travis user (default %d)", lxdExecUID),
"MEMORY": fmt.Sprintf("memory to allocate to each container (default %q)", lxdLimitMemory),
@@ -126,6 +128,11 @@ func newLXDProvider(cfg *config.ProviderConfig) (Provider, error) {
return nil, err
}
+ archOverride := lxdArchOverride
+ if cfg.IsSet("ARCH_OVERRIDE") {
+ archOverride = cfg.Get("ARCH_OVERRIDE")
+ }
+
execCmd := strings.Split(lxdExecCmd, " ")
if cfg.IsSet("EXEC_CMD") {
execCmd = strings.Split(cfg.Get("EXEC_CMD"), " ")
@@ -307,6 +314,8 @@ func newLXDProvider(cfg *config.ProviderConfig) (Provider, error) {
return &lxdProvider{
client: client,
+ archOverride: archOverride,
+
limitCPU: limitCPU,
limitCPUBurst: limitCPUBurst,
limitDisk: limitDisk,
@@ -500,8 +509,13 @@ func (p *lxdProvider) Start(ctx gocontext.Context, startAttributes *StartAttribu
if startAttributes.ImageName != "" {
imageName = startAttributes.ImageName
} else {
+ imageArch := startAttributes.Arch
+ if p.archOverride != "" {
+ imageArch = p.archOverride
+ }
+
imageName, err = p.imageSelector.Select(ctx, &image.Params{
- Infra: "lxd-" + startAttributes.Arch,
+ Infra: "lxd-" + imageArch,
Language: startAttributes.Language,
OsxImage: startAttributes.OsxImage,
Dist: startAttributes.Dist,
