Skip to content

Commit

Permalink
pr feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
jprobinson committed Feb 20, 2019
1 parent 6ba1e33 commit 5ca2d9e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
4 changes: 3 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,9 @@ type GAE struct {
// MaxVersions is an optional value that can be used along with the "deploy" or
// "update" actions. If set to a non-zero value, the plugin will look up the versions
// of the deployed service and delete any older versions beyond the "max" value
// provided.
// provided. If any of the "older" versions that should be deleted is actually
// serving traffic, they will not be deleted. This may result in the actual version
// count being higher than the max listed here.
MaxVersions int `json:"max_versions"`

// CronFile is the name of the cron.yaml file to use for this deployment. This field
Expand Down
7 changes: 6 additions & 1 deletion remove.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ func removeOldVersions(runner *Environ, workspace string, vargs GAE) error {
service = appStruct.Module
}

// look up existing versions for given service ordered by create time desc
// look up existing versions for given service ordered by create time desc
var versionJSON bytes.Buffer
sout := runner.stdout
runner.stdout = &versionJSON
Expand Down Expand Up @@ -61,6 +61,11 @@ func removeOldVersions(runner *Environ, workspace string, vargs GAE) error {
}
toDelete = append(toDelete, res.ID)
}

if len(toDelete) == 0 {
return nil
}

log.Printf("deleting %d versions: %s", len(toDelete), toDelete)

runner.stdout = sout
Expand Down

0 comments on commit 5ca2d9e

Please sign in to comment.