From bc09f6b320e4e9b12338fd69cc1556f7f4e92595 Mon Sep 17 00:00:00 2001 From: Priya Wadhwa Date: Thu, 25 Apr 2019 15:59:04 -0700 Subject: [PATCH 1/3] Remove upgrade to v1beta10 I accidentally upgraded to v1beta10 in #2016 when v1beta9 had yet to be released. To fix this, I've removed v1beta10 and merged the original v1beta9->v1beta10 upgrade into the current v1beta8->v1beta9 upgrade. --- docs/content/en/schemas/v1beta9.json | 115 +--- pkg/skaffold/schema/latest/config.go | 2 +- pkg/skaffold/schema/v1beta8/upgrade.go | 50 +- pkg/skaffold/schema/v1beta8/upgrade_test.go | 18 +- pkg/skaffold/schema/v1beta9/config.go | 665 -------------------- pkg/skaffold/schema/v1beta9/upgrade.go | 99 --- pkg/skaffold/schema/v1beta9/upgrade_test.go | 127 ---- pkg/skaffold/schema/versions.go | 2 - 8 files changed, 59 insertions(+), 1019 deletions(-) delete mode 100644 pkg/skaffold/schema/v1beta9/config.go delete mode 100644 pkg/skaffold/schema/v1beta9/upgrade.go delete mode 100644 pkg/skaffold/schema/v1beta9/upgrade_test.go diff --git a/docs/content/en/schemas/v1beta9.json b/docs/content/en/schemas/v1beta9.json index 1ceb258182c..9c8c1876c1d 100755 --- a/docs/content/en/schemas/v1beta9.json +++ b/docs/content/en/schemas/v1beta9.json @@ -64,11 +64,6 @@ "gcr.io/k8s-skaffold/example" ] }, - "plugin": { - "$ref": "#/definitions/BuilderPlugin", - "description": "plugin used to build this artifact.", - "x-intellij-html-description": "plugin used to build this artifact." - }, "sync": { "additionalProperties": { "type": "string" @@ -85,8 +80,7 @@ "preferredOrder": [ "image", "context", - "sync", - "plugin" + "sync" ], "additionalProperties": false }, @@ -111,11 +105,6 @@ "gcr.io/k8s-skaffold/example" ] }, - "plugin": { - "$ref": "#/definitions/BuilderPlugin", - "description": "plugin used to build this artifact.", - "x-intellij-html-description": "plugin used to build this artifact." - }, "sync": { "additionalProperties": { "type": "string" @@ -133,7 +122,6 @@ "image", "context", "sync", - "plugin", "docker" ], "additionalProperties": false @@ -159,11 +147,6 @@ "gcr.io/k8s-skaffold/example" ] }, - "plugin": { - "$ref": "#/definitions/BuilderPlugin", - "description": "plugin used to build this artifact.", - "x-intellij-html-description": "plugin used to build this artifact." - }, "sync": { "additionalProperties": { "type": "string" @@ -181,7 +164,6 @@ "image", "context", "sync", - "plugin", "bazel" ], "additionalProperties": false @@ -207,11 +189,6 @@ "description": "*alpha* builds images using the [Jib plugin for Maven](https://github.com/GoogleContainerTools/jib/tree/master/jib-maven-plugin).", "x-intellij-html-description": "alpha builds images using the Jib plugin for Maven." }, - "plugin": { - "$ref": "#/definitions/BuilderPlugin", - "description": "plugin used to build this artifact.", - "x-intellij-html-description": "plugin used to build this artifact." - }, "sync": { "additionalProperties": { "type": "string" @@ -229,7 +206,6 @@ "image", "context", "sync", - "plugin", "jibMaven" ], "additionalProperties": false @@ -255,11 +231,6 @@ "description": "*alpha* builds images using the [Jib plugin for Gradle](https://github.com/GoogleContainerTools/jib/tree/master/jib-gradle-plugin).", "x-intellij-html-description": "alpha builds images using the Jib plugin for Gradle." }, - "plugin": { - "$ref": "#/definitions/BuilderPlugin", - "description": "plugin used to build this artifact.", - "x-intellij-html-description": "plugin used to build this artifact." - }, "sync": { "additionalProperties": { "type": "string" @@ -277,7 +248,6 @@ "image", "context", "sync", - "plugin", "jibGradle" ], "additionalProperties": false @@ -303,11 +273,6 @@ "description": "*alpha* builds images using [kaniko](https://github.com/GoogleContainerTools/kaniko).", "x-intellij-html-description": "alpha builds images using kaniko." }, - "plugin": { - "$ref": "#/definitions/BuilderPlugin", - "description": "plugin used to build this artifact.", - "x-intellij-html-description": "plugin used to build this artifact." - }, "sync": { "additionalProperties": { "type": "string" @@ -325,7 +290,6 @@ "image", "context", "sync", - "plugin", "kaniko" ], "additionalProperties": false @@ -380,11 +344,6 @@ "description": "the images you're going to be building.", "x-intellij-html-description": "the images you're going to be building." }, - "executionEnvironment": { - "$ref": "#/definitions/ExecutionEnvironment", - "description": "environment in which the build should run. Possible values: googleCloudBuild.", - "x-intellij-html-description": "environment in which the build should run. Possible values: googleCloudBuild." - }, "insecureRegistries": { "items": { "type": "string" @@ -403,8 +362,7 @@ "preferredOrder": [ "artifacts", "insecureRegistries", - "tagPolicy", - "executionEnvironment" + "tagPolicy" ], "additionalProperties": false }, @@ -418,11 +376,6 @@ "description": "the images you're going to be building.", "x-intellij-html-description": "the images you're going to be building." }, - "executionEnvironment": { - "$ref": "#/definitions/ExecutionEnvironment", - "description": "environment in which the build should run. Possible values: googleCloudBuild.", - "x-intellij-html-description": "environment in which the build should run. Possible values: googleCloudBuild." - }, "insecureRegistries": { "items": { "type": "string" @@ -447,7 +400,6 @@ "artifacts", "insecureRegistries", "tagPolicy", - "executionEnvironment", "local" ], "additionalProperties": false @@ -462,11 +414,6 @@ "description": "the images you're going to be building.", "x-intellij-html-description": "the images you're going to be building." }, - "executionEnvironment": { - "$ref": "#/definitions/ExecutionEnvironment", - "description": "environment in which the build should run. Possible values: googleCloudBuild.", - "x-intellij-html-description": "environment in which the build should run. Possible values: googleCloudBuild." - }, "googleCloudBuild": { "$ref": "#/definitions/GoogleCloudBuild", "description": "*beta* describes how to do a remote build on [Google Cloud Build](https://cloud.google.com/cloud-build/).", @@ -491,7 +438,6 @@ "artifacts", "insecureRegistries", "tagPolicy", - "executionEnvironment", "googleCloudBuild" ], "additionalProperties": false @@ -511,11 +457,6 @@ "description": "*beta* describes how to do an on-cluster build.", "x-intellij-html-description": "beta describes how to do an on-cluster build." }, - "executionEnvironment": { - "$ref": "#/definitions/ExecutionEnvironment", - "description": "environment in which the build should run. Possible values: googleCloudBuild.", - "x-intellij-html-description": "environment in which the build should run. Possible values: googleCloudBuild." - }, "insecureRegistries": { "items": { "type": "string" @@ -535,7 +476,6 @@ "artifacts", "insecureRegistries", "tagPolicy", - "executionEnvironment", "cluster" ], "additionalProperties": false @@ -544,29 +484,6 @@ "description": "contains all the configuration for the build steps.", "x-intellij-html-description": "contains all the configuration for the build steps." }, - "BuilderPlugin": { - "properties": { - "name": { - "type": "string", - "description": "name of the build plugin.", - "x-intellij-html-description": "name of the build plugin." - }, - "properties": { - "additionalProperties": {}, - "type": "object", - "description": "key-value pairs passed to the plugin.", - "x-intellij-html-description": "key-value pairs passed to the plugin.", - "default": "{}" - } - }, - "preferredOrder": [ - "name", - "properties" - ], - "additionalProperties": false, - "description": "contains all fields necessary for specifying a build plugin.", - "x-intellij-html-description": "contains all fields necessary for specifying a build plugin." - }, "ClusterDetails": { "properties": { "dockerConfig": { @@ -773,34 +690,6 @@ "description": "*beta* tags images with a configurable template string.", "x-intellij-html-description": "beta tags images with a configurable template string." }, - "ExecEnvironment": { - "type": "string", - "description": "name of an execution environment.", - "x-intellij-html-description": "name of an execution environment." - }, - "ExecutionEnvironment": { - "properties": { - "name": { - "$ref": "#/definitions/ExecEnvironment", - "description": "name of the environment.", - "x-intellij-html-description": "name of the environment." - }, - "properties": { - "additionalProperties": {}, - "type": "object", - "description": "key-value pairs passed to the environment.", - "x-intellij-html-description": "key-value pairs passed to the environment.", - "default": "{}" - } - }, - "preferredOrder": [ - "name", - "properties" - ], - "additionalProperties": false, - "description": "environment in which the build should run (ex. local or in-cluster, etc.).", - "x-intellij-html-description": "environment in which the build should run (ex. local or in-cluster, etc.)." - }, "GitTagger": { "properties": { "variant": { diff --git a/pkg/skaffold/schema/latest/config.go b/pkg/skaffold/schema/latest/config.go index 0967e9ac8cf..2a3d4c6570f 100644 --- a/pkg/skaffold/schema/latest/config.go +++ b/pkg/skaffold/schema/latest/config.go @@ -20,7 +20,7 @@ import ( "github.com/GoogleContainerTools/skaffold/pkg/skaffold/schema/util" ) -const Version string = "skaffold/v1beta10" +const Version string = "skaffold/v1beta9" // NewSkaffoldConfig creates a SkaffoldConfig func NewSkaffoldConfig() util.VersionedConfig { diff --git a/pkg/skaffold/schema/v1beta8/upgrade.go b/pkg/skaffold/schema/v1beta8/upgrade.go index bbd6355c3d0..a89bcd019f2 100644 --- a/pkg/skaffold/schema/v1beta8/upgrade.go +++ b/pkg/skaffold/schema/v1beta8/upgrade.go @@ -17,49 +17,79 @@ limitations under the License. package v1beta8 import ( + "github.com/GoogleContainerTools/skaffold/pkg/skaffold/schema/latest" "github.com/GoogleContainerTools/skaffold/pkg/skaffold/schema/util" - next "github.com/GoogleContainerTools/skaffold/pkg/skaffold/schema/v1beta9" pkgutil "github.com/GoogleContainerTools/skaffold/pkg/skaffold/util" "github.com/pkg/errors" + "gopkg.in/yaml.v2" ) // Upgrade upgrades a configuration to the next version. // Config changes from v1beta8 to v1beta9 // 1. Additions: // gitTagger/variant -// 2. No removals +// 2. Removed all schemas associated with builder plugins // 3. No updates func (config *SkaffoldConfig) Upgrade() (util.VersionedConfig, error) { // convert Deploy (should be the same) - var newDeploy next.DeployConfig + var newDeploy latest.DeployConfig if err := pkgutil.CloneThroughJSON(config.Deploy, &newDeploy); err != nil { return nil, errors.Wrap(err, "converting deploy config") } // convert Profiles (should be the same) - var newProfiles []next.Profile + var newProfiles []latest.Profile if config.Profiles != nil { if err := pkgutil.CloneThroughJSON(config.Profiles, &newProfiles); err != nil { return nil, errors.Wrap(err, "converting new profile") } } - // convert Kaniko (should be same) - var newBuild next.BuildConfig + // convert Build (should be same) + var newBuild latest.BuildConfig if err := pkgutil.CloneThroughJSON(config.Build, &newBuild); err != nil { return nil, errors.Wrap(err, "converting new build") } + for i, a := range config.Build.Artifacts { + if a.BuilderPlugin == nil { + continue + } + if a.BuilderPlugin.Name == "bazel" { + var ba *latest.BazelArtifact + contents, err := yaml.Marshal(a.BuilderPlugin.Properties) + if err != nil { + return nil, errors.Wrap(err, "unmarshalling properties") + } + if err := yaml.Unmarshal(contents, &ba); err != nil { + return nil, errors.Wrap(err, "unmarshalling bazel artifact") + } + newBuild.Artifacts[i].BazelArtifact = ba + } + + if a.BuilderPlugin.Name == "docker" { + var da *latest.DockerArtifact + contents, err := yaml.Marshal(a.BuilderPlugin.Properties) + if err != nil { + return nil, errors.Wrap(err, "unmarshalling properties") + } + if err := yaml.Unmarshal(contents, &da); err != nil { + return nil, errors.Wrap(err, "unmarshalling bazel artifact") + } + newBuild.Artifacts[i].DockerArtifact = da + } + } + // convert Test (should be the same) - var newTest []*next.TestCase + var newTest []*latest.TestCase if err := pkgutil.CloneThroughJSON(config.Test, &newTest); err != nil { return nil, errors.Wrap(err, "converting new test") } - return &next.SkaffoldConfig{ - APIVersion: next.Version, + return &latest.SkaffoldConfig{ + APIVersion: latest.Version, Kind: config.Kind, - Pipeline: next.Pipeline{ + Pipeline: latest.Pipeline{ Build: newBuild, Test: newTest, Deploy: newDeploy, diff --git a/pkg/skaffold/schema/v1beta8/upgrade_test.go b/pkg/skaffold/schema/v1beta8/upgrade_test.go index 219a37d1cba..3389d327041 100644 --- a/pkg/skaffold/schema/v1beta8/upgrade_test.go +++ b/pkg/skaffold/schema/v1beta8/upgrade_test.go @@ -19,7 +19,7 @@ package v1beta8 import ( "testing" - next "github.com/GoogleContainerTools/skaffold/pkg/skaffold/schema/v1beta9" + "github.com/GoogleContainerTools/skaffold/pkg/skaffold/schema/latest" "github.com/GoogleContainerTools/skaffold/testutil" yaml "gopkg.in/yaml.v2" ) @@ -30,6 +30,15 @@ kind: Config build: artifacts: - image: gcr.io/k8s-skaffold/skaffold-example + plugin: + name: docker + properties: + dockerfile: path/to/Dockerfile + - image: gcr.io/k8s-skaffold/bazel + plugin: + name: bazel + properties: + target: //mytarget test: - image: gcr.io/k8s-skaffold/skaffold-example structureTests: @@ -64,6 +73,11 @@ kind: Config build: artifacts: - image: gcr.io/k8s-skaffold/skaffold-example + docker: + dockerfile: path/to/Dockerfile + - image: gcr.io/k8s-skaffold/bazel + bazel: + target: //mytarget test: - image: gcr.io/k8s-skaffold/skaffold-example structureTests: @@ -104,7 +118,7 @@ func verifyUpgrade(t *testing.T, input, output string) { upgraded, err := config.Upgrade() testutil.CheckError(t, false, err) - expected := next.NewSkaffoldConfig() + expected := latest.NewSkaffoldConfig() err = yaml.UnmarshalStrict([]byte(output), expected) testutil.CheckErrorAndDeepEqual(t, false, err, expected, upgraded) diff --git a/pkg/skaffold/schema/v1beta9/config.go b/pkg/skaffold/schema/v1beta9/config.go deleted file mode 100644 index ab7fbcaef71..00000000000 --- a/pkg/skaffold/schema/v1beta9/config.go +++ /dev/null @@ -1,665 +0,0 @@ -/* -Copyright 2019 The Skaffold Authors - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package v1beta9 - -import ( - "github.com/GoogleContainerTools/skaffold/pkg/skaffold/schema/util" -) - -const Version string = "skaffold/v1beta9" - -// NewSkaffoldConfig creates a SkaffoldConfig -func NewSkaffoldConfig() util.VersionedConfig { - return new(SkaffoldConfig) -} - -// SkaffoldConfig holds the fields parsed from the Skaffold configuration file (skaffold.yaml). -type SkaffoldConfig struct { - // APIVersion is the version of the configuration. - APIVersion string `yaml:"apiVersion" yamltags:"required"` - - // Kind is always `Config`. Defaults to `Config`. - Kind string `yaml:"kind" yamltags:"required"` - - // Pipeline defines the Build/Test/Deploy phases. - Pipeline `yaml:",inline"` - - // Profiles *beta* can override be used to `build`, `test` or `deploy` configuration. - Profiles []Profile `yaml:"profiles,omitempty"` -} - -// Pipeline describes a Skaffold pipeline. -type Pipeline struct { - // Build describes how images are built. - Build BuildConfig `yaml:"build,omitempty"` - - // Test describes how images are tested. - Test []*TestCase `yaml:"test,omitempty"` - - // Deploy describes how images are deployed. - Deploy DeployConfig `yaml:"deploy,omitempty"` -} - -func (c *SkaffoldConfig) GetVersion() string { - return c.APIVersion -} - -// BuildConfig contains all the configuration for the build steps. -type BuildConfig struct { - // Artifacts lists the images you're going to be building. - Artifacts []*Artifact `yaml:"artifacts,omitempty"` - - // InsecureRegistries is a list of registries declared by the user to be insecure. - // These registries will be connected to via HTTP instead of HTTPS. - InsecureRegistries []string `yaml:"insecureRegistries,omitempty"` - - // TagPolicy *beta* determines how images are tagged. - // A few strategies are provided here, although you most likely won't need to care! - // If not specified, it defaults to `gitCommit: {}`. - TagPolicy TagPolicy `yaml:"tagPolicy,omitempty"` - - // ExecutionEnvironment is the environment in which the build - // should run. Possible values: googleCloudBuild. - ExecutionEnvironment *ExecutionEnvironment `yaml:"executionEnvironment,omitempty"` - - BuildType `yaml:",inline"` -} - -// ExecEnvironment is the name of an execution environment. -type ExecEnvironment string - -// ExecutionEnvironment is the environment in which the build should run (ex. local or in-cluster, etc.). -type ExecutionEnvironment struct { - // Name is the name of the environment. - Name ExecEnvironment `yaml:"name,omitempty"` - - // Properties are key-value pairs passed to the environment. - Properties map[string]interface{} `yaml:"properties,omitempty"` -} - -// BuilderPlugin contains all fields necessary for specifying a build plugin. -type BuilderPlugin struct { - // Name is the name of the build plugin. - Name string `yaml:"name,omitempty"` - - // Properties are key-value pairs passed to the plugin. - Properties map[string]interface{} `yaml:"properties,omitempty"` - - // Contents - Contents []byte `yaml:",omitempty"` -} - -// TagPolicy contains all the configuration for the tagging step. -type TagPolicy struct { - // GitTagger *beta* tags images with the git tag or commit of the artifact's workspace. - GitTagger *GitTagger `yaml:"gitCommit,omitempty" yamltags:"oneOf=tag"` - - // ShaTagger *beta* tags images with their sha256 digest. - ShaTagger *ShaTagger `yaml:"sha256,omitempty" yamltags:"oneOf=tag"` - - // EnvTemplateTagger *beta* tags images with a configurable template string. - EnvTemplateTagger *EnvTemplateTagger `yaml:"envTemplate,omitempty" yamltags:"oneOf=tag"` - - // DateTimeTagger *beta* tags images with the build timestamp. - DateTimeTagger *DateTimeTagger `yaml:"dateTime,omitempty" yamltags:"oneOf=tag"` -} - -// ShaTagger *beta* tags images with their sha256 digest. -type ShaTagger struct{} - -// GitTagger *beta* tags images with the git tag or commit of the artifact's workspace. -type GitTagger struct{} - -// EnvTemplateTagger *beta* tags images with a configurable template string. -type EnvTemplateTagger struct { - // Template used to produce the image name and tag. - // See golang [text/template](https://golang.org/pkg/text/template/). - // The template is executed against the current environment, - // with those variables injected: - // IMAGE_NAME | Name of the image being built, as supplied in the artifacts section. - // For example: `{{.RELEASE}}-{{.IMAGE_NAME}}`. - Template string `yaml:"template,omitempty" yamltags:"required"` -} - -// DateTimeTagger *beta* tags images with the build timestamp. -type DateTimeTagger struct { - // Format formats the date and time. - // See [#Time.Format](https://golang.org/pkg/time/#Time.Format). - // Defaults to `2006-01-02_15-04-05.999_MST`. - Format string `yaml:"format,omitempty"` - - // TimeZone sets the timezone for the date and time. - // See [Time.LoadLocation](https://golang.org/pkg/time/#Time.LoadLocation). - // Defaults to the local timezone. - TimeZone string `yaml:"timezone,omitempty"` -} - -// BuildType contains the specific implementation and parameters needed -// for the build step. Only one field should be populated. -type BuildType struct { - // LocalBuild *beta* describes how to do a build on the local docker daemon - // and optionally push to a repository. - LocalBuild *LocalBuild `yaml:"local,omitempty" yamltags:"oneOf=build"` - - // GoogleCloudBuild *beta* describes how to do a remote build on - // [Google Cloud Build](https://cloud.google.com/cloud-build/). - GoogleCloudBuild *GoogleCloudBuild `yaml:"googleCloudBuild,omitempty" yamltags:"oneOf=build"` - - // Cluster *beta* describes how to do an on-cluster build. - Cluster *ClusterDetails `yaml:"cluster,omitempty" yamltags:"oneOf=build"` -} - -// LocalBuild *beta* describes how to do a build on the local docker daemon -// and optionally push to a repository. -type LocalBuild struct { - // Push should images be pushed to a registry. - // If not specified, images are pushed only if the current Kubernetes context - // connects to a remote cluster. - Push *bool `yaml:"push,omitempty"` - - // UseDockerCLI use `docker` command-line interface instead of Docker Engine APIs. - UseDockerCLI bool `yaml:"useDockerCLI,omitempty"` - - // UseBuildkit use BuildKit to build Docker images. - UseBuildkit bool `yaml:"useBuildkit,omitempty"` -} - -// GoogleCloudBuild *beta* describes how to do a remote build on -// [Google Cloud Build](https://cloud.google.com/cloud-build/docs/). -// Docker and Jib artifacts can be built on Cloud Build. The `projectId` needs -// to be provided and the currently logged in user should be given permissions to trigger -// new builds. -type GoogleCloudBuild struct { - // ProjectID is the ID of your Cloud Platform Project. - // If it is not provided, Skaffold will guess it from the image name. - // For example, given the artifact image name `gcr.io/myproject/image`, Skaffold - // will use the `myproject` GCP project. - ProjectID string `yaml:"projectId,omitempty"` - - // DiskSizeGb is the disk size 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). - DiskSizeGb int64 `yaml:"diskSizeGb,omitempty"` - - // MachineType is the 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). - MachineType string `yaml:"machineType,omitempty"` - - // Timeout is the amount of time (in seconds) that this build should be allowed to run. - // See [Cloud Build Reference](https://cloud.google.com/cloud-build/docs/api/reference/rest/v1/projects.builds#resource-build). - Timeout string `yaml:"timeout,omitempty"` - - // DockerImage is the image that runs a Docker build. - // See [Cloud Builders](https://cloud.google.com/cloud-build/docs/cloud-builders). - // Defaults to `gcr.io/cloud-builders/docker`. - DockerImage string `yaml:"dockerImage,omitempty"` - - // MavenImage is the image that runs a Maven build. - // See [Cloud Builders](https://cloud.google.com/cloud-build/docs/cloud-builders). - // Defaults to `gcr.io/cloud-builders/mvn`. - MavenImage string `yaml:"mavenImage,omitempty"` - - // GradleImage is the image that runs a Gradle build. - // See [Cloud Builders](https://cloud.google.com/cloud-build/docs/cloud-builders). - // Defaults to `gcr.io/cloud-builders/gradle`. - GradleImage string `yaml:"gradleImage,omitempty"` -} - -// LocalDir configures how Kaniko mounts sources directly via an `emptyDir` volume. -type LocalDir struct { - // InitImage is the image used to run init container which mounts kaniko context. - InitImage string `yaml:"initImage,omitempty"` -} - -// KanikoBuildContext contains the different fields available to specify -// a Kaniko build context. -type KanikoBuildContext struct { - // GCSBucket is the CGS bucket to which sources are uploaded. - // Kaniko will need access to that bucket to download the sources. - GCSBucket string `yaml:"gcsBucket,omitempty" yamltags:"oneOf=buildContext"` - - // LocalDir configures how Kaniko mounts sources directly via an `emptyDir` volume. - LocalDir *LocalDir `yaml:"localDir,omitempty" yamltags:"oneOf=buildContext"` -} - -// KanikoCache configures Kaniko caching. If a cache is specified, Kaniko will -// use a remote cache which will speed up builds. -type KanikoCache struct { - // Repo is a remote repository to store cached layers. If none is specified, one will be - // inferred from the image name. See [Kaniko Caching](https://github.com/GoogleContainerTools/kaniko#caching). - Repo string `yaml:"repo,omitempty"` -} - -// ClusterDetails *beta* describes how to do an on-cluster build. -type ClusterDetails struct { - // PullSecret is the path to the secret key file. - PullSecret string `yaml:"pullSecret,omitempty"` - - // PullSecretName is the name of the Kubernetes secret for pulling the files - // from the build context and pushing the final image. - // Defaults to `kaniko-secret`. - PullSecretName string `yaml:"pullSecretName,omitempty"` - - // Namespace is the Kubernetes namespace. - // Defaults to current namespace in Kubernetes configuration. - Namespace string `yaml:"namespace,omitempty"` - - // Timeout is the amount of time (in seconds) that this build is allowed to run. - // Defaults to 20 minutes (`20m`). - Timeout string `yaml:"timeout,omitempty"` - - // DockerConfig describes how to mount the local Docker configuration into a pod. - DockerConfig *DockerConfig `yaml:"dockerConfig,omitempty"` - - // Resources define the resource requirements for the kaniko pod. - Resources *ResourceRequirements `yaml:"resources,omitempty"` -} - -// DockerConfig contains information about the docker `config.json` to mount. -type DockerConfig struct { - // Path is the path to the docker `config.json`. - Path string `yaml:"path,omitempty"` - - // SecretName is the Kubernetes secret that will hold the Docker configuration. - SecretName string `yaml:"secretName,omitempty"` -} - -// ResourceRequirements describes the resource requirements for the kaniko pod. -type ResourceRequirements struct { - // Requests [resource requests](https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/#resource-requests-and-limits-of-pod-and-container) for the Kaniko pod. - Requests *ResourceRequirement `yaml:"requests,omitempty"` - - // Limits [resource limits](https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/#resource-requests-and-limits-of-pod-and-container) for the Kaniko pod. - Limits *ResourceRequirement `yaml:"limits,omitempty"` -} - -// ResourceRequirement stores the CPU/Memory requirements for the pod. -type ResourceRequirement struct { - // CPU the number cores to be used. - // For example: `2`, `2.0` or `200m`. - CPU string `yaml:"cpu,omitempty"` - - // Memory the amount of memory to allocate to the pod. - // For example: `1Gi` or `1000Mi`. - Memory string `yaml:"memory,omitempty"` -} - -// TestCase is a list of structure tests to run on images that Skaffold builds. -type TestCase struct { - // ImageName is the artifact on which to run those tests. - // For example: `gcr.io/k8s-skaffold/example`. - ImageName string `yaml:"image" yamltags:"required"` - - // StructureTests lists the [Container Structure Tests](https://github.com/GoogleContainerTools/container-structure-test) - // to run on that artifact. - // For example: `["./test/*"]`. - StructureTests []string `yaml:"structureTests,omitempty"` -} - -// DeployConfig contains all the configuration needed by the deploy steps. -type DeployConfig struct { - DeployType `yaml:",inline"` -} - -// DeployType contains the specific implementation and parameters needed -// for the deploy step. Only one field should be populated. -type DeployType struct { - // HelmDeploy *beta* uses the `helm` CLI to apply the charts to the cluster. - HelmDeploy *HelmDeploy `yaml:"helm,omitempty" yamltags:"oneOf=deploy"` - - // KubectlDeploy *beta* uses a client side `kubectl apply` to deploy manifests. - // You'll need a `kubectl` CLI version installed that's compatible with your cluster. - KubectlDeploy *KubectlDeploy `yaml:"kubectl,omitempty" yamltags:"oneOf=deploy"` - - // KustomizeDeploy *beta* uses the `kustomize` CLI to "patch" a deployment for a target environment. - KustomizeDeploy *KustomizeDeploy `yaml:"kustomize,omitempty" yamltags:"oneOf=deploy"` -} - -// KubectlDeploy *beta* uses a client side `kubectl apply` to deploy manifests. -// You'll need a `kubectl` CLI version installed that's compatible with your cluster. -type KubectlDeploy struct { - // Manifests lists the Kubernetes yaml or json manifests. - // Defaults to `["k8s/*.yaml"]`. - Manifests []string `yaml:"manifests,omitempty"` - - // RemoteManifests lists Kubernetes manifests in remote clusters. - RemoteManifests []string `yaml:"remoteManifests,omitempty"` - - // Flags are additional flags passed to `kubectl`. - Flags KubectlFlags `yaml:"flags,omitempty"` -} - -// KubectlFlags are additional flags passed on the command -// line to kubectl either on every command (Global), on creations (Apply) -// or deletions (Delete). -type KubectlFlags struct { - // Global are additional flags passed on every command. - Global []string `yaml:"global,omitempty"` - - // Apply are additional flags passed on creations (`kubectl apply`). - Apply []string `yaml:"apply,omitempty"` - - // Delete are additional flags passed on deletions (`kubectl delete`). - Delete []string `yaml:"delete,omitempty"` -} - -// HelmDeploy *beta* uses the `helm` CLI to apply the charts to the cluster. -type HelmDeploy struct { - // Releases is a list of Helm releases. - Releases []HelmRelease `yaml:"releases,omitempty" yamltags:"required"` - - // Flags are additional option flags that are passed on the command - // line to `helm`. - Flags HelmDeployFlags `yaml:"flags,omitempty"` -} - -// HelmDeployFlags are additional option flags that are passed on the command -// line to `helm`. -type HelmDeployFlags struct { - // Global are additional flags passed on every command. - Global []string `yaml:"global,omitempty"` - - // Install are additional flags passed to (`helm install`). - Install []string `yaml:"install,omitempty"` - - // Upgrade are additional flags passed to (`helm upgrade`). - Upgrade []string `yaml:"upgrade,omitempty"` -} - -// KustomizeDeploy *beta* uses the `kustomize` CLI to "patch" a deployment for a target environment. -type KustomizeDeploy struct { - // KustomizePath is the path to Kustomization files. - // Defaults to `.`. - KustomizePath string `yaml:"path,omitempty"` - - // Flags are additional flags passed to `kubectl`. - Flags KubectlFlags `yaml:"flags,omitempty"` -} - -// HelmRelease describes a helm release to be deployed. -type HelmRelease struct { - // Name is the name of the Helm release. - Name string `yaml:"name,omitempty" yamltags:"required"` - - // ChartPath is the path to the Helm chart. - ChartPath string `yaml:"chartPath,omitempty" yamltags:"required"` - - // ValuesFiles are the paths to the Helm `values` files. - ValuesFiles []string `yaml:"valuesFiles,omitempty"` - - // Values are key-value pairs supplementing the Helm `values` file. - Values map[string]string `yaml:"values,omitempty,omitempty"` - - // Namespace is the Kubernetes namespace. - Namespace string `yaml:"namespace,omitempty"` - - // Version is the version of the chart. - Version string `yaml:"version,omitempty"` - - // SetValues are key-value pairs. - // If present, Skaffold will send `--set` flag to Helm CLI and append all pairs after the flag. - SetValues map[string]string `yaml:"setValues,omitempty"` - - // SetValueTemplates are key-value pairs. - // If present, Skaffold will try to parse the value part of each key-value pair using - // environment variables in the system, then send `--set` flag to Helm CLI and append - // all parsed pairs after the flag. - SetValueTemplates map[string]string `yaml:"setValueTemplates,omitempty"` - - // Wait if `true`, Skaffold will send `--wait` flag to Helm CLI. - // Defaults to `false`. - Wait bool `yaml:"wait,omitempty"` - - // RecreatePods if `true`, Skaffold will send `--recreate-pods` flag to Helm CLI. - // Defaults to `false`. - RecreatePods bool `yaml:"recreatePods,omitempty"` - - // SkipBuildDependencies should build dependencies be skipped. - SkipBuildDependencies bool `yaml:"skipBuildDependencies,omitempty"` - - // UseHelmSecrets instructs skaffold to use secrets plugin on deployment. - UseHelmSecrets bool `yaml:"useHelmSecrets,omitempty"` - - // Overrides are key-value pairs. - // If present, Skaffold will build a Helm `values` file that overrides - // the original and use it to call Helm CLI (`--f` flag). - Overrides util.HelmOverrides `yaml:"overrides,omitempty"` - - // Packaged parameters for packaging helm chart (`helm package`). - Packaged *HelmPackaged `yaml:"packaged,omitempty"` - - // ImageStrategy adds image configurations to the Helm `values` file. - ImageStrategy HelmImageStrategy `yaml:"imageStrategy,omitempty"` -} - -// HelmPackaged parameters for packaging helm chart (`helm package`). -type HelmPackaged struct { - // Version sets the `version` on the chart to this semver version. - Version string `yaml:"version,omitempty"` - - // AppVersion sets the `appVersion` on the chart to this version. - AppVersion string `yaml:"appVersion,omitempty"` -} - -// HelmImageStrategy adds image configurations to the Helm `values` file. -type HelmImageStrategy struct { - HelmImageConfig `yaml:",inline"` -} - -// HelmImageConfig describes an image configuration. -type HelmImageConfig struct { - // HelmFQNConfig is the image configuration uses the syntax `IMAGE-NAME=IMAGE-REPOSITORY:IMAGE-TAG`. - HelmFQNConfig *HelmFQNConfig `yaml:"fqn,omitempty" yamltags:"oneOf=helmImageStrategy"` - - // HelmConventionConfig is the image configuration uses the syntax `IMAGE-NAME.repository=IMAGE-REPOSITORY, IMAGE-NAME.tag=IMAGE-TAG`. - HelmConventionConfig *HelmConventionConfig `yaml:"helm,omitempty" yamltags:"oneOf=helmImageStrategy"` -} - -// HelmFQNConfig is the image config to use the FullyQualifiedImageName as param to set. -type HelmFQNConfig struct { - // Property defines the image config. - Property string `yaml:"property,omitempty"` -} - -// HelmConventionConfig is the image config in the syntax of image.repository and image.tag. -type HelmConventionConfig struct { -} - -// Artifact are the items that need to be built, along with the context in which -// they should be built. -type Artifact struct { - // ImageName is the name of the image to be built. - // For example: `gcr.io/k8s-skaffold/example`. - ImageName string `yaml:"image,omitempty" yamltags:"required"` - - // Workspace is the directory containing the artifact's sources. - // Defaults to `.`. - Workspace string `yaml:"context,omitempty"` - - // Sync *alpha* lists local files synced to pods instead - // of triggering an image build when modified. - // This is a mapping of local files to sync to remote folders. - // For example: `{"*.py": ".", "css/**/*.css": "app/css"}`. - Sync map[string]string `yaml:"sync,omitempty"` - - // ArtifactType describes how to build an artifact. - ArtifactType `yaml:",inline"` - - WorkspaceHash string `yaml:"-,omitempty"` - - // BuilderPlugin is the plugin used to build this artifact. - BuilderPlugin *BuilderPlugin `yaml:"plugin,omitempty"` -} - -// Profile *beta* profiles are used to override any `build`, `test` or `deploy` configuration. -type Profile struct { - // Name is a unique profile name. - // For example: `profile-prod`. - Name string `yaml:"name,omitempty" yamltags:"required"` - - // Pipeline contains the definitions to replace the default skaffold pipeline. - Pipeline `yaml:",inline"` - - // Patches lists patches applied to the configuration. - // Patches use the JSON patch notation. - Patches []JSONPatch `yaml:"patches,omitempty"` - - // Activation criteria by which a profile can be auto-activated. - // The profile is auto-activated if any one of the activations are triggered. - // An activation is triggered if all of the criteria (env, kubeContext, command) are triggered. - Activation []Activation `yaml:"activation,omitempty"` -} - -// JSONPatch patch to be applied by a profile. -type JSONPatch struct { - // Op is the operation carried by the patch: `add`, `remove`, `replace`, `move`, `copy` or `test`. - // Defaults to `replace`. - Op string `yaml:"op,omitempty"` - - // Path is the position in the yaml where the operation takes place. - // For example, this targets the `dockerfile` of the first artifact built. - // For example: `/build/artifacts/0/docker/dockerfile`. - Path string `yaml:"path,omitempty" yamltags:"required"` - - // From is the source position in the yaml, used for `copy` or `move` operations. - From string `yaml:"from,omitempty"` - - // Value is the value to apply. Can be any portion of yaml. - Value *util.YamlpatchNode `yaml:"value,omitempty"` -} - -// Activation criteria by which a profile is auto-activated. -type Activation struct { - // Env is a `key=value` pair. The profile is auto-activated if an Environment - // Variable `key` has value `value`. - // For example: `ENV=production`. - Env string `yaml:"env,omitempty"` - - // KubeContext is a Kubernetes context for which the profile is auto-activated. - // For example: `minikube`. - KubeContext string `yaml:"kubeContext,omitempty"` - - // Command is a Skaffold command for which the profile is auto-activated. - // For example: `dev`. - Command string `yaml:"command,omitempty"` -} - -// ArtifactType describes how to build an artifact. -type ArtifactType struct { - // DockerArtifact *beta* describes an artifact built from a Dockerfile. - DockerArtifact *DockerArtifact `yaml:"docker,omitempty" yamltags:"oneOf=artifact"` - - // BazelArtifact *beta* requires bazel CLI to be installed and the sources to - // contain [Bazel](https://bazel.build/) configuration files. - BazelArtifact *BazelArtifact `yaml:"bazel,omitempty" yamltags:"oneOf=artifact"` - - // JibMavenArtifact *alpha* builds images using the - // [Jib plugin for Maven](https://github.com/GoogleContainerTools/jib/tree/master/jib-maven-plugin). - JibMavenArtifact *JibMavenArtifact `yaml:"jibMaven,omitempty" yamltags:"oneOf=artifact"` - - // JibGradleArtifact *alpha* builds images using the - // [Jib plugin for Gradle](https://github.com/GoogleContainerTools/jib/tree/master/jib-gradle-plugin). - JibGradleArtifact *JibGradleArtifact `yaml:"jibGradle,omitempty" yamltags:"oneOf=artifact"` - - // KanikoArtifact *alpha* builds images using [kaniko](https://github.com/GoogleContainerTools/kaniko). - KanikoArtifact *KanikoArtifact `yaml:"kaniko,omitempty" yamltags:"oneOf=artifact"` -} - -// KanikoArtifact *alpha* describes an artifact built from a Dockerfile, -// with kaniko. -type KanikoArtifact struct { - // AdditionalFlags are additional flags to be passed to Kaniko command line. - // See [Kaniko Additional Flags](https://github.com/GoogleContainerTools/kaniko#additional-flags). - // Deprecated - instead the named, unique fields should be used, e.g. `buildArgs`, `cache`, `target`. - AdditionalFlags []string `yaml:"flags,omitempty"` - - // DockerfilePath locates the Dockerfile relative to workspace. - // Defaults to `Dockerfile`. - DockerfilePath string `yaml:"dockerfile,omitempty"` - - // Target is the Dockerfile target name to build. - Target string `yaml:"target,omitempty"` - - // BuildArgs are arguments passed to the docker build. - // For example: `{"key1": "value1", "key2": "value2"}`. - BuildArgs map[string]*string `yaml:"buildArgs,omitempty"` - - // BuildContext is where the build context for this artifact resides. - BuildContext *KanikoBuildContext `yaml:"buildContext,omitempty"` - - // Image is the Docker image used by the Kaniko pod. - // Defaults to the latest released version of `gcr.io/kaniko-project/executor`. - Image string `yaml:"image,omitempty"` - - // Cache configures Kaniko caching. If a cache is specified, Kaniko will - // use a remote cache which will speed up builds. - Cache *KanikoCache `yaml:"cache,omitempty"` -} - -// DockerArtifact *beta* describes an artifact built from a Dockerfile, -// usually using `docker build`. -type DockerArtifact struct { - // DockerfilePath locates the Dockerfile relative to workspace. - // Defaults to `Dockerfile`. - DockerfilePath string `yaml:"dockerfile,omitempty"` - - // Target is the Dockerfile target name to build. - Target string `yaml:"target,omitempty"` - - // BuildArgs are arguments passed to the docker build. - // For example: `{"key1": "value1", "key2": "value2"}`. - BuildArgs map[string]*string `yaml:"buildArgs,omitempty"` - - // CacheFrom lists the Docker images used as cache sources. - // For example: `["golang:1.10.1-alpine3.7", "alpine:3.7"]`. - CacheFrom []string `yaml:"cacheFrom,omitempty"` -} - -// BazelArtifact *beta* describes an artifact built with [Bazel](https://bazel.build/). -type BazelArtifact struct { - // BuildTarget is the `bazel build` target to run. - // For example: `//:skaffold_example.tar`. - BuildTarget string `yaml:"target,omitempty" yamltags:"required"` - - // BuildArgs are additional args to pass to `bazel build`. - // For example: `["-flag", "--otherflag"]`. - BuildArgs []string `yaml:"args,omitempty"` -} - -// JibMavenArtifact *alpha* builds images using the -// [Jib plugin for Maven](https://github.com/GoogleContainerTools/jib/tree/master/jib-maven-plugin). -type JibMavenArtifact struct { - // Module selects which Maven module to build, for a multi module project. - Module string `yaml:"module"` - - // Profile selects which Maven profile to activate. - Profile string `yaml:"profile"` - - // Flags are additional build flags passed to Maven. - // For example: `["-x", "-DskipTests"]`. - Flags []string `yaml:"args,omitempty"` -} - -// JibGradleArtifact *alpha* builds images using the -// [Jib plugin for Gradle](https://github.com/GoogleContainerTools/jib/tree/master/jib-gradle-plugin). -type JibGradleArtifact struct { - // Project selects which Gradle project to build. - Project string `yaml:"project"` - - // Flags are additional build flags passed to Gradle. - // For example: `["--no-build-cache"]`. - Flags []string `yaml:"args,omitempty"` -} diff --git a/pkg/skaffold/schema/v1beta9/upgrade.go b/pkg/skaffold/schema/v1beta9/upgrade.go deleted file mode 100644 index 066d4f00375..00000000000 --- a/pkg/skaffold/schema/v1beta9/upgrade.go +++ /dev/null @@ -1,99 +0,0 @@ -/* -Copyright 2019 The Skaffold Authors - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package v1beta9 - -import ( - "github.com/GoogleContainerTools/skaffold/pkg/skaffold/schema/latest" - next "github.com/GoogleContainerTools/skaffold/pkg/skaffold/schema/latest" - "github.com/GoogleContainerTools/skaffold/pkg/skaffold/schema/util" - pkgutil "github.com/GoogleContainerTools/skaffold/pkg/skaffold/util" - "github.com/pkg/errors" - "gopkg.in/yaml.v2" -) - -// Upgrade upgrades a configuration to the next version. -// Config changes from v1beta9 to v1beta10 -// 1. No additions -// 2. Removed all schemas associated with builder plugins -// 3. No updates -func (config *SkaffoldConfig) Upgrade() (util.VersionedConfig, error) { - // convert Deploy (should be the same) - var newDeploy next.DeployConfig - if err := pkgutil.CloneThroughJSON(config.Deploy, &newDeploy); err != nil { - return nil, errors.Wrap(err, "converting deploy config") - } - - // convert Profiles (should be the same) - var newProfiles []next.Profile - if config.Profiles != nil { - if err := pkgutil.CloneThroughJSON(config.Profiles, &newProfiles); err != nil { - return nil, errors.Wrap(err, "converting new profile") - } - } - - // convert Build (should be same) - var newBuild next.BuildConfig - if err := pkgutil.CloneThroughJSON(config.Build, &newBuild); err != nil { - return nil, errors.Wrap(err, "converting new build") - } - - for i, a := range config.Build.Artifacts { - if a.BuilderPlugin == nil { - continue - } - if a.BuilderPlugin.Name == "bazel" { - var ba *latest.BazelArtifact - contents, err := yaml.Marshal(a.BuilderPlugin.Properties) - if err != nil { - return nil, errors.Wrap(err, "unmarshalling properties") - } - if err := yaml.Unmarshal(contents, &ba); err != nil { - return nil, errors.Wrap(err, "unmarshalling bazel artifact") - } - newBuild.Artifacts[i].BazelArtifact = ba - } - - if a.BuilderPlugin.Name == "docker" { - var da *latest.DockerArtifact - contents, err := yaml.Marshal(a.BuilderPlugin.Properties) - if err != nil { - return nil, errors.Wrap(err, "unmarshalling properties") - } - if err := yaml.Unmarshal(contents, &da); err != nil { - return nil, errors.Wrap(err, "unmarshalling bazel artifact") - } - newBuild.Artifacts[i].DockerArtifact = da - } - } - - // convert Test (should be the same) - var newTest []*next.TestCase - if err := pkgutil.CloneThroughJSON(config.Test, &newTest); err != nil { - return nil, errors.Wrap(err, "converting new test") - } - - return &next.SkaffoldConfig{ - APIVersion: next.Version, - Kind: config.Kind, - Pipeline: next.Pipeline{ - Build: newBuild, - Test: newTest, - Deploy: newDeploy, - }, - Profiles: newProfiles, - }, nil -} diff --git a/pkg/skaffold/schema/v1beta9/upgrade_test.go b/pkg/skaffold/schema/v1beta9/upgrade_test.go deleted file mode 100644 index d41463020c3..00000000000 --- a/pkg/skaffold/schema/v1beta9/upgrade_test.go +++ /dev/null @@ -1,127 +0,0 @@ -/* -Copyright 2019 The Skaffold Authors - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package v1beta9 - -import ( - "testing" - - "github.com/GoogleContainerTools/skaffold/pkg/skaffold/schema/latest" - "github.com/GoogleContainerTools/skaffold/testutil" - yaml "gopkg.in/yaml.v2" -) - -func TestUpgrade(t *testing.T) { - yaml := `apiVersion: skaffold/v1beta9 -kind: Config -build: - artifacts: - - image: gcr.io/k8s-skaffold/skaffold-example - plugin: - name: docker - properties: - dockerfile: path/to/Dockerfile - - image: gcr.io/k8s-skaffold/bazel - plugin: - name: bazel - properties: - target: //mytarget - executionEnvironment: - name: local -test: - - image: gcr.io/k8s-skaffold/skaffold-example - structureTests: - - ./test/* -deploy: - kubectl: - manifests: - - k8s-* -profiles: - - name: test profile - build: - artifacts: - - image: gcr.io/k8s-skaffold/skaffold-example - kaniko: - buildContext: - gcsBucket: skaffold-kaniko - cache: {} - cluster: - pullSecretName: e2esecret - namespace: default - test: - - image: gcr.io/k8s-skaffold/skaffold-example - structureTests: - - ./test/* - deploy: - kubectl: - manifests: - - k8s-* -` - expected := `apiVersion: skaffold/v1beta10 -kind: Config -build: - artifacts: - - image: gcr.io/k8s-skaffold/skaffold-example - docker: - dockerfile: path/to/Dockerfile - - image: gcr.io/k8s-skaffold/bazel - bazel: - target: //mytarget -test: - - image: gcr.io/k8s-skaffold/skaffold-example - structureTests: - - ./test/* -deploy: - kubectl: - manifests: - - k8s-* -profiles: - - name: test profile - build: - artifacts: - - image: gcr.io/k8s-skaffold/skaffold-example - kaniko: - buildContext: - gcsBucket: skaffold-kaniko - cache: {} - cluster: - pullSecretName: e2esecret - namespace: default - test: - - image: gcr.io/k8s-skaffold/skaffold-example - structureTests: - - ./test/* - deploy: - kubectl: - manifests: - - k8s-* -` - verifyUpgrade(t, yaml, expected) -} - -func verifyUpgrade(t *testing.T, input, output string) { - pipeline := NewSkaffoldConfig() - err := yaml.UnmarshalStrict([]byte(input), pipeline) - testutil.CheckErrorAndDeepEqual(t, false, err, Version, pipeline.GetVersion()) - - upgraded, err := pipeline.Upgrade() - testutil.CheckError(t, false, err) - - expected := latest.NewSkaffoldConfig() - err = yaml.UnmarshalStrict([]byte(output), expected) - - testutil.CheckErrorAndDeepEqual(t, false, err, expected, upgraded) -} diff --git a/pkg/skaffold/schema/versions.go b/pkg/skaffold/schema/versions.go index d7f13d274c5..417a91ff591 100644 --- a/pkg/skaffold/schema/versions.go +++ b/pkg/skaffold/schema/versions.go @@ -35,7 +35,6 @@ import ( "github.com/GoogleContainerTools/skaffold/pkg/skaffold/schema/v1beta6" "github.com/GoogleContainerTools/skaffold/pkg/skaffold/schema/v1beta7" "github.com/GoogleContainerTools/skaffold/pkg/skaffold/schema/v1beta8" - "github.com/GoogleContainerTools/skaffold/pkg/skaffold/schema/v1beta9" misc "github.com/GoogleContainerTools/skaffold/pkg/skaffold/util" "github.com/pkg/errors" "github.com/sirupsen/logrus" @@ -60,7 +59,6 @@ var SchemaVersions = Versions{ {v1beta6.Version, v1beta6.NewSkaffoldConfig}, {v1beta7.Version, v1beta7.NewSkaffoldConfig}, {v1beta8.Version, v1beta8.NewSkaffoldConfig}, - {v1beta9.Version, v1beta9.NewSkaffoldConfig}, {latest.Version, latest.NewSkaffoldConfig}, } From 589d69e91afcce3cb60085eee3a128b011e05a69 Mon Sep 17 00:00:00 2001 From: Priya Wadhwa Date: Thu, 25 Apr 2019 16:46:08 -0700 Subject: [PATCH 2/3] add test for executionEnvironment as well --- docs/content/en/docs/references/cli/_index.md | 520 ------------------ pkg/skaffold/schema/v1beta8/upgrade.go | 78 ++- pkg/skaffold/schema/v1beta8/upgrade_test.go | 34 ++ 3 files changed, 92 insertions(+), 540 deletions(-) diff --git a/docs/content/en/docs/references/cli/_index.md b/docs/content/en/docs/references/cli/_index.md index cbd1bc412db..11102331b19 100644 --- a/docs/content/en/docs/references/cli/_index.md +++ b/docs/content/en/docs/references/cli/_index.md @@ -53,523 +53,3 @@ Utilities: To edit this file above edit index_header - the rest of the file is autogenerated by cmd/skaffold/man ****** --> - -### skaffold build - -Builds the artifacts - -``` -Usage: - skaffold build - -Flags: - -b, --build-image stringArray Choose which artifacts to build. Artifacts with image names that contain the expression will be built only. Default is to build sources for all artifacts - --cache-artifacts Set to true to enable caching of artifacts. - --cache-file string Specify the location of the cache file (default $HOME/.skaffold/cache) - -d, --default-repo string Default repository value (overrides global config) - --enable-rpc skaffold dev Enable gRPC for exposing Skaffold events (true by default for skaffold dev) - -f, --filename string Filename or URL to the pipeline file (default "skaffold.yaml") - --insecure-registry stringArray Target registries for built images which are not secure - -n, --namespace string Run deployments in the specified namespace - --no-prune Skip removing images and containers built by Skaffold - -o, --output *flags.TemplateFlag Used in conjuction with --quiet flag. Format output with go-template. For full struct documentation, see https://godoc.org/github.com/GoogleContainerTools/skaffold/cmd/skaffold/app/cmd#BuildOutput (default {{.}}) - -p, --profile stringArray Activate profiles by name - -q, --quiet Suppress the build output and print image built on success. See --output to format output. - --rpc-http-port int tcp port to expose event REST API over HTTP (default 50052) - --rpc-port int tcp port to expose event API (default 50051) - --skip-tests Whether to skip the tests after building - --toot Emit a terminal beep after the deploy is complete - -Global Flags: - --color int Specify the default output color in ANSI escape codes (default 34) - -v, --verbosity string Log level (debug, info, warn, error, fatal, panic) (default "warning") - - -``` -Env vars: - -* `SKAFFOLD_BUILD_IMAGE` (same as `--build-image`) -* `SKAFFOLD_CACHE_ARTIFACTS` (same as `--cache-artifacts`) -* `SKAFFOLD_CACHE_FILE` (same as `--cache-file`) -* `SKAFFOLD_DEFAULT_REPO` (same as `--default-repo`) -* `SKAFFOLD_ENABLE_RPC` (same as `--enable-rpc`) -* `SKAFFOLD_FILENAME` (same as `--filename`) -* `SKAFFOLD_INSECURE_REGISTRY` (same as `--insecure-registry`) -* `SKAFFOLD_NAMESPACE` (same as `--namespace`) -* `SKAFFOLD_NO_PRUNE` (same as `--no-prune`) -* `SKAFFOLD_OUTPUT` (same as `--output`) -* `SKAFFOLD_PROFILE` (same as `--profile`) -* `SKAFFOLD_QUIET` (same as `--quiet`) -* `SKAFFOLD_RPC_HTTP_PORT` (same as `--rpc-http-port`) -* `SKAFFOLD_RPC_PORT` (same as `--rpc-port`) -* `SKAFFOLD_SKIP_TESTS` (same as `--skip-tests`) -* `SKAFFOLD_TOOT` (same as `--toot`) - -### skaffold completion SHELL - -Output shell completion for the given shell (bash or zsh) - -``` -Usage: - skaffold completion SHELL - -Global Flags: - --color int Specify the default output color in ANSI escape codes (default 34) - -v, --verbosity string Log level (debug, info, warn, error, fatal, panic) (default "warning") - - -``` - -### skaffold config - -A set of commands for interacting with the Skaffold config. - -``` -Usage: - skaffold config [command] - -Available Commands: - list List all values set in the global Skaffold config - set Set a value in the global Skaffold config - unset Unset a value in the global Skaffold config - -Global Flags: - --color int Specify the default output color in ANSI escape codes (default 34) - -v, --verbosity string Log level (debug, info, warn, error, fatal, panic) (default "warning") - -Use "skaffold config [command] --help" for more information about a command. - - -``` - -### skaffold config list - -List all values set in the global Skaffold config - -``` -Usage: - skaffold config list - -Flags: - -a, --all Show values for all kubecontexts - -c, --config string Path to Skaffold config - -k, --kube-context string Kubectl context to set values against - -Global Flags: - --color int Specify the default output color in ANSI escape codes (default 34) - -v, --verbosity string Log level (debug, info, warn, error, fatal, panic) (default "warning") - - -``` -Env vars: - -* `SKAFFOLD_ALL` (same as `--all`) -* `SKAFFOLD_CONFIG` (same as `--config`) -* `SKAFFOLD_KUBE_CONTEXT` (same as `--kube-context`) - -### skaffold config set - -Set a value in the global Skaffold config - -``` -Usage: - skaffold config set - -Flags: - -c, --config string Path to Skaffold config - -g, --global Set value for global config - -k, --kube-context string Kubectl context to set values against - -Global Flags: - --color int Specify the default output color in ANSI escape codes (default 34) - -v, --verbosity string Log level (debug, info, warn, error, fatal, panic) (default "warning") - - -``` -Env vars: - -* `SKAFFOLD_CONFIG` (same as `--config`) -* `SKAFFOLD_GLOBAL` (same as `--global`) -* `SKAFFOLD_KUBE_CONTEXT` (same as `--kube-context`) - -### skaffold config unset - -Unset a value in the global Skaffold config - -``` -Usage: - skaffold config unset - -Flags: - -c, --config string Path to Skaffold config - -g, --global Set value for global config - -k, --kube-context string Kubectl context to set values against - -Global Flags: - --color int Specify the default output color in ANSI escape codes (default 34) - -v, --verbosity string Log level (debug, info, warn, error, fatal, panic) (default "warning") - - -``` -Env vars: - -* `SKAFFOLD_CONFIG` (same as `--config`) -* `SKAFFOLD_GLOBAL` (same as `--global`) -* `SKAFFOLD_KUBE_CONTEXT` (same as `--kube-context`) - -### skaffold debug - -Runs a pipeline file in debug mode - -``` -Usage: - skaffold debug - -Flags: - --cache-artifacts Set to true to enable caching of artifacts. - --cache-file string Specify the location of the cache file (default $HOME/.skaffold/cache) - --cleanup Delete deployments after dev mode is interrupted (default true) - -d, --default-repo string Default repository value (overrides global config) - --enable-rpc skaffold dev Enable gRPC for exposing Skaffold events (true by default for skaffold dev) - -f, --filename string Filename or URL to the pipeline file (default "skaffold.yaml") - --insecure-registry stringArray Target registries for built images which are not secure - -l, --label stringArray Add custom labels to deployed objects. Set multiple times for multiple labels - -n, --namespace string Run deployments in the specified namespace - --no-prune Skip removing images and containers built by Skaffold - --port-forward Port-forward exposed container ports within pods (default true) - -p, --profile stringArray Activate profiles by name - --rpc-http-port int tcp port to expose event REST API over HTTP (default 50052) - --rpc-port int tcp port to expose event API (default 50051) - --skip-tests Whether to skip the tests after building - --tail Stream logs from deployed objects (default true) - --toot Emit a terminal beep after the deploy is complete - -Global Flags: - --color int Specify the default output color in ANSI escape codes (default 34) - -v, --verbosity string Log level (debug, info, warn, error, fatal, panic) (default "warning") - - -``` -Env vars: - -* `SKAFFOLD_CACHE_ARTIFACTS` (same as `--cache-artifacts`) -* `SKAFFOLD_CACHE_FILE` (same as `--cache-file`) -* `SKAFFOLD_CLEANUP` (same as `--cleanup`) -* `SKAFFOLD_DEFAULT_REPO` (same as `--default-repo`) -* `SKAFFOLD_ENABLE_RPC` (same as `--enable-rpc`) -* `SKAFFOLD_FILENAME` (same as `--filename`) -* `SKAFFOLD_INSECURE_REGISTRY` (same as `--insecure-registry`) -* `SKAFFOLD_LABEL` (same as `--label`) -* `SKAFFOLD_NAMESPACE` (same as `--namespace`) -* `SKAFFOLD_NO_PRUNE` (same as `--no-prune`) -* `SKAFFOLD_PORT_FORWARD` (same as `--port-forward`) -* `SKAFFOLD_PROFILE` (same as `--profile`) -* `SKAFFOLD_RPC_HTTP_PORT` (same as `--rpc-http-port`) -* `SKAFFOLD_RPC_PORT` (same as `--rpc-port`) -* `SKAFFOLD_SKIP_TESTS` (same as `--skip-tests`) -* `SKAFFOLD_TAIL` (same as `--tail`) -* `SKAFFOLD_TOOT` (same as `--toot`) - -### skaffold delete - -Delete the deployed resources - -``` -Usage: - skaffold delete - -Flags: - -d, --default-repo string Default repository value (overrides global config) - --enable-rpc skaffold dev Enable gRPC for exposing Skaffold events (true by default for skaffold dev) - -f, --filename string Filename or URL to the pipeline file (default "skaffold.yaml") - --insecure-registry stringArray Target registries for built images which are not secure - -n, --namespace string Run deployments in the specified namespace - --no-prune Skip removing images and containers built by Skaffold - -p, --profile stringArray Activate profiles by name - --rpc-http-port int tcp port to expose event REST API over HTTP (default 50052) - --rpc-port int tcp port to expose event API (default 50051) - --toot Emit a terminal beep after the deploy is complete - -Global Flags: - --color int Specify the default output color in ANSI escape codes (default 34) - -v, --verbosity string Log level (debug, info, warn, error, fatal, panic) (default "warning") - - -``` -Env vars: - -* `SKAFFOLD_DEFAULT_REPO` (same as `--default-repo`) -* `SKAFFOLD_ENABLE_RPC` (same as `--enable-rpc`) -* `SKAFFOLD_FILENAME` (same as `--filename`) -* `SKAFFOLD_INSECURE_REGISTRY` (same as `--insecure-registry`) -* `SKAFFOLD_NAMESPACE` (same as `--namespace`) -* `SKAFFOLD_NO_PRUNE` (same as `--no-prune`) -* `SKAFFOLD_PROFILE` (same as `--profile`) -* `SKAFFOLD_RPC_HTTP_PORT` (same as `--rpc-http-port`) -* `SKAFFOLD_RPC_PORT` (same as `--rpc-port`) -* `SKAFFOLD_TOOT` (same as `--toot`) - -### skaffold deploy - -Deploys the artifacts - -``` -Usage: - skaffold deploy - -Flags: - --cache-artifacts Set to true to enable caching of artifacts. - --cache-file string Specify the location of the cache file (default $HOME/.skaffold/cache) - -d, --default-repo string Default repository value (overrides global config) - --enable-rpc skaffold dev Enable gRPC for exposing Skaffold events (true by default for skaffold dev) - -f, --filename string Filename or URL to the pipeline file (default "skaffold.yaml") - --force Recreate kubernetes resources if necessary for deployment (default: false, warning: might cause downtime!) - --images strings A list of pre-built images to deploy - --insecure-registry stringArray Target registries for built images which are not secure - -l, --label stringArray Add custom labels to deployed objects. Set multiple times for multiple labels. - -n, --namespace string Run deployments in the specified namespace - --no-prune Skip removing images and containers built by Skaffold - -p, --profile stringArray Activate profiles by name - --rpc-http-port int tcp port to expose event REST API over HTTP (default 50052) - --rpc-port int tcp port to expose event API (default 50051) - --skip-tests Whether to skip the tests after building - --tail Stream logs from deployed objects - --toot Emit a terminal beep after the deploy is complete - -Global Flags: - --color int Specify the default output color in ANSI escape codes (default 34) - -v, --verbosity string Log level (debug, info, warn, error, fatal, panic) (default "warning") - - -``` -Env vars: - -* `SKAFFOLD_CACHE_ARTIFACTS` (same as `--cache-artifacts`) -* `SKAFFOLD_CACHE_FILE` (same as `--cache-file`) -* `SKAFFOLD_DEFAULT_REPO` (same as `--default-repo`) -* `SKAFFOLD_ENABLE_RPC` (same as `--enable-rpc`) -* `SKAFFOLD_FILENAME` (same as `--filename`) -* `SKAFFOLD_FORCE` (same as `--force`) -* `SKAFFOLD_IMAGES` (same as `--images`) -* `SKAFFOLD_INSECURE_REGISTRY` (same as `--insecure-registry`) -* `SKAFFOLD_LABEL` (same as `--label`) -* `SKAFFOLD_NAMESPACE` (same as `--namespace`) -* `SKAFFOLD_NO_PRUNE` (same as `--no-prune`) -* `SKAFFOLD_PROFILE` (same as `--profile`) -* `SKAFFOLD_RPC_HTTP_PORT` (same as `--rpc-http-port`) -* `SKAFFOLD_RPC_PORT` (same as `--rpc-port`) -* `SKAFFOLD_SKIP_TESTS` (same as `--skip-tests`) -* `SKAFFOLD_TAIL` (same as `--tail`) -* `SKAFFOLD_TOOT` (same as `--toot`) - -### skaffold dev - -Runs a pipeline file in development mode - -``` -Usage: - skaffold dev - -Flags: - --cache-artifacts Set to true to enable caching of artifacts. - --cache-file string Specify the location of the cache file (default $HOME/.skaffold/cache) - --cleanup Delete deployments after dev mode is interrupted (default true) - -d, --default-repo string Default repository value (overrides global config) - --enable-rpc skaffold dev Enable gRPC for exposing Skaffold events (true by default for skaffold dev) - -f, --filename string Filename or URL to the pipeline file (default "skaffold.yaml") - --insecure-registry stringArray Target registries for built images which are not secure - -l, --label stringArray Add custom labels to deployed objects. Set multiple times for multiple labels - -n, --namespace string Run deployments in the specified namespace - --no-prune Skip removing images and containers built by Skaffold - --port-forward Port-forward exposed container ports within pods (default true) - -p, --profile stringArray Activate profiles by name - --rpc-http-port int tcp port to expose event REST API over HTTP (default 50052) - --rpc-port int tcp port to expose event API (default 50051) - --skip-tests Whether to skip the tests after building - --tail Stream logs from deployed objects (default true) - --toot Emit a terminal beep after the deploy is complete - --trigger string How are changes detected? (polling, manual or notify) (default "polling") - -w, --watch-image stringArray Choose which artifacts to watch. Artifacts with image names that contain the expression will be watched only. Default is to watch sources for all artifacts - -i, --watch-poll-interval int Interval (in ms) between two checks for file changes (default 1000) - -Global Flags: - --color int Specify the default output color in ANSI escape codes (default 34) - -v, --verbosity string Log level (debug, info, warn, error, fatal, panic) (default "warning") - - -``` -Env vars: - -* `SKAFFOLD_CACHE_ARTIFACTS` (same as `--cache-artifacts`) -* `SKAFFOLD_CACHE_FILE` (same as `--cache-file`) -* `SKAFFOLD_CLEANUP` (same as `--cleanup`) -* `SKAFFOLD_DEFAULT_REPO` (same as `--default-repo`) -* `SKAFFOLD_ENABLE_RPC` (same as `--enable-rpc`) -* `SKAFFOLD_FILENAME` (same as `--filename`) -* `SKAFFOLD_INSECURE_REGISTRY` (same as `--insecure-registry`) -* `SKAFFOLD_LABEL` (same as `--label`) -* `SKAFFOLD_NAMESPACE` (same as `--namespace`) -* `SKAFFOLD_NO_PRUNE` (same as `--no-prune`) -* `SKAFFOLD_PORT_FORWARD` (same as `--port-forward`) -* `SKAFFOLD_PROFILE` (same as `--profile`) -* `SKAFFOLD_RPC_HTTP_PORT` (same as `--rpc-http-port`) -* `SKAFFOLD_RPC_PORT` (same as `--rpc-port`) -* `SKAFFOLD_SKIP_TESTS` (same as `--skip-tests`) -* `SKAFFOLD_TAIL` (same as `--tail`) -* `SKAFFOLD_TOOT` (same as `--toot`) -* `SKAFFOLD_TRIGGER` (same as `--trigger`) -* `SKAFFOLD_WATCH_IMAGE` (same as `--watch-image`) -* `SKAFFOLD_WATCH_POLL_INTERVAL` (same as `--watch-poll-interval`) - -### skaffold diagnose - -Run a diagnostic on Skaffold - -``` -Usage: - skaffold diagnose - -Flags: - -f, --filename string Filename or URL to the pipeline file (default "skaffold.yaml") - -p, --profile stringArray Activate profiles by name - -Global Flags: - --color int Specify the default output color in ANSI escape codes (default 34) - -v, --verbosity string Log level (debug, info, warn, error, fatal, panic) (default "warning") - - -``` -Env vars: - -* `SKAFFOLD_FILENAME` (same as `--filename`) -* `SKAFFOLD_PROFILE` (same as `--profile`) - -### skaffold fix - -Converts old Skaffold config to newest schema version - -``` -Usage: - skaffold fix - -Flags: - -f, --filename string Filename or URL to the pipeline file (default "skaffold.yaml") - --overwrite Overwrite original config with fixed config - -Global Flags: - --color int Specify the default output color in ANSI escape codes (default 34) - -v, --verbosity string Log level (debug, info, warn, error, fatal, panic) (default "warning") - - -``` -Env vars: - -* `SKAFFOLD_FILENAME` (same as `--filename`) -* `SKAFFOLD_OVERWRITE` (same as `--overwrite`) - -### skaffold init - -Automatically generate Skaffold configuration for deploying an application - -``` -Usage: - skaffold init - -Flags: - --analyze Print all discoverable Dockerfiles and images in JSON format to stdout - -a, --artifact stringArray '='-delimited dockerfile/image pair to generate build artifact - (example: --artifact=/web/Dockerfile.web=gcr.io/web-project/image) - --compose-file string Initialize from a docker-compose file - -f, --filename string Filename or URL to the pipeline file (default "skaffold.yaml") - --force Force the generation of the Skaffold config - --skip-build Skip generating build artifacts in Skaffold config - -Global Flags: - --color int Specify the default output color in ANSI escape codes (default 34) - -v, --verbosity string Log level (debug, info, warn, error, fatal, panic) (default "warning") - - -``` -Env vars: - -* `SKAFFOLD_ANALYZE` (same as `--analyze`) -* `SKAFFOLD_ARTIFACT` (same as `--artifact`) -* `SKAFFOLD_COMPOSE_FILE` (same as `--compose-file`) -* `SKAFFOLD_FILENAME` (same as `--filename`) -* `SKAFFOLD_FORCE` (same as `--force`) -* `SKAFFOLD_SKIP_BUILD` (same as `--skip-build`) - -### skaffold run - -Runs a pipeline file - -``` -Usage: - skaffold run - -Flags: - --cache-artifacts Set to true to enable caching of artifacts. - --cache-file string Specify the location of the cache file (default $HOME/.skaffold/cache) - -d, --default-repo string Default repository value (overrides global config) - --enable-rpc skaffold dev Enable gRPC for exposing Skaffold events (true by default for skaffold dev) - -f, --filename string Filename or URL to the pipeline file (default "skaffold.yaml") - --force Recreate kubernetes resources if necessary for deployment (default: false, warning: might cause downtime!) - --insecure-registry stringArray Target registries for built images which are not secure - -l, --label stringArray Add custom labels to deployed objects. Set multiple times for multiple labels. - -n, --namespace string Run deployments in the specified namespace - --no-prune Skip removing images and containers built by Skaffold - -p, --profile stringArray Activate profiles by name - --rpc-http-port int tcp port to expose event REST API over HTTP (default 50052) - --rpc-port int tcp port to expose event API (default 50051) - --skip-tests Whether to skip the tests after building - -t, --tag string The optional custom tag to use for images which overrides the current Tagger configuration - --tail Stream logs from deployed objects - --toot Emit a terminal beep after the deploy is complete - -Global Flags: - --color int Specify the default output color in ANSI escape codes (default 34) - -v, --verbosity string Log level (debug, info, warn, error, fatal, panic) (default "warning") - - -``` -Env vars: - -* `SKAFFOLD_CACHE_ARTIFACTS` (same as `--cache-artifacts`) -* `SKAFFOLD_CACHE_FILE` (same as `--cache-file`) -* `SKAFFOLD_DEFAULT_REPO` (same as `--default-repo`) -* `SKAFFOLD_ENABLE_RPC` (same as `--enable-rpc`) -* `SKAFFOLD_FILENAME` (same as `--filename`) -* `SKAFFOLD_FORCE` (same as `--force`) -* `SKAFFOLD_INSECURE_REGISTRY` (same as `--insecure-registry`) -* `SKAFFOLD_LABEL` (same as `--label`) -* `SKAFFOLD_NAMESPACE` (same as `--namespace`) -* `SKAFFOLD_NO_PRUNE` (same as `--no-prune`) -* `SKAFFOLD_PROFILE` (same as `--profile`) -* `SKAFFOLD_RPC_HTTP_PORT` (same as `--rpc-http-port`) -* `SKAFFOLD_RPC_PORT` (same as `--rpc-port`) -* `SKAFFOLD_SKIP_TESTS` (same as `--skip-tests`) -* `SKAFFOLD_TAG` (same as `--tag`) -* `SKAFFOLD_TAIL` (same as `--tail`) -* `SKAFFOLD_TOOT` (same as `--toot`) - -### skaffold version - -Print the version information - -``` -Usage: - skaffold version - -Flags: - -o, --output *flags.TemplateFlag Format output with go-template. For full struct documentation, see https://godoc.org/github.com/GoogleContainerTools/skaffold/pkg/skaffold/version#Info (default {{.Version}} - ) - -Global Flags: - --color int Specify the default output color in ANSI escape codes (default 34) - -v, --verbosity string Log level (debug, info, warn, error, fatal, panic) (default "warning") - - -``` -Env vars: - -* `SKAFFOLD_OUTPUT` (same as `--output`) diff --git a/pkg/skaffold/schema/v1beta8/upgrade.go b/pkg/skaffold/schema/v1beta8/upgrade.go index a89bcd019f2..002e44b8910 100644 --- a/pkg/skaffold/schema/v1beta8/upgrade.go +++ b/pkg/skaffold/schema/v1beta8/upgrade.go @@ -45,13 +45,42 @@ func (config *SkaffoldConfig) Upgrade() (util.VersionedConfig, error) { } } + for i, p := range config.Profiles { + if err := updateBuild(&p.Pipeline.Build, &newProfiles[i].Pipeline.Build); err != nil { + return nil, errors.Wrapf(err, "updating build for profile %s", p.Name) + } + } + // convert Build (should be same) var newBuild latest.BuildConfig if err := pkgutil.CloneThroughJSON(config.Build, &newBuild); err != nil { return nil, errors.Wrap(err, "converting new build") } - for i, a := range config.Build.Artifacts { + if err := updateBuild(&config.Build, &newBuild); err != nil { + return nil, errors.Wrap(err, "updating build") + } + + // convert Test (should be the same) + var newTest []*latest.TestCase + if err := pkgutil.CloneThroughJSON(config.Test, &newTest); err != nil { + return nil, errors.Wrap(err, "converting new test") + } + + return &latest.SkaffoldConfig{ + APIVersion: latest.Version, + Kind: config.Kind, + Pipeline: latest.Pipeline{ + Build: newBuild, + Test: newTest, + Deploy: newDeploy, + }, + Profiles: newProfiles, + }, nil +} + +func updateBuild(config *BuildConfig, newBuild *latest.BuildConfig) error { + for i, a := range config.Artifacts { if a.BuilderPlugin == nil { continue } @@ -59,10 +88,10 @@ func (config *SkaffoldConfig) Upgrade() (util.VersionedConfig, error) { var ba *latest.BazelArtifact contents, err := yaml.Marshal(a.BuilderPlugin.Properties) if err != nil { - return nil, errors.Wrap(err, "unmarshalling properties") + return errors.Wrap(err, "unmarshalling properties") } if err := yaml.Unmarshal(contents, &ba); err != nil { - return nil, errors.Wrap(err, "unmarshalling bazel artifact") + return errors.Wrap(err, "unmarshalling bazel artifact") } newBuild.Artifacts[i].BazelArtifact = ba } @@ -71,29 +100,38 @@ func (config *SkaffoldConfig) Upgrade() (util.VersionedConfig, error) { var da *latest.DockerArtifact contents, err := yaml.Marshal(a.BuilderPlugin.Properties) if err != nil { - return nil, errors.Wrap(err, "unmarshalling properties") + return errors.Wrap(err, "unmarshalling properties") } if err := yaml.Unmarshal(contents, &da); err != nil { - return nil, errors.Wrap(err, "unmarshalling bazel artifact") + return errors.Wrap(err, "unmarshalling bazel artifact") } newBuild.Artifacts[i].DockerArtifact = da } } - // convert Test (should be the same) - var newTest []*latest.TestCase - if err := pkgutil.CloneThroughJSON(config.Test, &newTest); err != nil { - return nil, errors.Wrap(err, "converting new test") + if c := config.ExecutionEnvironment; c != nil { + if c.Name == "googleCloudBuild" { + var gcb *latest.GoogleCloudBuild + contents, err := yaml.Marshal(c.Properties) + if err != nil { + return errors.Wrap(err, "unmarshalling properties") + } + if err := yaml.Unmarshal(contents, &gcb); err != nil { + return errors.Wrap(err, "unmarshalling bazel artifact") + } + newBuild.GoogleCloudBuild = gcb + } + if c.Name == "local" { + var local *latest.LocalBuild + contents, err := yaml.Marshal(c.Properties) + if err != nil { + return errors.Wrap(err, "unmarshalling properties") + } + if err := yaml.Unmarshal(contents, &local); err != nil { + return errors.Wrap(err, "unmarshalling bazel artifact") + } + newBuild.LocalBuild = local + } } - - return &latest.SkaffoldConfig{ - APIVersion: latest.Version, - Kind: config.Kind, - Pipeline: latest.Pipeline{ - Build: newBuild, - Test: newTest, - Deploy: newDeploy, - }, - Profiles: newProfiles, - }, nil + return nil } diff --git a/pkg/skaffold/schema/v1beta8/upgrade_test.go b/pkg/skaffold/schema/v1beta8/upgrade_test.go index 3389d327041..b4b2c4e5529 100644 --- a/pkg/skaffold/schema/v1beta8/upgrade_test.go +++ b/pkg/skaffold/schema/v1beta8/upgrade_test.go @@ -39,6 +39,10 @@ build: name: bazel properties: target: //mytarget + executionEnvironment: + name: googleCloudBuild + properties: + projectId: test-project test: - image: gcr.io/k8s-skaffold/skaffold-example structureTests: @@ -67,6 +71,22 @@ profiles: kubectl: manifests: - k8s-* + - name: test local + build: + artifacts: + - image: gcr.io/k8s-skaffold/skaffold-example + plugin: + name: docker + properties: + dockerfile: path/to/Dockerfile + executionEnvironment: + name: local + properties: + push: false + deploy: + kubectl: + manifests: + - k8s-* ` expected := `apiVersion: skaffold/v1beta9 kind: Config @@ -78,6 +98,8 @@ build: - image: gcr.io/k8s-skaffold/bazel bazel: target: //mytarget + googleCloudBuild: + projectId: test-project test: - image: gcr.io/k8s-skaffold/skaffold-example structureTests: @@ -106,6 +128,18 @@ profiles: kubectl: manifests: - k8s-* + - name: test local + build: + artifacts: + - image: gcr.io/k8s-skaffold/skaffold-example + docker: + dockerfile: path/to/Dockerfile + local: + push: false + deploy: + kubectl: + manifests: + - k8s-* ` verifyUpgrade(t, yaml, expected) } From 89bbb7dafcee0793996498ca68fdc80553581b12 Mon Sep 17 00:00:00 2001 From: Priya Wadhwa Date: Thu, 25 Apr 2019 17:23:07 -0700 Subject: [PATCH 3/3] run check-docs --- docs/content/en/docs/references/cli/_index.md | 520 ++++++++++++++++++ 1 file changed, 520 insertions(+) diff --git a/docs/content/en/docs/references/cli/_index.md b/docs/content/en/docs/references/cli/_index.md index 11102331b19..cbd1bc412db 100644 --- a/docs/content/en/docs/references/cli/_index.md +++ b/docs/content/en/docs/references/cli/_index.md @@ -53,3 +53,523 @@ Utilities: To edit this file above edit index_header - the rest of the file is autogenerated by cmd/skaffold/man ****** --> + +### skaffold build + +Builds the artifacts + +``` +Usage: + skaffold build + +Flags: + -b, --build-image stringArray Choose which artifacts to build. Artifacts with image names that contain the expression will be built only. Default is to build sources for all artifacts + --cache-artifacts Set to true to enable caching of artifacts. + --cache-file string Specify the location of the cache file (default $HOME/.skaffold/cache) + -d, --default-repo string Default repository value (overrides global config) + --enable-rpc skaffold dev Enable gRPC for exposing Skaffold events (true by default for skaffold dev) + -f, --filename string Filename or URL to the pipeline file (default "skaffold.yaml") + --insecure-registry stringArray Target registries for built images which are not secure + -n, --namespace string Run deployments in the specified namespace + --no-prune Skip removing images and containers built by Skaffold + -o, --output *flags.TemplateFlag Used in conjuction with --quiet flag. Format output with go-template. For full struct documentation, see https://godoc.org/github.com/GoogleContainerTools/skaffold/cmd/skaffold/app/cmd#BuildOutput (default {{.}}) + -p, --profile stringArray Activate profiles by name + -q, --quiet Suppress the build output and print image built on success. See --output to format output. + --rpc-http-port int tcp port to expose event REST API over HTTP (default 50052) + --rpc-port int tcp port to expose event API (default 50051) + --skip-tests Whether to skip the tests after building + --toot Emit a terminal beep after the deploy is complete + +Global Flags: + --color int Specify the default output color in ANSI escape codes (default 34) + -v, --verbosity string Log level (debug, info, warn, error, fatal, panic) (default "warning") + + +``` +Env vars: + +* `SKAFFOLD_BUILD_IMAGE` (same as `--build-image`) +* `SKAFFOLD_CACHE_ARTIFACTS` (same as `--cache-artifacts`) +* `SKAFFOLD_CACHE_FILE` (same as `--cache-file`) +* `SKAFFOLD_DEFAULT_REPO` (same as `--default-repo`) +* `SKAFFOLD_ENABLE_RPC` (same as `--enable-rpc`) +* `SKAFFOLD_FILENAME` (same as `--filename`) +* `SKAFFOLD_INSECURE_REGISTRY` (same as `--insecure-registry`) +* `SKAFFOLD_NAMESPACE` (same as `--namespace`) +* `SKAFFOLD_NO_PRUNE` (same as `--no-prune`) +* `SKAFFOLD_OUTPUT` (same as `--output`) +* `SKAFFOLD_PROFILE` (same as `--profile`) +* `SKAFFOLD_QUIET` (same as `--quiet`) +* `SKAFFOLD_RPC_HTTP_PORT` (same as `--rpc-http-port`) +* `SKAFFOLD_RPC_PORT` (same as `--rpc-port`) +* `SKAFFOLD_SKIP_TESTS` (same as `--skip-tests`) +* `SKAFFOLD_TOOT` (same as `--toot`) + +### skaffold completion SHELL + +Output shell completion for the given shell (bash or zsh) + +``` +Usage: + skaffold completion SHELL + +Global Flags: + --color int Specify the default output color in ANSI escape codes (default 34) + -v, --verbosity string Log level (debug, info, warn, error, fatal, panic) (default "warning") + + +``` + +### skaffold config + +A set of commands for interacting with the Skaffold config. + +``` +Usage: + skaffold config [command] + +Available Commands: + list List all values set in the global Skaffold config + set Set a value in the global Skaffold config + unset Unset a value in the global Skaffold config + +Global Flags: + --color int Specify the default output color in ANSI escape codes (default 34) + -v, --verbosity string Log level (debug, info, warn, error, fatal, panic) (default "warning") + +Use "skaffold config [command] --help" for more information about a command. + + +``` + +### skaffold config list + +List all values set in the global Skaffold config + +``` +Usage: + skaffold config list + +Flags: + -a, --all Show values for all kubecontexts + -c, --config string Path to Skaffold config + -k, --kube-context string Kubectl context to set values against + +Global Flags: + --color int Specify the default output color in ANSI escape codes (default 34) + -v, --verbosity string Log level (debug, info, warn, error, fatal, panic) (default "warning") + + +``` +Env vars: + +* `SKAFFOLD_ALL` (same as `--all`) +* `SKAFFOLD_CONFIG` (same as `--config`) +* `SKAFFOLD_KUBE_CONTEXT` (same as `--kube-context`) + +### skaffold config set + +Set a value in the global Skaffold config + +``` +Usage: + skaffold config set + +Flags: + -c, --config string Path to Skaffold config + -g, --global Set value for global config + -k, --kube-context string Kubectl context to set values against + +Global Flags: + --color int Specify the default output color in ANSI escape codes (default 34) + -v, --verbosity string Log level (debug, info, warn, error, fatal, panic) (default "warning") + + +``` +Env vars: + +* `SKAFFOLD_CONFIG` (same as `--config`) +* `SKAFFOLD_GLOBAL` (same as `--global`) +* `SKAFFOLD_KUBE_CONTEXT` (same as `--kube-context`) + +### skaffold config unset + +Unset a value in the global Skaffold config + +``` +Usage: + skaffold config unset + +Flags: + -c, --config string Path to Skaffold config + -g, --global Set value for global config + -k, --kube-context string Kubectl context to set values against + +Global Flags: + --color int Specify the default output color in ANSI escape codes (default 34) + -v, --verbosity string Log level (debug, info, warn, error, fatal, panic) (default "warning") + + +``` +Env vars: + +* `SKAFFOLD_CONFIG` (same as `--config`) +* `SKAFFOLD_GLOBAL` (same as `--global`) +* `SKAFFOLD_KUBE_CONTEXT` (same as `--kube-context`) + +### skaffold debug + +Runs a pipeline file in debug mode + +``` +Usage: + skaffold debug + +Flags: + --cache-artifacts Set to true to enable caching of artifacts. + --cache-file string Specify the location of the cache file (default $HOME/.skaffold/cache) + --cleanup Delete deployments after dev mode is interrupted (default true) + -d, --default-repo string Default repository value (overrides global config) + --enable-rpc skaffold dev Enable gRPC for exposing Skaffold events (true by default for skaffold dev) + -f, --filename string Filename or URL to the pipeline file (default "skaffold.yaml") + --insecure-registry stringArray Target registries for built images which are not secure + -l, --label stringArray Add custom labels to deployed objects. Set multiple times for multiple labels + -n, --namespace string Run deployments in the specified namespace + --no-prune Skip removing images and containers built by Skaffold + --port-forward Port-forward exposed container ports within pods (default true) + -p, --profile stringArray Activate profiles by name + --rpc-http-port int tcp port to expose event REST API over HTTP (default 50052) + --rpc-port int tcp port to expose event API (default 50051) + --skip-tests Whether to skip the tests after building + --tail Stream logs from deployed objects (default true) + --toot Emit a terminal beep after the deploy is complete + +Global Flags: + --color int Specify the default output color in ANSI escape codes (default 34) + -v, --verbosity string Log level (debug, info, warn, error, fatal, panic) (default "warning") + + +``` +Env vars: + +* `SKAFFOLD_CACHE_ARTIFACTS` (same as `--cache-artifacts`) +* `SKAFFOLD_CACHE_FILE` (same as `--cache-file`) +* `SKAFFOLD_CLEANUP` (same as `--cleanup`) +* `SKAFFOLD_DEFAULT_REPO` (same as `--default-repo`) +* `SKAFFOLD_ENABLE_RPC` (same as `--enable-rpc`) +* `SKAFFOLD_FILENAME` (same as `--filename`) +* `SKAFFOLD_INSECURE_REGISTRY` (same as `--insecure-registry`) +* `SKAFFOLD_LABEL` (same as `--label`) +* `SKAFFOLD_NAMESPACE` (same as `--namespace`) +* `SKAFFOLD_NO_PRUNE` (same as `--no-prune`) +* `SKAFFOLD_PORT_FORWARD` (same as `--port-forward`) +* `SKAFFOLD_PROFILE` (same as `--profile`) +* `SKAFFOLD_RPC_HTTP_PORT` (same as `--rpc-http-port`) +* `SKAFFOLD_RPC_PORT` (same as `--rpc-port`) +* `SKAFFOLD_SKIP_TESTS` (same as `--skip-tests`) +* `SKAFFOLD_TAIL` (same as `--tail`) +* `SKAFFOLD_TOOT` (same as `--toot`) + +### skaffold delete + +Delete the deployed resources + +``` +Usage: + skaffold delete + +Flags: + -d, --default-repo string Default repository value (overrides global config) + --enable-rpc skaffold dev Enable gRPC for exposing Skaffold events (true by default for skaffold dev) + -f, --filename string Filename or URL to the pipeline file (default "skaffold.yaml") + --insecure-registry stringArray Target registries for built images which are not secure + -n, --namespace string Run deployments in the specified namespace + --no-prune Skip removing images and containers built by Skaffold + -p, --profile stringArray Activate profiles by name + --rpc-http-port int tcp port to expose event REST API over HTTP (default 50052) + --rpc-port int tcp port to expose event API (default 50051) + --toot Emit a terminal beep after the deploy is complete + +Global Flags: + --color int Specify the default output color in ANSI escape codes (default 34) + -v, --verbosity string Log level (debug, info, warn, error, fatal, panic) (default "warning") + + +``` +Env vars: + +* `SKAFFOLD_DEFAULT_REPO` (same as `--default-repo`) +* `SKAFFOLD_ENABLE_RPC` (same as `--enable-rpc`) +* `SKAFFOLD_FILENAME` (same as `--filename`) +* `SKAFFOLD_INSECURE_REGISTRY` (same as `--insecure-registry`) +* `SKAFFOLD_NAMESPACE` (same as `--namespace`) +* `SKAFFOLD_NO_PRUNE` (same as `--no-prune`) +* `SKAFFOLD_PROFILE` (same as `--profile`) +* `SKAFFOLD_RPC_HTTP_PORT` (same as `--rpc-http-port`) +* `SKAFFOLD_RPC_PORT` (same as `--rpc-port`) +* `SKAFFOLD_TOOT` (same as `--toot`) + +### skaffold deploy + +Deploys the artifacts + +``` +Usage: + skaffold deploy + +Flags: + --cache-artifacts Set to true to enable caching of artifacts. + --cache-file string Specify the location of the cache file (default $HOME/.skaffold/cache) + -d, --default-repo string Default repository value (overrides global config) + --enable-rpc skaffold dev Enable gRPC for exposing Skaffold events (true by default for skaffold dev) + -f, --filename string Filename or URL to the pipeline file (default "skaffold.yaml") + --force Recreate kubernetes resources if necessary for deployment (default: false, warning: might cause downtime!) + --images strings A list of pre-built images to deploy + --insecure-registry stringArray Target registries for built images which are not secure + -l, --label stringArray Add custom labels to deployed objects. Set multiple times for multiple labels. + -n, --namespace string Run deployments in the specified namespace + --no-prune Skip removing images and containers built by Skaffold + -p, --profile stringArray Activate profiles by name + --rpc-http-port int tcp port to expose event REST API over HTTP (default 50052) + --rpc-port int tcp port to expose event API (default 50051) + --skip-tests Whether to skip the tests after building + --tail Stream logs from deployed objects + --toot Emit a terminal beep after the deploy is complete + +Global Flags: + --color int Specify the default output color in ANSI escape codes (default 34) + -v, --verbosity string Log level (debug, info, warn, error, fatal, panic) (default "warning") + + +``` +Env vars: + +* `SKAFFOLD_CACHE_ARTIFACTS` (same as `--cache-artifacts`) +* `SKAFFOLD_CACHE_FILE` (same as `--cache-file`) +* `SKAFFOLD_DEFAULT_REPO` (same as `--default-repo`) +* `SKAFFOLD_ENABLE_RPC` (same as `--enable-rpc`) +* `SKAFFOLD_FILENAME` (same as `--filename`) +* `SKAFFOLD_FORCE` (same as `--force`) +* `SKAFFOLD_IMAGES` (same as `--images`) +* `SKAFFOLD_INSECURE_REGISTRY` (same as `--insecure-registry`) +* `SKAFFOLD_LABEL` (same as `--label`) +* `SKAFFOLD_NAMESPACE` (same as `--namespace`) +* `SKAFFOLD_NO_PRUNE` (same as `--no-prune`) +* `SKAFFOLD_PROFILE` (same as `--profile`) +* `SKAFFOLD_RPC_HTTP_PORT` (same as `--rpc-http-port`) +* `SKAFFOLD_RPC_PORT` (same as `--rpc-port`) +* `SKAFFOLD_SKIP_TESTS` (same as `--skip-tests`) +* `SKAFFOLD_TAIL` (same as `--tail`) +* `SKAFFOLD_TOOT` (same as `--toot`) + +### skaffold dev + +Runs a pipeline file in development mode + +``` +Usage: + skaffold dev + +Flags: + --cache-artifacts Set to true to enable caching of artifacts. + --cache-file string Specify the location of the cache file (default $HOME/.skaffold/cache) + --cleanup Delete deployments after dev mode is interrupted (default true) + -d, --default-repo string Default repository value (overrides global config) + --enable-rpc skaffold dev Enable gRPC for exposing Skaffold events (true by default for skaffold dev) + -f, --filename string Filename or URL to the pipeline file (default "skaffold.yaml") + --insecure-registry stringArray Target registries for built images which are not secure + -l, --label stringArray Add custom labels to deployed objects. Set multiple times for multiple labels + -n, --namespace string Run deployments in the specified namespace + --no-prune Skip removing images and containers built by Skaffold + --port-forward Port-forward exposed container ports within pods (default true) + -p, --profile stringArray Activate profiles by name + --rpc-http-port int tcp port to expose event REST API over HTTP (default 50052) + --rpc-port int tcp port to expose event API (default 50051) + --skip-tests Whether to skip the tests after building + --tail Stream logs from deployed objects (default true) + --toot Emit a terminal beep after the deploy is complete + --trigger string How are changes detected? (polling, manual or notify) (default "polling") + -w, --watch-image stringArray Choose which artifacts to watch. Artifacts with image names that contain the expression will be watched only. Default is to watch sources for all artifacts + -i, --watch-poll-interval int Interval (in ms) between two checks for file changes (default 1000) + +Global Flags: + --color int Specify the default output color in ANSI escape codes (default 34) + -v, --verbosity string Log level (debug, info, warn, error, fatal, panic) (default "warning") + + +``` +Env vars: + +* `SKAFFOLD_CACHE_ARTIFACTS` (same as `--cache-artifacts`) +* `SKAFFOLD_CACHE_FILE` (same as `--cache-file`) +* `SKAFFOLD_CLEANUP` (same as `--cleanup`) +* `SKAFFOLD_DEFAULT_REPO` (same as `--default-repo`) +* `SKAFFOLD_ENABLE_RPC` (same as `--enable-rpc`) +* `SKAFFOLD_FILENAME` (same as `--filename`) +* `SKAFFOLD_INSECURE_REGISTRY` (same as `--insecure-registry`) +* `SKAFFOLD_LABEL` (same as `--label`) +* `SKAFFOLD_NAMESPACE` (same as `--namespace`) +* `SKAFFOLD_NO_PRUNE` (same as `--no-prune`) +* `SKAFFOLD_PORT_FORWARD` (same as `--port-forward`) +* `SKAFFOLD_PROFILE` (same as `--profile`) +* `SKAFFOLD_RPC_HTTP_PORT` (same as `--rpc-http-port`) +* `SKAFFOLD_RPC_PORT` (same as `--rpc-port`) +* `SKAFFOLD_SKIP_TESTS` (same as `--skip-tests`) +* `SKAFFOLD_TAIL` (same as `--tail`) +* `SKAFFOLD_TOOT` (same as `--toot`) +* `SKAFFOLD_TRIGGER` (same as `--trigger`) +* `SKAFFOLD_WATCH_IMAGE` (same as `--watch-image`) +* `SKAFFOLD_WATCH_POLL_INTERVAL` (same as `--watch-poll-interval`) + +### skaffold diagnose + +Run a diagnostic on Skaffold + +``` +Usage: + skaffold diagnose + +Flags: + -f, --filename string Filename or URL to the pipeline file (default "skaffold.yaml") + -p, --profile stringArray Activate profiles by name + +Global Flags: + --color int Specify the default output color in ANSI escape codes (default 34) + -v, --verbosity string Log level (debug, info, warn, error, fatal, panic) (default "warning") + + +``` +Env vars: + +* `SKAFFOLD_FILENAME` (same as `--filename`) +* `SKAFFOLD_PROFILE` (same as `--profile`) + +### skaffold fix + +Converts old Skaffold config to newest schema version + +``` +Usage: + skaffold fix + +Flags: + -f, --filename string Filename or URL to the pipeline file (default "skaffold.yaml") + --overwrite Overwrite original config with fixed config + +Global Flags: + --color int Specify the default output color in ANSI escape codes (default 34) + -v, --verbosity string Log level (debug, info, warn, error, fatal, panic) (default "warning") + + +``` +Env vars: + +* `SKAFFOLD_FILENAME` (same as `--filename`) +* `SKAFFOLD_OVERWRITE` (same as `--overwrite`) + +### skaffold init + +Automatically generate Skaffold configuration for deploying an application + +``` +Usage: + skaffold init + +Flags: + --analyze Print all discoverable Dockerfiles and images in JSON format to stdout + -a, --artifact stringArray '='-delimited dockerfile/image pair to generate build artifact + (example: --artifact=/web/Dockerfile.web=gcr.io/web-project/image) + --compose-file string Initialize from a docker-compose file + -f, --filename string Filename or URL to the pipeline file (default "skaffold.yaml") + --force Force the generation of the Skaffold config + --skip-build Skip generating build artifacts in Skaffold config + +Global Flags: + --color int Specify the default output color in ANSI escape codes (default 34) + -v, --verbosity string Log level (debug, info, warn, error, fatal, panic) (default "warning") + + +``` +Env vars: + +* `SKAFFOLD_ANALYZE` (same as `--analyze`) +* `SKAFFOLD_ARTIFACT` (same as `--artifact`) +* `SKAFFOLD_COMPOSE_FILE` (same as `--compose-file`) +* `SKAFFOLD_FILENAME` (same as `--filename`) +* `SKAFFOLD_FORCE` (same as `--force`) +* `SKAFFOLD_SKIP_BUILD` (same as `--skip-build`) + +### skaffold run + +Runs a pipeline file + +``` +Usage: + skaffold run + +Flags: + --cache-artifacts Set to true to enable caching of artifacts. + --cache-file string Specify the location of the cache file (default $HOME/.skaffold/cache) + -d, --default-repo string Default repository value (overrides global config) + --enable-rpc skaffold dev Enable gRPC for exposing Skaffold events (true by default for skaffold dev) + -f, --filename string Filename or URL to the pipeline file (default "skaffold.yaml") + --force Recreate kubernetes resources if necessary for deployment (default: false, warning: might cause downtime!) + --insecure-registry stringArray Target registries for built images which are not secure + -l, --label stringArray Add custom labels to deployed objects. Set multiple times for multiple labels. + -n, --namespace string Run deployments in the specified namespace + --no-prune Skip removing images and containers built by Skaffold + -p, --profile stringArray Activate profiles by name + --rpc-http-port int tcp port to expose event REST API over HTTP (default 50052) + --rpc-port int tcp port to expose event API (default 50051) + --skip-tests Whether to skip the tests after building + -t, --tag string The optional custom tag to use for images which overrides the current Tagger configuration + --tail Stream logs from deployed objects + --toot Emit a terminal beep after the deploy is complete + +Global Flags: + --color int Specify the default output color in ANSI escape codes (default 34) + -v, --verbosity string Log level (debug, info, warn, error, fatal, panic) (default "warning") + + +``` +Env vars: + +* `SKAFFOLD_CACHE_ARTIFACTS` (same as `--cache-artifacts`) +* `SKAFFOLD_CACHE_FILE` (same as `--cache-file`) +* `SKAFFOLD_DEFAULT_REPO` (same as `--default-repo`) +* `SKAFFOLD_ENABLE_RPC` (same as `--enable-rpc`) +* `SKAFFOLD_FILENAME` (same as `--filename`) +* `SKAFFOLD_FORCE` (same as `--force`) +* `SKAFFOLD_INSECURE_REGISTRY` (same as `--insecure-registry`) +* `SKAFFOLD_LABEL` (same as `--label`) +* `SKAFFOLD_NAMESPACE` (same as `--namespace`) +* `SKAFFOLD_NO_PRUNE` (same as `--no-prune`) +* `SKAFFOLD_PROFILE` (same as `--profile`) +* `SKAFFOLD_RPC_HTTP_PORT` (same as `--rpc-http-port`) +* `SKAFFOLD_RPC_PORT` (same as `--rpc-port`) +* `SKAFFOLD_SKIP_TESTS` (same as `--skip-tests`) +* `SKAFFOLD_TAG` (same as `--tag`) +* `SKAFFOLD_TAIL` (same as `--tail`) +* `SKAFFOLD_TOOT` (same as `--toot`) + +### skaffold version + +Print the version information + +``` +Usage: + skaffold version + +Flags: + -o, --output *flags.TemplateFlag Format output with go-template. For full struct documentation, see https://godoc.org/github.com/GoogleContainerTools/skaffold/pkg/skaffold/version#Info (default {{.Version}} + ) + +Global Flags: + --color int Specify the default output color in ANSI escape codes (default 34) + -v, --verbosity string Log level (debug, info, warn, error, fatal, panic) (default "warning") + + +``` +Env vars: + +* `SKAFFOLD_OUTPUT` (same as `--output`)