Skip to content

Commit ec02947

Browse files
authored
Merge pull request #487 from ANUGRAHG/main
feat: support pushing an application without starting it
2 parents 5f1c83e + 932b4cc commit ec02947

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

operation/push.go

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ type AppPushOperation struct {
2828
spaceName string
2929
client *client.Client
3030
strategy StrategyMode
31+
stopped bool
3132
}
3233

3334
// NewAppPushOperation creates a new AppPushOperation
@@ -38,6 +39,7 @@ func NewAppPushOperation(client *client.Client, orgName, spaceName string) *AppP
3839
client: client,
3940
}
4041
apo.strategy = StrategyNone
42+
apo.stopped = false
4143
return &apo
4244
}
4345
func (p *AppPushOperation) WithStrategy(s StrategyMode) {
@@ -49,6 +51,10 @@ func (p *AppPushOperation) WithStrategy(s StrategyMode) {
4951
}
5052
}
5153

54+
func (p *AppPushOperation) WithNoStart(stopped bool) {
55+
p.stopped = stopped
56+
}
57+
5258
// Push creates or updates an application using the specified manifest and zipped source files
5359
func (p *AppPushOperation) Push(ctx context.Context, appManifest *AppManifest, zipFile io.Reader) (*resource.App, error) {
5460
org, err := p.findOrg(ctx)
@@ -315,7 +321,11 @@ func (p *AppPushOperation) pushApp(ctx context.Context, space *resource.Space, m
315321
return nil, err
316322
}
317323

318-
return p.client.Applications.Start(ctx, app.GUID)
324+
if p.stopped {
325+
return p.client.Applications.Stop(ctx, app.GUID)
326+
} else {
327+
return p.client.Applications.Start(ctx, app.GUID)
328+
}
319329
}
320330

321331
func (p *AppPushOperation) applySpaceManifest(ctx context.Context, space *resource.Space, manifest *AppManifest) error {

0 commit comments

Comments
 (0)