Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(139)

Side by Side Diff: client/cmd/kitchen/cook.go

Issue 1868553006: kitchen: emit valid JSON for SET_BUILD_PROPERTY annotations (Closed) Base URL: https://github.com/luci/luci-go.git@master
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 package main 5 package main
6 6
7 import ( 7 import (
8 "encoding/json" 8 "encoding/json"
9 "fmt" 9 "fmt"
10 "io/ioutil" 10 "io/ioutil"
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 annotate("SEED_STEP", BootstrapStepName) 175 annotate("SEED_STEP", BootstrapStepName)
176 annotate("STEP_CURSOR", BootstrapStepName) 176 annotate("STEP_CURSOR", BootstrapStepName)
177 annotate("STEP_STARTED") 177 annotate("STEP_STARTED")
178 props, err := parseProperties(c.Properties, c.PropertiesFile) 178 props, err := parseProperties(c.Properties, c.PropertiesFile)
179 if err != nil { 179 if err != nil {
180 fmt.Fprintln(os.Stderr, err) 180 fmt.Fprintln(os.Stderr, err)
181 return 1 181 return 1
182 } 182 }
183 for k, v := range props { 183 for k, v := range props {
184 // Order is not stable, but that is okay. 184 // Order is not stable, but that is okay.
185 » » annotate("SET_BUILD_PROPERTY", k, fmt.Sprintf("%v", v)) 185 » » jv, err := json.Marshal(v)
186 » » if err != nil {
187 » » » fmt.Fprintln(os.Stderr, err)
188 » » » return 1
189 » » }
190 » » annotate("SET_BUILD_PROPERTY", k, string(jv))
186 } 191 }
187 192
188 recipeExitCode, err := c.run(app.Context) 193 recipeExitCode, err := c.run(app.Context)
189 annotate("STEP_CURSOR", BootstrapStepName) 194 annotate("STEP_CURSOR", BootstrapStepName)
190 if err != nil { 195 if err != nil {
191 if err != context.Canceled { 196 if err != context.Canceled {
192 fmt.Fprintln(os.Stderr, err) 197 fmt.Fprintln(os.Stderr, err)
193 } 198 }
194 return -1 199 return -1
195 } 200 }
(...skipping 20 matching lines...) Expand all
216 err = fmt.Errorf("could not parse JSON from file %s\n%s\ n%s", 221 err = fmt.Errorf("could not parse JSON from file %s\n%s\ n%s",
217 propertiesFile, b, err) 222 propertiesFile, b, err)
218 } 223 }
219 } 224 }
220 return 225 return
221 } 226 }
222 227
223 func annotate(args ...string) { 228 func annotate(args ...string) {
224 fmt.Printf("@@@%s@@@\n", strings.Join(args, "@")) 229 fmt.Printf("@@@%s@@@\n", strings.Join(args, "@"))
225 } 230 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698