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

improve handling of docker url dests and add UrlPathEscape template function #1059

Merged
merged 1 commit into from
Aug 29, 2019
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
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ mockgen: _mockgen fmt
deps:
dep ensure -v


.state/fmt: GO111MODULE=off
.state/fmt: $(SRC)
goimports -w pkg
goimports -w cmd
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ require (
golang.org/x/oauth2 v0.0.0-20181120190819-8f65e3013eba
golang.org/x/sys v0.0.0-20190826190057-c7b8b68b1456 // indirect
golang.org/x/text v0.3.2 // indirect
golang.org/x/tools v0.0.0-20190827205025-b29f5f60c37a // indirect
golang.org/x/tools v0.0.0-20190828211409-a0cf054a4555 // indirect
google.golang.org/appengine v1.3.0 // indirect
google.golang.org/grpc v1.21.0
gopkg.in/go-playground/assert.v1 v1.2.1 // indirect
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -727,6 +727,8 @@ golang.org/x/tools v0.0.0-20190827152308-062dbaebb618 h1:WtF22n/HcPWMhvZm4KWiQ0F
golang.org/x/tools v0.0.0-20190827152308-062dbaebb618/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.0.0-20190827205025-b29f5f60c37a h1:0JEq5ZQ3TgsRlFmz4BcD+E6U6cOk4pOImCQSyIG59ZM=
golang.org/x/tools v0.0.0-20190827205025-b29f5f60c37a/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.0.0-20190828211409-a0cf054a4555 h1:WHKnEyRwPYpu/vTaU8HRdvnIceBN9IW7x2EIycXa6YQ=
golang.org/x/tools v0.0.0-20190828211409-a0cf054a4555/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
google.golang.org/api v0.0.0-20171005000305-7a7376eff6a5/go.mod h1:4mhQ8q/RsB7i+udVvVy5NUi08OU8ZlA0gRVgrF7VFY0=
google.golang.org/appengine v0.0.0-20150527042145-b667a5000b08/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM=
Expand Down
9 changes: 9 additions & 0 deletions pkg/lifecycle/render/planner/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package planner

import (
"fmt"
"net/url"

"github.com/go-kit/kit/log"
"github.com/go-kit/kit/log/level"
Expand Down Expand Up @@ -372,6 +373,14 @@ func planToDests(plan Plan, builder *templates.Builder) ([]string, error) {
if err != nil {
return nil, errors.Wrapf(err, "building dest %q", step.Dest)
}

// special case for docker URL dests - don't attempt to remove url paths
destinationURL, err := url.Parse(dest)
// if there was an error parsing the dest as a url, or the scheme was not 'docker', add to the dests list as normal
if err == nil && destinationURL.Scheme == "docker" {
continue
}

dests = append(dests, dest)
}

Expand Down
1 change: 1 addition & 0 deletions pkg/templates/static_context.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ func (ctx StaticCtx) FuncMap() template.FuncMap {
sprigMap["TrimSpace"] = strings.TrimSpace
sprigMap["Trim"] = ctx.trim
sprigMap["UrlEncode"] = url.QueryEscape
sprigMap["UrlPathEscape"] = url.PathEscape
sprigMap["Base64Encode"] = ctx.base64Encode
sprigMap["Base64Decode"] = ctx.base64Decode
sprigMap["Split"] = strings.Split
Expand Down