Skip to content

Commit

Permalink
feat: add availableSecrets field to skaffold.yaml which is passed to gcb
Browse files Browse the repository at this point in the history
  • Loading branch information
aaron-prindle committed Jan 22, 2023
1 parent 285c697 commit 0934636
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 4 deletions.
1 change: 1 addition & 0 deletions pkg/skaffold/build/gcb/spec.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ func (b *Builder) buildSpec(ctx context.Context, artifact *latest.Artifact, tag
buildSpec.Options.LogStreamingOption = b.LogStreamingOption
buildSpec.Timeout = b.Timeout
buildSpec.ServiceAccount = b.ServiceAccount
buildSpec.AvailableSecrets = b.AvailableSecrets

return buildSpec, nil
}
Expand Down
12 changes: 8 additions & 4 deletions pkg/skaffold/inspect/buildEnv/add_cluster_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,8 @@ kind: ""
metadata:
name: cfg2
build:
googleCloudBuild: {}
googleCloudBuild:
availablesecrets: null
profiles:
- name: p1
build:
Expand Down Expand Up @@ -196,7 +197,8 @@ kind: ""
metadata:
name: cfg2
build:
googleCloudBuild: {}
googleCloudBuild:
availablesecrets: null
profiles:
- name: p1
build:
Expand Down Expand Up @@ -258,7 +260,8 @@ kind: ""
metadata:
name: cfg2
build:
googleCloudBuild: {}
googleCloudBuild:
availablesecrets: null
profiles:
- name: p1
build:
Expand All @@ -285,7 +288,8 @@ kind: ""
metadata:
name: cfg2
build:
googleCloudBuild: {}
googleCloudBuild:
availablesecrets: null
profiles:
- name: p1
build:
Expand Down
13 changes: 13 additions & 0 deletions pkg/skaffold/inspect/buildEnv/modify_gcb_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,13 @@ requires:
build:
googleCloudBuild:
projectId: project2
availablesecrets: null
profiles:
- name: p1
build:
googleCloudBuild:
projectId: project1
availablesecrets: null
- name: p2
build:
cluster: {}
Expand All @@ -81,11 +83,13 @@ requires:
build:
googleCloudBuild:
projectId: project1
availablesecrets: null
profiles:
- name: p1
build:
googleCloudBuild:
projectId: project2
availablesecrets: null
- name: p2
build:
cluster: {}
Expand All @@ -100,6 +104,7 @@ profiles:
build:
googleCloudBuild:
projectId: project2
availablesecrets: null
`,
},
},
Expand Down Expand Up @@ -131,11 +136,13 @@ requires:
build:
googleCloudBuild:
projectId: project2
availablesecrets: null
profiles:
- name: p1
build:
googleCloudBuild:
projectId: project1
availablesecrets: null
- name: p2
build:
cluster: {}
Expand All @@ -157,11 +164,13 @@ requires:
build:
googleCloudBuild:
projectId: project1
availablesecrets: null
profiles:
- name: p1
build:
googleCloudBuild:
projectId: project2
availablesecrets: null
- name: p2
build:
cluster: {}
Expand All @@ -176,6 +185,7 @@ profiles:
build:
googleCloudBuild:
projectId: project2
availablesecrets: null
`,
},
},
Expand All @@ -201,11 +211,13 @@ requires:
build:
googleCloudBuild:
projectId: project1
availablesecrets: null
profiles:
- name: p1
build:
googleCloudBuild:
projectId: project1
availablesecrets: null
- name: p2
build:
cluster: {}
Expand All @@ -220,6 +232,7 @@ profiles:
build:
googleCloudBuild:
projectId: project1
availablesecrets: null
`,
},
},
Expand Down
5 changes: 5 additions & 0 deletions pkg/skaffold/schema/latest/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ package latest
import (
"encoding/json"

"google.golang.org/api/cloudbuild/v1"
v1 "k8s.io/api/core/v1"
"sigs.k8s.io/kustomize/kyaml/yaml"

Expand Down Expand Up @@ -411,6 +412,10 @@ type GoogleCloudBuild struct {
// If unspecified, it defaults to the Cloud Build service account generated when
// the Cloud Build API is enabled.
ServiceAccount string `yaml:"serviceAccount,omitempty"`

// AvailableSecrets maps to Google Cloud Build availableSecrets value which represents secrets and
// secret environment variables this is passed through to google cloud build.
AvailableSecrets *cloudbuild.Secrets `json:"availableSecrets,omitempty"`
}

// PlatformEmulatorInstallStep specifies a pre-build step to install the required tooling for QEMU emulation on the GoogleCloudBuild containers. This enables performing cross-platform builds on GoogleCloudBuild.
Expand Down

0 comments on commit 0934636

Please sign in to comment.