Skip to content

Commit 2fdca7f

Browse files
Merge remote-tracking branch 'origin/master' into CR-4490-svc-cs
# Conflicts: # VERSION
2 parents c6d3907 + 16cf8af commit 2fdca7f

File tree

6 files changed

+22
-12
lines changed

6 files changed

+22
-12
lines changed

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.25.3
1+
0.26.0

go.mod

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ module github.com/codefresh-io/go-sdk
33
require (
44
github.com/BurntSushi/toml v0.3.1 // indirect
55
github.com/dustin/go-humanize v1.0.0
6+
github.com/google/go-querystring v1.1.0
67
github.com/inconshreveable/mousetrap v1.0.0 // indirect
78
github.com/mattn/go-runewidth v0.0.4 // indirect
89
github.com/mitchellh/go-homedir v1.0.0

go.sum

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ github.com/dustin/go-humanize v1.0.0 h1:VSnTsYCnlFHaM2/igO1h6X3HA71jcobQuxemgkq4
1010
github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk=
1111
github.com/fsnotify/fsnotify v1.4.7 h1:IXs+QLmnXW2CcXuY+8Mzv/fWEsPGWxqefPtCP5CnV9I=
1212
github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
13+
github.com/google/go-cmp v0.5.2 h1:X2ev0eStA3AbceY54o37/0PQ/UWqKEiiO2dKL5OPaFM=
14+
github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
15+
github.com/google/go-querystring v1.1.0 h1:AnCroh3fv4ZBgVIf1Iwtovgjaw/GiKJo8M8yD/fhyJ8=
16+
github.com/google/go-querystring v1.1.0/go.mod h1:Kcdr2DB4koayq7X8pmAG4sNG59So17icRSOU623lUBU=
1317
github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4=
1418
github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ=
1519
github.com/inconshreveable/mousetrap v1.0.0 h1:Z8tu5sraLXCXIcARxBp/8cbvlwVa7Z1NHg9XEKhtSvM=
@@ -51,6 +55,8 @@ golang.org/x/sys v0.0.0-20181228144115-9a3f9b0469bb h1:pf3XwC90UUdNPYWZdFjhGBE7D
5155
golang.org/x/sys v0.0.0-20181228144115-9a3f9b0469bb/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
5256
golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg=
5357
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
58+
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4=
59+
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
5460
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
5561
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
5662
gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw=

pkg/codefresh/codefresh.go

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ import (
44
"bytes"
55
"encoding/json"
66
"fmt"
7+
"github.com/google/go-querystring/query"
78
"io/ioutil"
89
"net/http"
9-
"strings"
1010
)
1111

1212
type (
@@ -92,12 +92,9 @@ func (c *codefresh) requestAPI(opt *requestOptions) (*http.Response, error) {
9292
return response, nil
9393
}
9494

95-
func toQS(qs map[string]string) string {
96-
var arr = []string{}
97-
for k, v := range qs {
98-
arr = append(arr, fmt.Sprintf("%s=%s", k, v))
99-
}
100-
return "?" + strings.Join(arr, "&")
95+
func toQS(qs interface{}) string {
96+
v, _ := query.Values(qs)
97+
return "?" + v.Encode()
10198
}
10299

103100
func (c *codefresh) decodeResponseInto(resp *http.Response, target interface{}) error {

pkg/codefresh/contexts.go

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,11 @@ type (
3232
} `json:"data"`
3333
} `json:"spec"`
3434
}
35+
36+
GitContextsQs struct {
37+
Type []string `url:"type"`
38+
Decrypt string `url:"decrypt"`
39+
}
3540
)
3641

3742
func newContextAPI(codefresh *codefresh) IContextAPI {
@@ -40,9 +45,10 @@ func newContextAPI(codefresh *codefresh) IContextAPI {
4045

4146
func (c context) GetGitContexts() (error, *[]ContextPayload) {
4247
var result []ContextPayload
43-
var qs = map[string]string{
44-
"type": "git.github",
45-
"decrypt": "true",
48+
49+
qs := GitContextsQs{
50+
Type: []string{"git.github", "git.gitlab", "git.github-app"},
51+
Decrypt: "true",
4652
}
4753

4854
resp, err := c.codefresh.requestAPI(&requestOptions{

pkg/codefresh/types.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,6 @@ type (
2828
path string
2929
method string
3030
body interface{}
31-
qs map[string]string
31+
qs interface{}
3232
}
3333
)

0 commit comments

Comments
 (0)