Skip to content

Commit 1797539

Browse files
committed
Support Google Cloud Build logging options
Fixes #2637 Signed-off-by: David Gageot <[email protected]>
1 parent b8fb237 commit 1797539

File tree

3 files changed

+30
-0
lines changed

3 files changed

+30
-0
lines changed

docs/content/en/schemas/v2beta3.json

+12
Original file line numberDiff line numberDiff line change
@@ -978,6 +978,16 @@
978978
"x-intellij-html-description": "image that runs a Kaniko build. See <a href=\"https://cloud.google.com/cloud-build/docs/cloud-builders\">Cloud Builders</a>.",
979979
"default": "gcr.io/kaniko-project/executor"
980980
},
981+
"logStreamingOption": {
982+
"type": "string",
983+
"description": "specifies the behavior when writing build logs to Google Cloud Storage. Valid options are: `STREAM_DEFAULT`: Service may automatically determine build log streaming behavior. `STREAM_ON`: Build logs should be streamed to Google Cloud Storage. `STREAM_OFF`: Build logs should not be streamed to Google Cloud Storage; they will be written when the build is completed. See [Cloud Build Reference](https://cloud.google.com/cloud-build/docs/api/reference/rest/v1/projects.builds#logstreamingoption).",
984+
"x-intellij-html-description": "specifies the behavior when writing build logs to Google Cloud Storage. Valid options are: <code>STREAM_DEFAULT</code>: Service may automatically determine build log streaming behavior. <code>STREAM_ON</code>: Build logs should be streamed to Google Cloud Storage. <code>STREAM_OFF</code>: Build logs should not be streamed to Google Cloud Storage; they will be written when the build is completed. See <a href=\"https://cloud.google.com/cloud-build/docs/api/reference/rest/v1/projects.builds#logstreamingoption\">Cloud Build Reference</a>."
985+
},
986+
"logging": {
987+
"type": "string",
988+
"description": "specifies the logging mode. Valid modes are: `LOGGING_UNSPECIFIED`: The service determines the logging mode. `LEGACY`: Stackdriver logging and Cloud Storage logging are enabled (default). `GCS_ONLY`: Only Cloud Storage logging is enabled. See [Cloud Build Reference](https://cloud.google.com/cloud-build/docs/api/reference/rest/v1/projects.builds#loggingmode).",
989+
"x-intellij-html-description": "specifies the logging mode. Valid modes are: <code>LOGGING_UNSPECIFIED</code>: The service determines the logging mode. <code>LEGACY</code>: Stackdriver logging and Cloud Storage logging are enabled (default). <code>GCS_ONLY</code>: Only Cloud Storage logging is enabled. See <a href=\"https://cloud.google.com/cloud-build/docs/api/reference/rest/v1/projects.builds#loggingmode\">Cloud Build Reference</a>."
990+
},
981991
"machineType": {
982992
"type": "string",
983993
"description": "type of the VM that runs the build. See [Cloud Build Reference](https://cloud.google.com/cloud-build/docs/api/reference/rest/v1/projects.builds#buildoptions).",
@@ -1011,6 +1021,8 @@
10111021
"diskSizeGb",
10121022
"machineType",
10131023
"timeout",
1024+
"logging",
1025+
"logStreamingOption",
10141026
"dockerImage",
10151027
"kanikoImage",
10161028
"mavenImage",

pkg/skaffold/build/gcb/spec.go

+2
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,8 @@ func (b *Builder) buildSpec(artifact *latest.Artifact, tag, bucket, object strin
4545
}
4646
buildSpec.Options.DiskSizeGb = b.DiskSizeGb
4747
buildSpec.Options.MachineType = b.MachineType
48+
buildSpec.Options.Logging = b.Logging
49+
buildSpec.Options.LogStreamingOption = b.LogStreamingOption
4850
buildSpec.Timeout = b.Timeout
4951

5052
return buildSpec, nil

pkg/skaffold/schema/latest/config.go

+16
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,22 @@ type GoogleCloudBuild struct {
226226
// See [Cloud Build Reference](https://cloud.google.com/cloud-build/docs/api/reference/rest/v1/projects.builds#resource-build).
227227
Timeout string `yaml:"timeout,omitempty"`
228228

229+
// Logging specifies the logging mode.
230+
// Valid modes are:
231+
// `LOGGING_UNSPECIFIED`: The service determines the logging mode.
232+
// `LEGACY`: Stackdriver logging and Cloud Storage logging are enabled (default).
233+
// `GCS_ONLY`: Only Cloud Storage logging is enabled.
234+
// See [Cloud Build Reference](https://cloud.google.com/cloud-build/docs/api/reference/rest/v1/projects.builds#loggingmode).
235+
Logging string `yaml:"logging,omitempty"`
236+
237+
// LogStreamingOption specifies the behavior when writing build logs to Google Cloud Storage.
238+
// Valid options are:
239+
// `STREAM_DEFAULT`: Service may automatically determine build log streaming behavior.
240+
// `STREAM_ON`: Build logs should be streamed to Google Cloud Storage.
241+
// `STREAM_OFF`: Build logs should not be streamed to Google Cloud Storage; they will be written when the build is completed.
242+
// See [Cloud Build Reference](https://cloud.google.com/cloud-build/docs/api/reference/rest/v1/projects.builds#logstreamingoption).
243+
LogStreamingOption string `yaml:"logStreamingOption,omitempty"`
244+
229245
// DockerImage is the image that runs a Docker build.
230246
// See [Cloud Builders](https://cloud.google.com/cloud-build/docs/cloud-builders).
231247
// Defaults to `gcr.io/cloud-builders/docker`.

0 commit comments

Comments
 (0)