mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2024-11-26 20:01:02 +00:00
fixes #639
This commit is contained in:
parent
f3eb93ca18
commit
f21fd563e8
3 changed files with 3 additions and 3 deletions
|
@ -43,7 +43,7 @@ func (b *Buildfile) WriteComment(comment string) {
|
||||||
// are not echoed back to the console, and are
|
// are not echoed back to the console, and are
|
||||||
// kept private by default.
|
// kept private by default.
|
||||||
func (b *Buildfile) WriteEnv(key, value string) {
|
func (b *Buildfile) WriteEnv(key, value string) {
|
||||||
b.WriteString(fmt.Sprintf("export %s=%s\n", key, value))
|
b.WriteString(fmt.Sprintf("export %s=%q\n", key, value))
|
||||||
}
|
}
|
||||||
|
|
||||||
// WriteHost adds an entry to the /etc/hosts file.
|
// WriteHost adds an entry to the /etc/hosts file.
|
||||||
|
|
|
@ -35,7 +35,7 @@ func TestWrite(t *testing.T) {
|
||||||
|
|
||||||
f = &Buildfile{}
|
f = &Buildfile{}
|
||||||
f.WriteEnv("FOO", "BAR")
|
f.WriteEnv("FOO", "BAR")
|
||||||
got, want = f.String(), "export FOO=BAR\n"
|
got, want = f.String(), "export FOO=\"BAR\"\n"
|
||||||
if got != want {
|
if got != want {
|
||||||
t.Errorf("Exepected WriteEnv returned %s, got %s", want, got)
|
t.Errorf("Exepected WriteEnv returned %s, got %s", want, got)
|
||||||
}
|
}
|
||||||
|
|
|
@ -103,7 +103,7 @@ func (b *Build) Write(f *buildfile.Buildfile, r *repo.Repo) {
|
||||||
func (b *Build) WriteBuild(f *buildfile.Buildfile) {
|
func (b *Build) WriteBuild(f *buildfile.Buildfile) {
|
||||||
// append environment variables
|
// append environment variables
|
||||||
for _, env := range b.Env {
|
for _, env := range b.Env {
|
||||||
parts := strings.Split(env, "=")
|
parts := strings.SplitN(env, "=", 2)
|
||||||
if len(parts) != 2 {
|
if len(parts) != 2 {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue