Skip to content

Commit

Permalink
Merge pull request #563 from Scalingo/fix/562/deployment_fails
Browse files Browse the repository at this point in the history
Send an non zero exit code when the deploy command fails
  • Loading branch information
Soulou authored and EtienneM committed May 15, 2020
1 parent 22a315f commit 9d48f28
Show file tree
Hide file tree
Showing 10 changed files with 75 additions and 11 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
* Region Migration: Better output for the `migration-follow` command to explain what is happening [#549](https://github.com/Scalingo/cli/pull/549)
* Region Migration: Retry if it fails to refresh the migration status [#550](https://github.com/Scalingo/cli/pull/550)
* Region Migration: Add instructions to change local Git URL at the end of the migration [#551](https://github.com/Scalingo/cli/pull/551)
* Deployment: Send a non 0 exit code when a deployment fails [#563](https://github.com/Scalingo/cli/pull/563)
* Bugfix: fix support for `addon_updated` and `start_region_migration` event type [#558](https://github.com/Scalingo/cli/pull/558)
* Bugfix: fix author of `restart` and `edit_variable` when it's an addon [#558](https://github.com/Scalingo/cli/pull/558)

Expand Down
6 changes: 3 additions & 3 deletions Gopkg.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions Gopkg.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,7 @@

[[constraint]]
name = "github.com/Scalingo/go-scalingo"
# version = "^4"
branch = "fix/cli/556/addon_updated"
version = "^4"

[[constraint]]
branch = "master"
Expand Down
2 changes: 1 addition & 1 deletion deployments/deploy.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import (
"strings"

"github.com/Scalingo/cli/config"
"github.com/Scalingo/go-scalingo/debug"
"github.com/Scalingo/go-scalingo"
"github.com/Scalingo/go-scalingo/debug"
scalingoio "github.com/Scalingo/go-scalingo/io"

"gopkg.in/errgo.v1"
Expand Down
8 changes: 7 additions & 1 deletion deployments/follow.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,21 @@ package deployments

import (
"encoding/json"
"errors"
"fmt"
stdio "io"
"strings"
"time"

"github.com/Scalingo/cli/config"
"github.com/Scalingo/go-scalingo/debug"
"github.com/Scalingo/go-scalingo"
"github.com/Scalingo/go-scalingo/debug"
"golang.org/x/net/websocket"
"gopkg.in/errgo.v1"
)

var ErrDeploymentFailed = errors.New("Deployment failed")

type StreamOpts struct {
AppName string
DeploymentID string
Expand Down Expand Up @@ -117,6 +120,9 @@ func Stream(opts *StreamOpts) error {
statuses[event.ID] = statusData.Content

if !anyDeployment && scalingo.IsFinishedString(scalingo.DeploymentStatus(statusData.Content)) {
if scalingo.HasFailedString(scalingo.DeploymentStatus(statusData.Content)) {
return ErrDeploymentFailed
}
return nil
}
case "new":
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 9d48f28

Please sign in to comment.