Skip to content

Commit 68bdeac

Browse files
author
Matthew Fisher
committed
Revert "fix(builder): properly escape backticks in envvars"
This reverts commit 042ef60.
1 parent 3757386 commit 68bdeac

4 files changed

Lines changed: 13 additions & 7 deletions

File tree

builder/bin/get-app-values.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,7 @@ func main() {
2626
os.Exit(1)
2727
}
2828

29-
var retVal string
3029
for _, value := range values {
31-
retVal = fmt.Sprintf("%s%s", retVal, value)
30+
fmt.Println(value)
3231
}
33-
fmt.Println(retVal)
3432
}

builder/image/templates/builder

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,14 @@ usage() {
2727
echo "Usage: $0 <user> <repo> <sha>"
2828
}
2929

30+
parse-string(){
31+
# helper to avoid the single quote escape
32+
# occurred in command substitution
33+
local args=() idx=0 IFS=' ' c
34+
for c; do printf -v args[idx++] '%s ' "$c"; done
35+
printf "%s\n" "${args[*]}"
36+
}
37+
3038
if [ $# -ne $ARGS ]; then
3139
usage
3240
exit 1
@@ -105,7 +113,7 @@ if [ ! -f Dockerfile ]; then
105113
BUILD_OPTS+=' deis/slugbuilder'
106114

107115
# build the application and attach to the process
108-
JOB=$(${BUILD_OPTS[@]})
116+
JOB=$(eval '$(parse-string "${BUILD_OPTS[@]}")' )
109117
docker attach $JOB
110118

111119
# copy out the compiled slug

builder/utils.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ func ParseControllerConfig(bytes []byte) ([]string, error) {
109109

110110
retVal := []string{}
111111
for k, v := range controllerConfig.Values {
112-
retVal = append(retVal, fmt.Sprintf(" -e %s='%v'", k, v))
112+
retVal = append(retVal, fmt.Sprintf(" -e %s=\"%v\"", k, v))
113113
}
114114
return retVal, nil
115115
}

builder/utils_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -163,8 +163,8 @@ func TestParseControllerConfigGood(t *testing.T) {
163163
t.Errorf("expected 2, got %d", len(config))
164164
}
165165

166-
if !stringInSlice(config, " -e CAR='star'") {
167-
t.Error("expected ' -e CAR='star'' in slice")
166+
if !stringInSlice(config, " -e CAR=\"star\"") {
167+
t.Error("expected ' -e CAR=\"star\"' in slice")
168168
}
169169
}
170170

0 commit comments

Comments
 (0)