mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2024-11-26 20:01:02 +00:00
improved error messaging for failed build due to Docker errors
This commit is contained in:
parent
baaaa4069e
commit
c3e00e2608
1 changed files with 7 additions and 5 deletions
|
@ -238,7 +238,7 @@ func (b *Builder) setup() error {
|
||||||
if _, err := b.dockerClient.Images.Inspect(b.Build.Image); err == docker.ErrNotFound {
|
if _, err := b.dockerClient.Images.Inspect(b.Build.Image); err == docker.ErrNotFound {
|
||||||
// download the image if it doesn't exist
|
// download the image if it doesn't exist
|
||||||
if err := b.dockerClient.Images.Pull(b.Build.Image); err != nil {
|
if err := b.dockerClient.Images.Pull(b.Build.Image); err != nil {
|
||||||
return err
|
return fmt.Errorf("Error: Unable to pull image %s. %s", b.Build.Image, err)
|
||||||
}
|
}
|
||||||
} else if err != nil {
|
} else if err != nil {
|
||||||
log.Errf("failed to inspect image %s", b.Build.Image)
|
log.Errf("failed to inspect image %s", b.Build.Image)
|
||||||
|
@ -392,7 +392,7 @@ func (b *Builder) run() error {
|
||||||
// create the container from the image
|
// create the container from the image
|
||||||
run, err := b.dockerClient.Containers.Create(&conf)
|
run, err := b.dockerClient.Containers.Create(&conf)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return fmt.Errorf("Error: Failed to create build container. %s", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
// cache instance of docker.Run
|
// cache instance of docker.Run
|
||||||
|
@ -407,7 +407,7 @@ func (b *Builder) run() error {
|
||||||
if err := b.dockerClient.Containers.Start(run.ID, &host); err != nil {
|
if err := b.dockerClient.Containers.Start(run.ID, &host); err != nil {
|
||||||
b.BuildState.ExitCode = 1
|
b.BuildState.ExitCode = 1
|
||||||
b.BuildState.Finished = time.Now().UTC().Unix()
|
b.BuildState.Finished = time.Now().UTC().Unix()
|
||||||
return err
|
return fmt.Errorf("Error: Failed to start build container. %s", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
// wait for the container to stop
|
// wait for the container to stop
|
||||||
|
@ -415,7 +415,7 @@ func (b *Builder) run() error {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
b.BuildState.ExitCode = 1
|
b.BuildState.ExitCode = 1
|
||||||
b.BuildState.Finished = time.Now().UTC().Unix()
|
b.BuildState.Finished = time.Now().UTC().Unix()
|
||||||
return err
|
return fmt.Errorf("Error: Failed to wait for build container. %s", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
// set completion time
|
// set completion time
|
||||||
|
@ -503,7 +503,9 @@ func (b *Builder) writeBuildScript(dir string) error {
|
||||||
f.WriteHost(mapping)
|
f.WriteHost(mapping)
|
||||||
}
|
}
|
||||||
|
|
||||||
f.WriteFile("$HOME/.ssh/id_rsa", b.Key, 600)
|
if len(b.Key) != 0 {
|
||||||
|
f.WriteFile("$HOME/.ssh/id_rsa", b.Key, 600)
|
||||||
|
}
|
||||||
|
|
||||||
// if the repository is remote then we should
|
// if the repository is remote then we should
|
||||||
// add the commands to the build script to
|
// add the commands to the build script to
|
||||||
|
|
Loading…
Reference in a new issue