1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00

Builder: Fix CI issues

Signed-off-by: John Howard <jhoward@microsoft.com>
This commit is contained in:
John Howard 2018-02-05 14:41:45 -08:00
parent 69fa84bc3d
commit 317513d698
5 changed files with 18 additions and 13 deletions

View file

@ -145,7 +145,7 @@ func (d *dispatchRequest) getImageMount(imageRefOrID string) (*imageMount, error
imageRefOrID = stage.Image imageRefOrID = stage.Image
localOnly = true localOnly = true
} }
return d.builder.imageSources.Get(imageRefOrID, localOnly, d.state.baseImage.OperatingSystem()) return d.builder.imageSources.Get(imageRefOrID, localOnly, d.state.operatingSystem)
} }
// FROM [--platform=platform] imagename[:tag | @digest] [AS build-stage-name] // FROM [--platform=platform] imagename[:tag | @digest] [AS build-stage-name]
@ -288,7 +288,7 @@ func dispatchOnbuild(d dispatchRequest, c *instructions.OnbuildCommand) error {
func dispatchWorkdir(d dispatchRequest, c *instructions.WorkdirCommand) error { func dispatchWorkdir(d dispatchRequest, c *instructions.WorkdirCommand) error {
runConfig := d.state.runConfig runConfig := d.state.runConfig
var err error var err error
runConfig.WorkingDir, err = normalizeWorkdir(d.state.baseImage.OperatingSystem(), runConfig.WorkingDir, c.Path) runConfig.WorkingDir, err = normalizeWorkdir(d.state.operatingSystem, runConfig.WorkingDir, c.Path)
if err != nil { if err != nil {
return err return err
} }
@ -304,7 +304,7 @@ func dispatchWorkdir(d dispatchRequest, c *instructions.WorkdirCommand) error {
} }
comment := "WORKDIR " + runConfig.WorkingDir comment := "WORKDIR " + runConfig.WorkingDir
runConfigWithCommentCmd := copyRunConfig(runConfig, withCmdCommentString(comment, d.state.baseImage.OperatingSystem())) runConfigWithCommentCmd := copyRunConfig(runConfig, withCmdCommentString(comment, d.state.operatingSystem))
containerID, err := d.builder.probeAndCreate(d.state, runConfigWithCommentCmd) containerID, err := d.builder.probeAndCreate(d.state, runConfigWithCommentCmd)
if err != nil || containerID == "" { if err != nil || containerID == "" {
return err return err
@ -339,7 +339,7 @@ func dispatchRun(d dispatchRequest, c *instructions.RunCommand) error {
return system.ErrNotSupportedOperatingSystem return system.ErrNotSupportedOperatingSystem
} }
stateRunConfig := d.state.runConfig stateRunConfig := d.state.runConfig
cmdFromArgs := resolveCmdLine(c.ShellDependantCmdLine, stateRunConfig, d.state.baseImage.OperatingSystem()) cmdFromArgs := resolveCmdLine(c.ShellDependantCmdLine, stateRunConfig, d.state.operatingSystem)
buildArgs := d.state.buildArgs.FilterAllowed(stateRunConfig.Env) buildArgs := d.state.buildArgs.FilterAllowed(stateRunConfig.Env)
saveCmd := cmdFromArgs saveCmd := cmdFromArgs
@ -420,7 +420,7 @@ func prependEnvOnCmd(buildArgs *buildArgs, buildArgVars []string, cmd strslice.S
// //
func dispatchCmd(d dispatchRequest, c *instructions.CmdCommand) error { func dispatchCmd(d dispatchRequest, c *instructions.CmdCommand) error {
runConfig := d.state.runConfig runConfig := d.state.runConfig
cmd := resolveCmdLine(c.ShellDependantCmdLine, runConfig, d.state.baseImage.OperatingSystem()) cmd := resolveCmdLine(c.ShellDependantCmdLine, runConfig, d.state.operatingSystem)
runConfig.Cmd = cmd runConfig.Cmd = cmd
// set config as already being escaped, this prevents double escaping on windows // set config as already being escaped, this prevents double escaping on windows
runConfig.ArgsEscaped = true runConfig.ArgsEscaped = true
@ -463,7 +463,7 @@ func dispatchHealthcheck(d dispatchRequest, c *instructions.HealthCheckCommand)
// //
func dispatchEntrypoint(d dispatchRequest, c *instructions.EntrypointCommand) error { func dispatchEntrypoint(d dispatchRequest, c *instructions.EntrypointCommand) error {
runConfig := d.state.runConfig runConfig := d.state.runConfig
cmd := resolveCmdLine(c.ShellDependantCmdLine, runConfig, d.state.baseImage.OperatingSystem()) cmd := resolveCmdLine(c.ShellDependantCmdLine, runConfig, d.state.operatingSystem)
runConfig.Entrypoint = cmd runConfig.Entrypoint = cmd
if !d.state.cmdSet { if !d.state.cmdSet {
runConfig.Cmd = nil runConfig.Cmd = nil

View file

@ -37,7 +37,7 @@ import (
func dispatch(d dispatchRequest, cmd instructions.Command) (err error) { func dispatch(d dispatchRequest, cmd instructions.Command) (err error) {
if c, ok := cmd.(instructions.PlatformSpecific); ok { if c, ok := cmd.(instructions.PlatformSpecific); ok {
err := c.CheckPlatform(d.state.baseImage.OperatingSystem()) err := c.CheckPlatform(d.state.operatingSystem)
if err != nil { if err != nil {
return errdefs.InvalidParameter(err) return errdefs.InvalidParameter(err)
} }

View file

@ -83,7 +83,7 @@ func (b *Builder) commit(dispatchState *dispatchState, comment string) error {
return errors.New("Please provide a source image with `from` prior to commit") return errors.New("Please provide a source image with `from` prior to commit")
} }
runConfigWithCommentCmd := copyRunConfig(dispatchState.runConfig, withCmdComment(comment, dispatchState.baseImage.OperatingSystem())) runConfigWithCommentCmd := copyRunConfig(dispatchState.runConfig, withCmdComment(comment, dispatchState.operatingSystem))
hit, err := b.probeCache(dispatchState, runConfigWithCommentCmd) hit, err := b.probeCache(dispatchState, runConfigWithCommentCmd)
if err != nil || hit { if err != nil || hit {
return err return err
@ -165,13 +165,13 @@ func (b *Builder) performCopy(state *dispatchState, inst copyInstruction) error
// TODO: should this have been using origPaths instead of srcHash in the comment? // TODO: should this have been using origPaths instead of srcHash in the comment?
runConfigWithCommentCmd := copyRunConfig( runConfigWithCommentCmd := copyRunConfig(
state.runConfig, state.runConfig,
withCmdCommentString(commentStr, state.baseImage.OperatingSystem())) withCmdCommentString(commentStr, state.operatingSystem))
hit, err := b.probeCache(state, runConfigWithCommentCmd) hit, err := b.probeCache(state, runConfigWithCommentCmd)
if err != nil || hit { if err != nil || hit {
return err return err
} }
imageMount, err := b.imageSources.Get(state.imageID, true, state.baseImage.OperatingSystem()) imageMount, err := b.imageSources.Get(state.imageID, true, state.operatingSystem)
if err != nil { if err != nil {
return errors.Wrapf(err, "failed to get destination image %q", state.imageID) return errors.Wrapf(err, "failed to get destination image %q", state.imageID)
} }
@ -182,7 +182,7 @@ func (b *Builder) performCopy(state *dispatchState, inst copyInstruction) error
} }
defer rwLayer.Release() defer rwLayer.Release()
destInfo, err := createDestInfo(state.runConfig.WorkingDir, inst, rwLayer, state.baseImage.OperatingSystem()) destInfo, err := createDestInfo(state.runConfig.WorkingDir, inst, rwLayer, state.operatingSystem)
if err != nil { if err != nil {
return err return err
} }

View file

@ -7,6 +7,7 @@ import (
"github.com/docker/distribution/reference" "github.com/docker/distribution/reference"
"github.com/docker/docker/api/types/image" "github.com/docker/docker/api/types/image"
"github.com/docker/docker/layer" "github.com/docker/docker/layer"
"github.com/docker/docker/pkg/system"
) )
// ImageHistory returns a slice of ImageHistory structures for the specified image // ImageHistory returns a slice of ImageHistory structures for the specified image
@ -31,7 +32,9 @@ func (i *ImageService) ImageHistory(name string) ([]*image.HistoryResponseItem,
if len(img.RootFS.DiffIDs) <= layerCounter { if len(img.RootFS.DiffIDs) <= layerCounter {
return nil, fmt.Errorf("too many non-empty layers in History section") return nil, fmt.Errorf("too many non-empty layers in History section")
} }
if !system.IsOSSupported(img.OperatingSystem()) {
return nil, system.ErrNotSupportedOperatingSystem
}
rootFS.Append(img.RootFS.DiffIDs[layerCounter]) rootFS.Append(img.RootFS.DiffIDs[layerCounter])
l, err := i.layerStores[img.OperatingSystem()].Get(rootFS.ChainID()) l, err := i.layerStores[img.OperatingSystem()].Get(rootFS.ChainID())
if err != nil { if err != nil {

View file

@ -271,7 +271,9 @@ func (i *ImageService) SquashImage(id, parent string) (string, error) {
rootFS := image.NewRootFS() rootFS := image.NewRootFS()
parentImg = &image.Image{RootFS: rootFS} parentImg = &image.Image{RootFS: rootFS}
} }
if !system.IsOSSupported(img.OperatingSystem()) {
return "", errors.Wrap(err, system.ErrNotSupportedOperatingSystem.Error())
}
l, err := i.layerStores[img.OperatingSystem()].Get(img.RootFS.ChainID()) l, err := i.layerStores[img.OperatingSystem()].Get(img.RootFS.ChainID())
if err != nil { if err != nil {
return "", errors.Wrap(err, "error getting image layer") return "", errors.Wrap(err, "error getting image layer")