Skip to content

Commit cde33e2

Browse files
committed
Pass SystemContext in RunOptions
Signed-off-by: Miloslav Trmač <mitr@redhat.com>
1 parent 32f9b88 commit cde33e2

2 files changed

Lines changed: 7 additions & 5 deletions

File tree

cmd/buildah/from.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ func onBuild(builder *buildah.Builder, systemContext *types.SystemContext, quiet
172172
if quiet {
173173
stdout = io.Discard
174174
}
175-
if err := builder.Run(args, buildah.RunOptions{Stdout: stdout}); err != nil {
175+
if err := builder.Run(args, buildah.RunOptions{Stdout: stdout, SystemContext: systemContext}); err != nil {
176176
return err
177177
}
178178
case "SHELL":

cmd/buildah/run.go

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,11 @@ func runCmd(c *cobra.Command, args []string, iopts runInputOptions) error {
157157
}
158158
}
159159

160+
systemContext, err := parse.SystemContextFromOptions(c)
161+
if err != nil {
162+
return fmt.Errorf("building system context: %w", err)
163+
}
164+
160165
options := buildah.RunOptions{
161166
Hostname: iopts.hostname,
162167
Runtime: iopts.runtime,
@@ -175,6 +180,7 @@ func runCmd(c *cobra.Command, args []string, iopts runInputOptions) error {
175180
DropCapabilities: iopts.capDrop,
176181
WorkingDir: iopts.workingDir,
177182
DeviceSpecs: iopts.devices,
183+
SystemContext: systemContext,
178184
CDIConfigDir: iopts.cdiConfigDir,
179185
}
180186

@@ -188,10 +194,6 @@ func runCmd(c *cobra.Command, args []string, iopts runInputOptions) error {
188194

189195
options.Env = buildahcli.LookupEnvVarReferences(iopts.env, os.Environ())
190196

191-
systemContext, err := parse.SystemContextFromOptions(c)
192-
if err != nil {
193-
return fmt.Errorf("building system context: %w", err)
194-
}
195197
mounts, mountedImages, intermediateMounts, _, targetLocks, err := volumes.GetVolumes(systemContext, store, builder.MountLabel, iopts.volumes, iopts.mounts, iopts.contextDir, builder.IDMappingOptions, iopts.workingDir, tmpDir)
196198
if err != nil {
197199
return err

0 commit comments

Comments
 (0)