Skip to content

Commit 0eeaeb8

Browse files
authored
Merge pull request #35508 from dims/add-parameters-to-suppress-logs-and-specify-polling-interval
[image builder cli] Add parameters to suppress logs and specify polling interval
2 parents 1057841 + d53674c commit 0eeaeb8

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

images/builder/main.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ import (
2525
"path"
2626
"path/filepath"
2727
"regexp"
28+
"strconv"
2829
"strings"
2930
"sync"
3031
"time"
@@ -202,6 +203,13 @@ func runSingleJob(o options, jobName, uploaded, version string, subs map[string]
202203
}
203204
}
204205

206+
if o.pollingInterval > 0 {
207+
args = append(args, "--polling-interval", strconv.Itoa(o.pollingInterval))
208+
}
209+
if o.suppressLogs {
210+
args = append(args, "--suppress-logs")
211+
}
212+
205213
cmd := exec.Command("gcloud", args...)
206214

207215
var logFilePath string
@@ -338,6 +346,8 @@ type options struct {
338346
variant string
339347
versionTagFilter string
340348
envPassthrough string
349+
pollingInterval int
350+
suppressLogs bool
341351

342352
// withGitDirectory will include the .git directory when uploading the source to GCB
343353
withGitDirectory bool
@@ -366,6 +376,8 @@ func parseFlags() options {
366376
flag.StringVar(&o.versionTagFilter, "version-tag-filter", "", "If specified, only tags that match the specified glob pattern are used in version detection.")
367377
flag.StringVar(&o.envPassthrough, "env-passthrough", "", "Comma-separated list of specified environment variables to be passed to GCB as substitutions with an _ prefix. If the variable doesn't exist, the substitution will exist but be empty.")
368378
flag.BoolVar(&o.withGitDirectory, "with-git-dir", o.withGitDirectory, "If true, upload the .git directory to GCB, so we can e.g. get the git log and tag.")
379+
flag.IntVar(&o.pollingInterval, "polling-interval", 10, "Amount of time in seconds to wait between polling build status. (default=10)")
380+
flag.BoolVar(&o.suppressLogs, "suppress-logs", o.suppressLogs, "If true, build logs not streamed to stdout.")
369381

370382
flag.Parse()
371383

0 commit comments

Comments
 (0)