Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix kaniko default behaviour #1139

Merged
merged 2 commits into from
Oct 12, 2018
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pkg/skaffold/build/kaniko/sources/sources.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ type BuildContextSource interface {

// Retrieve returns the correct build context based on the config
func Retrieve(cfg *latest.KanikoBuild) (BuildContextSource, error) {
if cfg.BuildContext.LocalDir != nil {
if cfg.BuildContext == nil || cfg.BuildContext.LocalDir != nil {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Setting default config should be done in

if err := c.withKanikoConfig(
so that BuildContext is never nil

return &LocalDir{}, nil
}
return &GCSBucket{}, nil
Expand Down
12 changes: 6 additions & 6 deletions pkg/skaffold/schema/latest/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,12 +115,12 @@ type KanikoBuildContext struct {
// KanikoBuild contains the fields needed to do a on-cluster build using
// the kaniko image
type KanikoBuild struct {
BuildContext KanikoBuildContext `yaml:"buildContext,omitempty"`
PullSecret string `yaml:"pullSecret,omitempty"`
PullSecretName string `yaml:"pullSecretName,omitempty"`
Namespace string `yaml:"namespace,omitempty"`
Timeout string `yaml:"timeout,omitempty"`
Image string `yaml:"image,omitempty"`
BuildContext *KanikoBuildContext `yaml:"buildContext,omitempty"`
PullSecret string `yaml:"pullSecret,omitempty"`
PullSecretName string `yaml:"pullSecretName,omitempty"`
Namespace string `yaml:"namespace,omitempty"`
Timeout string `yaml:"timeout,omitempty"`
Image string `yaml:"image,omitempty"`
}

// TestCase is a struct containing all the specified test
Expand Down
2 changes: 1 addition & 1 deletion pkg/skaffold/schema/versions_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ func withGoogleCloudBuild(id string, ops ...func(*latest.BuildConfig)) func(*lat
func withKanikoBuild(bucket, secretName, namespace, secret string, timeout string, ops ...func(*latest.BuildConfig)) func(*latest.SkaffoldPipeline) {
return func(cfg *latest.SkaffoldPipeline) {
b := latest.BuildConfig{BuildType: latest.BuildType{KanikoBuild: &latest.KanikoBuild{
BuildContext: latest.KanikoBuildContext{
BuildContext: &latest.KanikoBuildContext{
GCSBucket: bucket,
},
PullSecretName: secretName,
Expand Down