@@ -17,7 +17,6 @@ package platform
1717import (
1818 "archive/zip"
1919 "context"
20- "encoding/json"
2120 "fmt"
2221 "io"
2322 "os"
@@ -37,25 +36,25 @@ import (
3736)
3837
3938// Deploy will package and upload an app to the Slack Platform
40- func Deploy (ctx context.Context , clients * shared.ClientFactory , showTriggers bool , app types.App ) ( DeployResult , error ) {
39+ func Deploy (ctx context.Context , clients * shared.ClientFactory , showTriggers bool , app types.App ) error {
4140 span , ctx := opentracing .StartSpanFromContext (ctx , "cmd.deploy" )
4241 defer span .Finish ()
4342
4443 // Get auth token
4544 token := config .GetContextToken (ctx )
4645 if strings .TrimSpace (token ) == "" {
47- return DeployResult {}, slackerror .New (slackerror .ErrAuthToken )
46+ return slackerror .New (slackerror .ErrAuthToken )
4847 }
4948
5049 if app .IsNew () {
5150 err := slackerror .New ("no app found to deploy" )
52- return DeployResult {}, slackerror .Wrap (err , slackerror .ErrAppDeploy )
51+ return slackerror .Wrap (err , slackerror .ErrAppDeploy )
5352 }
5453
5554 // Validate auth session
5655 authSession , err := clients .API ().ValidateSession (ctx , token )
5756 if err != nil {
58- return DeployResult {}, slackerror .Wrap (err , slackerror .ErrSlackAuth )
57+ return slackerror .Wrap (err , slackerror .ErrSlackAuth )
5958 }
6059
6160 // Add enterprise_id returned from auth session to app if exists
@@ -66,8 +65,6 @@ func Deploy(ctx context.Context, clients *shared.ClientFactory, showTriggers boo
6665 // TODO: should we also SetAppEnterpriseID for metrics tracking?
6766 }
6867
69- authString , _ := json .Marshal (authSession )
70- authSessionJSON := string (authString )
7168 if authSession .UserID != nil {
7269 ctx = config .SetContextUserID (ctx , * authSession .UserID )
7370 clients .EventTracker .SetAuthUserID (* authSession .UserID )
@@ -79,37 +76,31 @@ func Deploy(ctx context.Context, clients *shared.ClientFactory, showTriggers boo
7976 // updating an app manifest should happen before an app is deployed.
8077 manifest , err := clients .AppClient ().Manifest .GetManifestRemote (ctx , token , app .AppID )
8178 if err != nil {
82- return DeployResult {}, slackerror .Wrap (err , slackerror .ErrAppManifestAccess )
79+ return slackerror .Wrap (err , slackerror .ErrAppManifestAccess )
8380 }
84- appName := manifest .DisplayInformation .Name
8581
8682 if showTriggers {
8783 // Generate an optional trigger when none exist
8884 _ , err = triggers .TriggerGenerate (ctx , clients , app )
8985 if err != nil {
90- return DeployResult {}, slackerror .Wrap (err , slackerror .ErrAppDeploy )
86+ return slackerror .Wrap (err , slackerror .ErrAppDeploy )
9187 }
9288 }
9389
9490 // deploy the app
95- appID , deployTime , err : = deployApp (ctx , clients , app , manifest , authSession )
91+ _ , _ , err = deployApp (ctx , clients , app , manifest , authSession )
9692 if err != nil {
97- return DeployResult {}, slackerror .Wrap (err , slackerror .ErrAppDeploy )
93+ return slackerror .Wrap (err , slackerror .ErrAppDeploy )
9894 }
9995
10096 // Save app to apps.json
10197 if ! clients .Config .SkipLocalFs () {
10298 if err := clients .AppClient ().SaveDeployed (ctx , app ); err != nil {
103- return DeployResult {}, slackerror .Wrap (err , slackerror .ErrAppDeploy )
99+ return slackerror .Wrap (err , slackerror .ErrAppDeploy )
104100 }
105101 }
106102
107- return DeployResult {
108- AppName : appName ,
109- AppID : appID ,
110- DeployTime : deployTime ,
111- AuthSession : authSessionJSON ,
112- }, nil
103+ return nil
113104}
114105
115106func deployApp (ctx context.Context , clients * shared.ClientFactory , app types.App , manifest types.SlackYaml , authSession api.AuthSession ) (string , string , error ) {
@@ -246,14 +237,6 @@ func deploySuccessText(clients *shared.ClientFactory, app types.App, manifest ty
246237 })
247238}
248239
249- // DeployResult contains data collected during the deploy process for output
250- type DeployResult struct {
251- AppName string
252- AppID string
253- DeployTime string
254- AuthSession string
255- }
256-
257240type packageResult struct {
258241 Filename string
259242 Size int64
0 commit comments