Skip to content
This repository was archived by the owner on Mar 24, 2023. It is now read-only.

Commit 11c8b99

Browse files
committed
improve handling of docker url dests and add UrlPathEscape template function
1 parent 6f1955f commit 11c8b99

File tree

5 files changed

+14
-2
lines changed

5 files changed

+14
-2
lines changed

Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ mockgen: _mockgen fmt
239239
deps:
240240
dep ensure -v
241241

242-
242+
.state/fmt: GO111MODULE=off
243243
.state/fmt: $(SRC)
244244
goimports -w pkg
245245
goimports -w cmd

go.mod

+1-1
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ require (
117117
golang.org/x/oauth2 v0.0.0-20181120190819-8f65e3013eba
118118
golang.org/x/sys v0.0.0-20190826190057-c7b8b68b1456 // indirect
119119
golang.org/x/text v0.3.2 // indirect
120-
golang.org/x/tools v0.0.0-20190827205025-b29f5f60c37a // indirect
120+
golang.org/x/tools v0.0.0-20190828211409-a0cf054a4555 // indirect
121121
google.golang.org/appengine v1.3.0 // indirect
122122
google.golang.org/grpc v1.21.0
123123
gopkg.in/go-playground/assert.v1 v1.2.1 // indirect

go.sum

+2
Original file line numberDiff line numberDiff line change
@@ -727,6 +727,8 @@ golang.org/x/tools v0.0.0-20190827152308-062dbaebb618 h1:WtF22n/HcPWMhvZm4KWiQ0F
727727
golang.org/x/tools v0.0.0-20190827152308-062dbaebb618/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
728728
golang.org/x/tools v0.0.0-20190827205025-b29f5f60c37a h1:0JEq5ZQ3TgsRlFmz4BcD+E6U6cOk4pOImCQSyIG59ZM=
729729
golang.org/x/tools v0.0.0-20190827205025-b29f5f60c37a/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
730+
golang.org/x/tools v0.0.0-20190828211409-a0cf054a4555 h1:WHKnEyRwPYpu/vTaU8HRdvnIceBN9IW7x2EIycXa6YQ=
731+
golang.org/x/tools v0.0.0-20190828211409-a0cf054a4555/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
730732
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
731733
google.golang.org/api v0.0.0-20171005000305-7a7376eff6a5/go.mod h1:4mhQ8q/RsB7i+udVvVy5NUi08OU8ZlA0gRVgrF7VFY0=
732734
google.golang.org/appengine v0.0.0-20150527042145-b667a5000b08/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM=

pkg/lifecycle/render/planner/build.go

+9
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package planner
22

33
import (
44
"fmt"
5+
"net/url"
56

67
"github.com/go-kit/kit/log"
78
"github.com/go-kit/kit/log/level"
@@ -372,6 +373,14 @@ func planToDests(plan Plan, builder *templates.Builder) ([]string, error) {
372373
if err != nil {
373374
return nil, errors.Wrapf(err, "building dest %q", step.Dest)
374375
}
376+
377+
// special case for docker URL dests - don't attempt to remove url paths
378+
destinationURL, err := url.Parse(dest)
379+
// if there was an error parsing the dest as a url, or the scheme was not 'docker', add to the dests list as normal
380+
if err == nil && destinationURL.Scheme == "docker" {
381+
continue
382+
}
383+
375384
dests = append(dests, dest)
376385
}
377386

pkg/templates/static_context.go

+1
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ func (ctx StaticCtx) FuncMap() template.FuncMap {
6262
sprigMap["TrimSpace"] = strings.TrimSpace
6363
sprigMap["Trim"] = ctx.trim
6464
sprigMap["UrlEncode"] = url.QueryEscape
65+
sprigMap["UrlPathEscape"] = url.PathEscape
6566
sprigMap["Base64Encode"] = ctx.base64Encode
6667
sprigMap["Base64Decode"] = ctx.base64Decode
6768
sprigMap["Split"] = strings.Split

0 commit comments

Comments
 (0)