fixed issue with windows using bash script
This commit is contained in:
@@ -310,7 +310,7 @@ func (c *Compiler) Compile(ctx context.Context, args Args) *engine.Spec {
|
||||
dst.Envs = environ.Combine(envs, dst.Envs)
|
||||
dst.Volumes = append(dst.Volumes, mount)
|
||||
dst.Labels = labels
|
||||
setupScript(src, dst, full)
|
||||
setupScript(src, dst, os)
|
||||
setupWorkdir(src, dst, full)
|
||||
spec.Steps = append(spec.Steps, dst)
|
||||
|
||||
|
||||
@@ -28,8 +28,9 @@ func setupScript(src *resource.Step, dst *engine.Step, os string) {
|
||||
// windows operating system.
|
||||
func setupScriptWindows(src *resource.Step, dst *engine.Step) {
|
||||
dst.Entrypoint = []string{"powershell", "-noprofile", "-noninteractive", "-command"}
|
||||
dst.Command = []string{"echo $DRONE_SCRIPT | iex"}
|
||||
dst.Command = []string{"echo $Env:DRONE_SCRIPT | iex"}
|
||||
dst.Envs["DRONE_SCRIPT"] = powershell.Script(src.Commands)
|
||||
dst.Envs["SHELL"] = "powershell.exe"
|
||||
}
|
||||
|
||||
// helper function configures the pipeline script for the
|
||||
|
||||
@@ -9,6 +9,7 @@ import (
|
||||
"io"
|
||||
"io/ioutil"
|
||||
|
||||
"github.com/drone-runners/drone-runner-docker/internal/docker/errors"
|
||||
"github.com/drone-runners/drone-runner-docker/internal/docker/image"
|
||||
"github.com/drone-runners/drone-runner-docker/internal/docker/jsonmessage"
|
||||
"github.com/drone-runners/drone-runner-docker/internal/docker/stdcopy"
|
||||
@@ -68,7 +69,7 @@ func (e *Docker) Setup(ctx context.Context, spec *Spec) error {
|
||||
Labels: vol.EmptyDir.Labels,
|
||||
})
|
||||
if err != nil {
|
||||
return err
|
||||
return errors.TrimExtraInfo(err)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -83,7 +84,7 @@ func (e *Docker) Setup(ctx context.Context, spec *Spec) error {
|
||||
Labels: spec.Network.Labels,
|
||||
})
|
||||
|
||||
return err
|
||||
return errors.TrimExtraInfo(err)
|
||||
}
|
||||
|
||||
// Destroy the pipeline environment.
|
||||
@@ -132,17 +133,17 @@ func (e *Docker) Run(ctx context.Context, spec *Spec, step *Step, output io.Writ
|
||||
// create the container
|
||||
err := e.create(ctx, spec, step, output)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
return nil, errors.TrimExtraInfo(err)
|
||||
}
|
||||
// start the container
|
||||
err = e.start(ctx, step.ID)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
return nil, errors.TrimExtraInfo(err)
|
||||
}
|
||||
// tail the container
|
||||
err = e.tail(ctx, step.ID, output)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
return nil, errors.TrimExtraInfo(err)
|
||||
}
|
||||
// wait for the response
|
||||
return e.wait(ctx, step.ID)
|
||||
|
||||
Reference in New Issue
Block a user