这是indexloc提供的服务,不要输入任何密码
Skip to content
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
43 changes: 42 additions & 1 deletion cmd/sharedflows/depsf.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,11 @@
package sharedflows

import (
"encoding/json"
"time"

"internal/apiclient"
"internal/clilog"

"internal/client/sharedflows"

Expand All @@ -38,15 +42,49 @@ var DepCmd = &cobra.Command{
}
}
_, err = sharedflows.Deploy(name, revision, overrides, serviceAccountName)
apiclient.DisableCmdPrintHttpResponse()

if wait {
clilog.Info.Printf("Checking deployment status in %d seconds\n", interval)

stop := apiclient.Every(interval*time.Second, func(time.Time) bool {
var respBody []byte
respMap := make(map[string]interface{})
if respBody, err = sharedflows.ListRevisionDeployments(name, revision); err != nil {
clilog.Error.Printf("Error fetching sharedflow revision status: %v", err)
return false
}

if err = json.Unmarshal(respBody, &respMap); err != nil {
return true
}

if respMap["state"] == "PROGRESSING" {
clilog.Info.Printf("Sharedflow deployment status is: %s. Waiting %d seconds.\n", respMap["state"], interval)
return true
} else if respMap["state"] == "READY" {
clilog.Info.Println("Sharedflow deployment completed with status: ", respMap["state"])
return false
} else {
clilog.Info.Println("Sharedflow deployment failed with status: ", respMap["state"])
return false
}
})

<-stop
}

return err
},
}

var (
overrides bool
overrides, wait bool
serviceAccountName string
)

const interval = 10

func init() {
DepCmd.Flags().StringVarP(&name, "name", "n",
"", "Sharedflow name")
Expand All @@ -56,6 +94,9 @@ func init() {
-1, "Sharedflow revision. If not set, the highest revision is used")
DepCmd.Flags().BoolVarP(&overrides, "ovr", "r",
false, "Forces deployment of the new revision")
DepCmd.Flags().BoolVarP(&wait, "wait", "",
false, "Waits for the deployment to finish, with success or error")

DepCmd.Flags().StringVarP(&serviceAccountName, "sa", "s",
"", "The format must be {ACCOUNT_ID}@{PROJECT}.iam.gserviceaccount.com.")

Expand Down
7 changes: 4 additions & 3 deletions internal/bundlegen/proxybundle/proxybundle.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,10 @@ import (
"golang.org/x/oauth2"
)

var proxyRootDir = "apiproxy"
var sfRootDir = "sharedflowbundle"
var (
proxyRootDir = "apiproxy"
sfRootDir = "sharedflowbundle"
)

func GenerateAPIProxyBundleFromOAS(name string,
content string,
Expand Down Expand Up @@ -692,7 +694,6 @@ func archiveBundle(pathToZip, destinationPath string, sharedflow bool) (err erro
}

func GitHubImportBundle(owner string, repo string, repopath string, sharedflow bool) (err error) {

var rootDir string

if sharedflow {
Expand Down
2 changes: 1 addition & 1 deletion internal/client/appgroups/appgroups.go
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ func Update(name string, channelURI string, channelID string, displayName string
developerDetailsAttribute.Value = getDeveloperDetails(devs)
}

//clear existing attributes
// clear existing attributes
a.Attributes = nil

if len(attrs) != 0 {
Expand Down