Skip to content

Commit

Permalink
fix(test env): ensure build user in environment
Browse files Browse the repository at this point in the history
The Test pipeline environment does not get a build user included by
default; this causes test pipelines to fail when the qemu runner is used
because the initial connection attempt to get the host public key always
uses the build user to connect. Fix this by adding the build user to all
Test environments, both the primary pipeline and any subpipelines.

Fixes: #1732
Signed-off-by: Steve Beattie <[email protected]>
  • Loading branch information
stevebeattie committed Jan 13, 2025
1 parent 1c0002b commit 783dca2
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions pkg/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -1358,6 +1358,16 @@ func ParseConfiguration(_ context.Context, configurationFilePath string, opts ..
Members: []string{"build"},
}
cfg.Environment.Accounts.Groups = append(cfg.Environment.Accounts.Groups, grp)
if cfg.Test != nil {
cfg.Test.Environment.Accounts.Groups = append(cfg.Test.Environment.Accounts.Groups, grp)
}
for i := range cfg.Subpackages {
sub := &cfg.Subpackages[i]
if sub.Test == nil || len(sub.Test.Pipeline) == 0 {
continue
}
sub.Test.Environment.Accounts.Groups = append(sub.Test.Environment.Accounts.Groups, grp)
}

gid1000 := uint32(1000)
usr := apko_types.User{
Expand All @@ -1366,6 +1376,16 @@ func ParseConfiguration(_ context.Context, configurationFilePath string, opts ..
GID: apko_types.GID(&gid1000),
}
cfg.Environment.Accounts.Users = append(cfg.Environment.Accounts.Users, usr)
if cfg.Test != nil {
cfg.Test.Environment.Accounts.Users = append(cfg.Test.Environment.Accounts.Users, usr)
}
for i := range cfg.Subpackages {
sub := &cfg.Subpackages[i]
if sub.Test == nil || len(sub.Test.Pipeline) == 0 {
continue
}
sub.Test.Environment.Accounts.Users = append(sub.Test.Environment.Accounts.Users, usr)
}

// Merge environment file if needed.
if envFile := options.envFilePath; envFile != "" {
Expand Down

0 comments on commit 783dca2

Please sign in to comment.