Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle new queued deployment status #586

Merged
merged 2 commits into from
Aug 19, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

### To be Released

* Handle new `queued` deployment status
[#586](https://github.com/Scalingo/cli/pull/586)
[go-scalingo #177](https://github.com/Scalingo/go-scalingo/pull/177)
* Remove a log drain from an addon
[#577](https://github.com/Scalingo/cli/pull/577)
[go-scalingo #175](https://github.com/Scalingo/go-scalingo/pull/175)
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.

20 changes: 19 additions & 1 deletion deployments/deploy.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"net/http"
"os"
"strings"
"time"

"github.com/Scalingo/cli/config"
"github.com/Scalingo/go-scalingo"
Expand Down Expand Up @@ -50,7 +51,10 @@ func Deploy(app, archivePath, gitRef string) error {
return errgo.Mask(err, errgo.Any)
}

scalingoio.Info("Deployment started, streaming output:")
scalingoio.Status("Your deployment has been queued and is going to start…")

go showQueuedWarnings(c, app, deployment.ID)

debug.Println("Streaming deployment logs of", app, ":", deployment.ID)
err = Stream(&StreamOpts{
AppName: app,
Expand Down Expand Up @@ -107,3 +111,17 @@ func uploadArchive(uploadURL string, archiveReader io.Reader, archiveSize int64)

return http.DefaultClient.Do(req)
}

func showQueuedWarnings(c *scalingo.Client, appID, deploymentID string) {
for {
time.Sleep(time.Minute)
deployment, err := c.Deployment(appID, deploymentID)
if err != nil {
debug.Printf("Queued deployment watcher error: %s\n", err.Error())
}
if deployment.Status != scalingo.StatusQueued {
return
}
scalingoio.Warning("All deployment slots of application owner are currently in use, the deployment will start as soon as one is available.")
}
}

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.