diff --git a/go.mod b/go.mod index 224f26f..ab694db 100644 --- a/go.mod +++ b/go.mod @@ -3,6 +3,7 @@ module github.com/jenkins-x/jx-promote require ( github.com/blang/semver v3.5.1+incompatible github.com/cli/cli v0.6.2 + github.com/cpuguy83/go-md2man v1.0.10 github.com/ghodss/yaml v1.0.0 github.com/google/go-cmp v0.3.1 github.com/google/uuid v1.1.1 @@ -20,6 +21,7 @@ require ( github.com/satori/go.uuid v1.2.1-0.20180103174451-36e9d2ebbde5 github.com/sirupsen/logrus v1.6.0 github.com/spf13/cobra v0.0.6 + github.com/spf13/pflag v1.0.5 github.com/stretchr/testify v1.6.0 gopkg.in/AlecAivazis/survey.v1 v1.8.3 gopkg.in/src-d/go-git.v4 v4.13.1 @@ -57,4 +59,7 @@ replace github.com/TV4/logrus-stackdriver-formatter => github.com/jenkins-x/logr replace code.gitea.io/sdk/gitea => code.gitea.io/sdk/gitea v0.12.0 +// TODO until this PR is merged https://github.com/jenkins-x/go-scm/pull/150 +replace github.com/jenkins-x/go-scm => github.com/jstrachan/go-scm v1.5.1-0.20200624082102-98a34cc79bbc + go 1.13 diff --git a/go.sum b/go.sum index ad53f6f..16d824f 100644 --- a/go.sum +++ b/go.sum @@ -465,8 +465,6 @@ github.com/jbrukh/bayesian v0.0.0-20161210175230-bf3f261f9a9c h1:jqLMOnuwp+ac6nI github.com/jbrukh/bayesian v0.0.0-20161210175230-bf3f261f9a9c/go.mod h1:SELxwZQq/mPnfPCR2mchLmT4TQaPJvYtLcCtDWSM7vM= github.com/jenkins-x/draft-repo v0.0.0-20180417100212-2f66cc518135 h1:3zy/Nvdi9V95Jfu6+W4NAJrHDeypB58FSLyzI3XfO/4= github.com/jenkins-x/draft-repo v0.0.0-20180417100212-2f66cc518135/go.mod h1:K/L25ViEpDx196rOZyjn433tAM5zr2F/IouK+3g+DkE= -github.com/jenkins-x/go-scm v1.5.141 h1:sd0A41HYU6i9Kfl5/jH3ldgq4VkSiwuW5+KwvRxTONo= -github.com/jenkins-x/go-scm v1.5.141/go.mod h1:PCT338UhP/pQ0IeEeMEf/hoLTYKcH7qjGEKd7jPkeYg= github.com/jenkins-x/golang-jenkins v0.0.0-20180919102630-65b83ad42314 h1:kyBMx/ucSV92S+umX/V6DDaPNynlFFOM9MGJWApltoU= github.com/jenkins-x/golang-jenkins v0.0.0-20180919102630-65b83ad42314/go.mod h1:C6j5HgwlHGjRU27W4XCs6jXksqYFo8OdBu+p44jqQeM= github.com/jenkins-x/jx-kube-client v0.0.3 h1:S87cyPcoUVtTPNuMrIeFZbYkjDWTkvdIWqiGUTfOW3c= @@ -503,6 +501,8 @@ github.com/json-iterator/go v1.1.5/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCV github.com/json-iterator/go v1.1.9 h1:9yzud/Ht36ygwatGx56VwCZtlI/2AD15T1X2sjSuGns= github.com/json-iterator/go v1.1.9/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU= +github.com/jstrachan/go-scm v1.5.1-0.20200624082102-98a34cc79bbc h1:rl1rfrPl+sRZH5hTCvVQ1MJPHODTovMaEF+MafbamXw= +github.com/jstrachan/go-scm v1.5.1-0.20200624082102-98a34cc79bbc/go.mod h1:PCT338UhP/pQ0IeEeMEf/hoLTYKcH7qjGEKd7jPkeYg= github.com/jtnord/logrus v1.4.2-0.20190423161236-606ffcaf8f5d h1:95Dc4I4Pw81p6Gc1IUqOtLPPf2qnhrcC3Lsv3tLdb1I= github.com/jtnord/logrus v1.4.2-0.20190423161236-606ffcaf8f5d/go.mod h1:ni0Sbl8bgC9z8RoU9G6nDWqqs/fq4eDPysMBDgk/93Q= github.com/jtolds/gls v4.2.1+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU= diff --git a/pkg/promote/promote.go b/pkg/promote/promote.go index 37cd4fa..503c81f 100644 --- a/pkg/promote/promote.go +++ b/pkg/promote/promote.go @@ -174,8 +174,7 @@ func (o *Options) AddOptions(cmd *cobra.Command) { cmd.Flags().BoolVarP(&o.NoHelmUpdate, "no-helm-update", "", false, "Allows the 'helm repo update' command if you are sure your local helm cache is up to date with the version you wish to promote") cmd.Flags().BoolVarP(&o.NoMergePullRequest, "no-merge", "", false, "Disables automatic merge of promote Pull Requests") - // TODO bring back polling? - cmd.Flags().BoolVarP(&o.NoPoll, "no-poll", "", true, "Disables polling for Pull Request or Pipeline status") + cmd.Flags().BoolVarP(&o.NoPoll, "no-poll", "", false, "Disables polling for Pull Request or Pipeline status") cmd.Flags().BoolVarP(&o.NoWaitAfterMerge, "no-wait", "", false, "Disables waiting for completing promotion after the Pull request is merged") cmd.Flags().BoolVarP(&o.IgnoreLocalFiles, "ignore-local-file", "", false, "Ignores the local file system when deducing the Git repository") } @@ -739,8 +738,6 @@ func (o *Options) waitForGitOpsPullRequest(ns string, env *v1.Environment, relea log.Logger().Infof("Pull Request %s is merged but waiting for Merge SHA", util.ColorInfo(pr.Link)) } } else { - // TODO is this the same as MergeSha? - //mergeSha := pr.MergeCommitSHA mergeSha := pr.MergeSha if !logHasMergeSha { logHasMergeSha = true @@ -771,8 +768,6 @@ func (o *Options) waitForGitOpsPullRequest(ns string, env *v1.Environment, relea } statuses, _, err := scmClient.Repositories.ListStatus(ctx, fullName, mergeSha, scm.ListOptions{}) - // TODO - //statuses, err := gitProvider.ListCommitStatus(pr.Owner, pr.Repo, mergeSha) if err != nil { if !logMergeStatusError { logMergeStatusError = true @@ -792,9 +787,10 @@ func (o *Options) waitForGitOpsPullRequest(ns string, env *v1.Environment, relea return fmt.Errorf("Status: %s URL: %s description: %s\n", status.State, status.Target, status.Desc) } - // TODO is this equivalent to status.URL? - //url := status.URL - url := status.Label + url := status.Link + if url == "" { + url = status.Target + } state := status.State if urlStatusMap[url] == scm.StateUnknown || urlStatusMap[url] != scm.StateSuccess { if urlStatusMap[url] != state { @@ -959,10 +955,7 @@ func (o *Options) PullRequestLastCommitStatus(pr *scm.PullRequest) (*scm.Status, } func (o *Options) pullRequestLastCommitSha(pr *scm.PullRequest) string { - // TODO - add last commit sha.... - //prLastCommitSha := prLastCommitSha - prLastCommitSha := pr.MergeSha - return prLastCommitSha + return pr.Head.Sha } func (o *Options) findLatestVersion(app string) (string, error) {