github.com/GoogleContainerTools/skaffold@v1.39.18/pkg/skaffold/schema/v1beta8/config.go (about)

     1  /*
     2  Copyright 2019 The Skaffold Authors
     3  
     4  Licensed under the Apache License, Version 2.0 (the "License");
     5  you may not use this file except in compliance with the License.
     6  You may obtain a copy of the License at
     7  
     8      http://www.apache.org/licenses/LICENSE-2.0
     9  
    10  Unless required by applicable law or agreed to in writing, software
    11  distributed under the License is distributed on an "AS IS" BASIS,
    12  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    13  See the License for the specific language governing permissions and
    14  limitations under the License.
    15  */
    16  
    17  package v1beta8
    18  
    19  import (
    20  	"github.com/GoogleContainerTools/skaffold/pkg/skaffold/schema/util"
    21  )
    22  
    23  // !!! WARNING !!! This config version is already released, please DO NOT MODIFY the structs in this file.
    24  const Version string = "skaffold/v1beta8"
    25  
    26  // NewSkaffoldConfig creates a SkaffoldConfig
    27  func NewSkaffoldConfig() util.VersionedConfig {
    28  	return new(SkaffoldConfig)
    29  }
    30  
    31  // SkaffoldConfig holds the fields parsed from the Skaffold configuration file (skaffold.yaml).
    32  type SkaffoldConfig struct {
    33  	// APIVersion is the version of the configuration.
    34  	APIVersion string `yaml:"apiVersion" yamltags:"required"`
    35  
    36  	// Kind is always `Config`. Defaults to `Config`.
    37  	Kind string `yaml:"kind" yamltags:"required"`
    38  
    39  	// Pipeline defines the Build/Test/Deploy phases.
    40  	Pipeline `yaml:",inline"`
    41  
    42  	// Profiles *beta* can override be used to `build`, `test` or `deploy` configuration.
    43  	Profiles []Profile `yaml:"profiles,omitempty"`
    44  }
    45  
    46  // Pipeline describes a Skaffold pipeline.
    47  type Pipeline struct {
    48  	// Build describes how images are built.
    49  	Build BuildConfig `yaml:"build,omitempty"`
    50  
    51  	// Test describes how images are tested.
    52  	Test []*TestCase `yaml:"test,omitempty"`
    53  
    54  	// Deploy describes how images are deployed.
    55  	Deploy DeployConfig `yaml:"deploy,omitempty"`
    56  }
    57  
    58  func (c *SkaffoldConfig) GetVersion() string {
    59  	return c.APIVersion
    60  }
    61  
    62  // BuildConfig contains all the configuration for the build steps.
    63  type BuildConfig struct {
    64  	// Artifacts lists the images you're going to be building.
    65  	Artifacts []*Artifact `yaml:"artifacts,omitempty"`
    66  
    67  	// InsecureRegistries is a list of registries declared by the user to be insecure.
    68  	// These registries will be connected to via HTTP instead of HTTPS.
    69  	InsecureRegistries []string `yaml:"insecureRegistries,omitempty"`
    70  
    71  	// TagPolicy *beta* determines how images are tagged.
    72  	// A few strategies are provided here, although you most likely won't need to care!
    73  	// If not specified, it defaults to `gitCommit: {}`.
    74  	TagPolicy TagPolicy `yaml:"tagPolicy,omitempty"`
    75  
    76  	// ExecutionEnvironment is the environment in which the build
    77  	// should run. Possible values: googleCloudBuild.
    78  	ExecutionEnvironment *ExecutionEnvironment `yaml:"executionEnvironment,omitempty"`
    79  
    80  	BuildType `yaml:",inline"`
    81  }
    82  
    83  // ExecEnvironment is the name of an execution environment.
    84  type ExecEnvironment string
    85  
    86  // ExecutionEnvironment is the environment in which the build should run (ex. local or in-cluster, etc.).
    87  type ExecutionEnvironment struct {
    88  	// Name is the name of the environment.
    89  	Name ExecEnvironment `yaml:"name,omitempty"`
    90  
    91  	// Properties are key-value pairs passed to the environment.
    92  	Properties map[string]interface{} `yaml:"properties,omitempty"`
    93  }
    94  
    95  // BuilderPlugin contains all fields necessary for specifying a build plugin.
    96  type BuilderPlugin struct {
    97  	// Name is the name of the build plugin.
    98  	Name string `yaml:"name,omitempty"`
    99  
   100  	// Properties are key-value pairs passed to the plugin.
   101  	Properties map[string]interface{} `yaml:"properties,omitempty"`
   102  
   103  	// Contents
   104  	Contents []byte `yaml:",omitempty"`
   105  }
   106  
   107  // TagPolicy contains all the configuration for the tagging step.
   108  type TagPolicy struct {
   109  	// GitTagger *beta* tags images with the git tag or commit of the artifact's workspace.
   110  	GitTagger *GitTagger `yaml:"gitCommit,omitempty" yamltags:"oneOf=tag"`
   111  
   112  	// ShaTagger *beta* tags images with their sha256 digest.
   113  	ShaTagger *ShaTagger `yaml:"sha256,omitempty" yamltags:"oneOf=tag"`
   114  
   115  	// EnvTemplateTagger *beta* tags images with a configurable template string.
   116  	EnvTemplateTagger *EnvTemplateTagger `yaml:"envTemplate,omitempty" yamltags:"oneOf=tag"`
   117  
   118  	// DateTimeTagger *beta* tags images with the build timestamp.
   119  	DateTimeTagger *DateTimeTagger `yaml:"dateTime,omitempty" yamltags:"oneOf=tag"`
   120  }
   121  
   122  // ShaTagger *beta* tags images with their sha256 digest.
   123  type ShaTagger struct{}
   124  
   125  // GitTagger *beta* tags images with the git tag or commit of the artifact's workspace.
   126  type GitTagger struct{}
   127  
   128  // EnvTemplateTagger *beta* tags images with a configurable template string.
   129  type EnvTemplateTagger struct {
   130  	// Template used to produce the image name and tag.
   131  	// See golang [text/template](https://golang.org/pkg/text/template/).
   132  	// The template is executed against the current environment,
   133  	// with those variables injected:
   134  	//   IMAGE_NAME   |  Name of the image being built, as supplied in the artifacts section.
   135  	// For example: `{{.RELEASE}}-{{.IMAGE_NAME}}`.
   136  	Template string `yaml:"template,omitempty" yamltags:"required"`
   137  }
   138  
   139  // DateTimeTagger *beta* tags images with the build timestamp.
   140  type DateTimeTagger struct {
   141  	// Format formats the date and time.
   142  	// See [#Time.Format](https://golang.org/pkg/time/#Time.Format).
   143  	// Defaults to `2006-01-02_15-04-05.999_MST`.
   144  	Format string `yaml:"format,omitempty"`
   145  
   146  	// TimeZone sets the timezone for the date and time.
   147  	// See [Time.LoadLocation](https://golang.org/pkg/time/#Time.LoadLocation).
   148  	// Defaults to the local timezone.
   149  	TimeZone string `yaml:"timezone,omitempty"`
   150  }
   151  
   152  // BuildType contains the specific implementation and parameters needed
   153  // for the build step. Only one field should be populated.
   154  type BuildType struct {
   155  	// LocalBuild *beta* describes how to do a build on the local docker daemon
   156  	// and optionally push to a repository.
   157  	LocalBuild *LocalBuild `yaml:"local,omitempty" yamltags:"oneOf=build"`
   158  
   159  	// GoogleCloudBuild *beta* describes how to do a remote build on
   160  	// [Google Cloud Build](https://cloud.google.com/cloud-build/).
   161  	GoogleCloudBuild *GoogleCloudBuild `yaml:"googleCloudBuild,omitempty" yamltags:"oneOf=build"`
   162  
   163  	// Cluster *beta* describes how to do an on-cluster build.
   164  	Cluster *ClusterDetails `yaml:"cluster,omitempty" yamltags:"oneOf=build"`
   165  }
   166  
   167  // LocalBuild *beta* describes how to do a build on the local docker daemon
   168  // and optionally push to a repository.
   169  type LocalBuild struct {
   170  	// Push should images be pushed to a registry.
   171  	// If not specified, images are pushed only if the current Kubernetes context
   172  	// connects to a remote cluster.
   173  	Push *bool `yaml:"push,omitempty"`
   174  
   175  	// UseDockerCLI use `docker` command-line interface instead of Docker Engine APIs.
   176  	UseDockerCLI bool `yaml:"useDockerCLI,omitempty"`
   177  
   178  	// UseBuildkit use BuildKit to build Docker images. If unspecified, uses the Docker default.
   179  	UseBuildkit *bool `yaml:"useBuildkit,omitempty"`
   180  }
   181  
   182  // GoogleCloudBuild *beta* describes how to do a remote build on
   183  // [Google Cloud Build](https://cloud.google.com/cloud-build/docs/).
   184  // Docker and Jib artifacts can be built on Cloud Build. The `projectId` needs
   185  // to be provided and the currently logged in user should be given permissions to trigger
   186  // new builds.
   187  type GoogleCloudBuild struct {
   188  	// ProjectID is the ID of your Cloud Platform Project.
   189  	// If it is not provided, Skaffold will guess it from the image name.
   190  	// For example, given the artifact image name `gcr.io/myproject/image`, Skaffold
   191  	// will use the `myproject` GCP project.
   192  	ProjectID string `yaml:"projectId,omitempty"`
   193  
   194  	// DiskSizeGb is the disk size of the VM that runs the build.
   195  	// See [Cloud Build Reference](https://cloud.google.com/cloud-build/docs/api/reference/rest/v1/projects.builds#buildoptions).
   196  	DiskSizeGb int64 `yaml:"diskSizeGb,omitempty"`
   197  
   198  	// MachineType is the type of the VM that runs the build.
   199  	// See [Cloud Build Reference](https://cloud.google.com/cloud-build/docs/api/reference/rest/v1/projects.builds#buildoptions).
   200  	MachineType string `yaml:"machineType,omitempty"`
   201  
   202  	// Timeout is the amount of time (in seconds) that this build should be allowed to run.
   203  	// See [Cloud Build Reference](https://cloud.google.com/cloud-build/docs/api/reference/rest/v1/projects.builds#resource-build).
   204  	Timeout string `yaml:"timeout,omitempty"`
   205  
   206  	// DockerImage is the image that runs a Docker build.
   207  	// See [Cloud Builders](https://cloud.google.com/cloud-build/docs/cloud-builders).
   208  	// Defaults to `gcr.io/cloud-builders/docker`.
   209  	DockerImage string `yaml:"dockerImage,omitempty"`
   210  
   211  	// MavenImage is the image that runs a Maven build.
   212  	// See [Cloud Builders](https://cloud.google.com/cloud-build/docs/cloud-builders).
   213  	// Defaults to `gcr.io/cloud-builders/mvn`.
   214  	MavenImage string `yaml:"mavenImage,omitempty"`
   215  
   216  	// GradleImage is the image that runs a Gradle build.
   217  	// See [Cloud Builders](https://cloud.google.com/cloud-build/docs/cloud-builders).
   218  	// Defaults to `gcr.io/cloud-builders/gradle`.
   219  	GradleImage string `yaml:"gradleImage,omitempty"`
   220  }
   221  
   222  // LocalDir configures how Kaniko mounts sources directly via an `emptyDir` volume.
   223  type LocalDir struct {
   224  	// InitImage is the image used to run init container which mounts kaniko context.
   225  	InitImage string `yaml:"initImage,omitempty"`
   226  }
   227  
   228  // KanikoBuildContext contains the different fields available to specify
   229  // a Kaniko build context.
   230  type KanikoBuildContext struct {
   231  	// GCSBucket is the CGS bucket to which sources are uploaded.
   232  	// Kaniko will need access to that bucket to download the sources.
   233  	GCSBucket string `yaml:"gcsBucket,omitempty" yamltags:"oneOf=buildContext"`
   234  
   235  	// LocalDir configures how Kaniko mounts sources directly via an `emptyDir` volume.
   236  	LocalDir *LocalDir `yaml:"localDir,omitempty" yamltags:"oneOf=buildContext"`
   237  }
   238  
   239  // KanikoCache configures Kaniko caching. If a cache is specified, Kaniko will
   240  // use a remote cache which will speed up builds.
   241  type KanikoCache struct {
   242  	// Repo is a remote repository to store cached layers. If none is specified, one will be
   243  	// inferred from the image name. See [Kaniko Caching](https://github.com/GoogleContainerTools/kaniko#caching).
   244  	Repo string `yaml:"repo,omitempty"`
   245  }
   246  
   247  // ClusterDetails *beta* describes how to do an on-cluster build.
   248  type ClusterDetails struct {
   249  	// PullSecret is the path to the secret key file.
   250  	PullSecret string `yaml:"pullSecret,omitempty"`
   251  
   252  	// PullSecretName is the name of the Kubernetes secret for pulling the files
   253  	// from the build context and pushing the final image.
   254  	// Defaults to `kaniko-secret`.
   255  	PullSecretName string `yaml:"pullSecretName,omitempty"`
   256  
   257  	// Namespace is the Kubernetes namespace.
   258  	// Defaults to current namespace in Kubernetes configuration.
   259  	Namespace string `yaml:"namespace,omitempty"`
   260  
   261  	// Timeout is the amount of time (in seconds) that this build is allowed to run.
   262  	// Defaults to 20 minutes (`20m`).
   263  	Timeout string `yaml:"timeout,omitempty"`
   264  
   265  	// DockerConfig describes how to mount the local Docker configuration into a pod.
   266  	DockerConfig *DockerConfig `yaml:"dockerConfig,omitempty"`
   267  
   268  	// Resources define the resource requirements for the kaniko pod.
   269  	Resources *ResourceRequirements `yaml:"resources,omitempty"`
   270  }
   271  
   272  // DockerConfig contains information about the docker `config.json` to mount.
   273  type DockerConfig struct {
   274  	// Path is the path to the docker `config.json`.
   275  	Path string `yaml:"path,omitempty"`
   276  
   277  	// SecretName is the Kubernetes secret that will hold the Docker configuration.
   278  	SecretName string `yaml:"secretName,omitempty"`
   279  }
   280  
   281  // ResourceRequirements describes the resource requirements for the kaniko pod.
   282  type ResourceRequirements struct {
   283  	// 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.
   284  	Requests *ResourceRequirement `yaml:"requests,omitempty"`
   285  
   286  	// 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.
   287  	Limits *ResourceRequirement `yaml:"limits,omitempty"`
   288  }
   289  
   290  // ResourceRequirement stores the CPU/Memory requirements for the pod.
   291  type ResourceRequirement struct {
   292  	// CPU the number cores to be used.
   293  	// For example: `2`, `2.0` or `200m`.
   294  	CPU string `yaml:"cpu,omitempty"`
   295  
   296  	// Memory the amount of memory to allocate to the pod.
   297  	// For example: `1Gi` or `1000Mi`.
   298  	Memory string `yaml:"memory,omitempty"`
   299  }
   300  
   301  // TestCase is a list of structure tests to run on images that Skaffold builds.
   302  type TestCase struct {
   303  	// ImageName is the artifact on which to run those tests.
   304  	// For example: `gcr.io/k8s-skaffold/example`.
   305  	ImageName string `yaml:"image" yamltags:"required"`
   306  
   307  	// StructureTests lists the [Container Structure Tests](https://github.com/GoogleContainerTools/container-structure-test)
   308  	// to run on that artifact.
   309  	// For example: `["./test/*"]`.
   310  	StructureTests []string `yaml:"structureTests,omitempty"`
   311  }
   312  
   313  // DeployConfig contains all the configuration needed by the deploy steps.
   314  type DeployConfig struct {
   315  	DeployType `yaml:",inline"`
   316  }
   317  
   318  // DeployType contains the specific implementation and parameters needed
   319  // for the deploy step. Only one field should be populated.
   320  type DeployType struct {
   321  	// HelmDeploy *beta* uses the `helm` CLI to apply the charts to the cluster.
   322  	HelmDeploy *HelmDeploy `yaml:"helm,omitempty" yamltags:"oneOf=deploy"`
   323  
   324  	// KubectlDeploy *beta* uses a client side `kubectl apply` to deploy manifests.
   325  	// You'll need a `kubectl` CLI version installed that's compatible with your cluster.
   326  	KubectlDeploy *KubectlDeploy `yaml:"kubectl,omitempty" yamltags:"oneOf=deploy"`
   327  
   328  	// KustomizeDeploy *beta* uses the `kustomize` CLI to "patch" a deployment for a target environment.
   329  	KustomizeDeploy *KustomizeDeploy `yaml:"kustomize,omitempty" yamltags:"oneOf=deploy"`
   330  }
   331  
   332  // KubectlDeploy *beta* uses a client side `kubectl apply` to deploy manifests.
   333  // You'll need a `kubectl` CLI version installed that's compatible with your cluster.
   334  type KubectlDeploy struct {
   335  	// Manifests lists the Kubernetes yaml or json manifests.
   336  	// Defaults to `["k8s/*.yaml"]`.
   337  	Manifests []string `yaml:"manifests,omitempty"`
   338  
   339  	// RemoteManifests lists Kubernetes manifests in remote clusters.
   340  	RemoteManifests []string `yaml:"remoteManifests,omitempty"`
   341  
   342  	// Flags are additional flags passed to `kubectl`.
   343  	Flags KubectlFlags `yaml:"flags,omitempty"`
   344  }
   345  
   346  // KubectlFlags are additional flags passed on the command
   347  // line to kubectl either on every command (Global), on creations (Apply)
   348  // or deletions (Delete).
   349  type KubectlFlags struct {
   350  	// Global are additional flags passed on every command.
   351  	Global []string `yaml:"global,omitempty"`
   352  
   353  	// Apply are additional flags passed on creations (`kubectl apply`).
   354  	Apply []string `yaml:"apply,omitempty"`
   355  
   356  	// Delete are additional flags passed on deletions (`kubectl delete`).
   357  	Delete []string `yaml:"delete,omitempty"`
   358  }
   359  
   360  // HelmDeploy *beta* uses the `helm` CLI to apply the charts to the cluster.
   361  type HelmDeploy struct {
   362  	// Releases is a list of Helm releases.
   363  	Releases []HelmRelease `yaml:"releases,omitempty" yamltags:"required"`
   364  
   365  	// Flags are additional option flags that are passed on the command
   366  	// line to `helm`.
   367  	Flags HelmDeployFlags `yaml:"flags,omitempty"`
   368  }
   369  
   370  // HelmDeployFlags are additional option flags that are passed on the command
   371  // line to `helm`.
   372  type HelmDeployFlags struct {
   373  	// Global are additional flags passed on every command.
   374  	Global []string `yaml:"global,omitempty"`
   375  
   376  	// Install are additional flags passed to (`helm install`).
   377  	Install []string `yaml:"install,omitempty"`
   378  
   379  	// Upgrade are additional flags passed to (`helm upgrade`).
   380  	Upgrade []string `yaml:"upgrade,omitempty"`
   381  }
   382  
   383  // KustomizeDeploy *beta* uses the `kustomize` CLI to "patch" a deployment for a target environment.
   384  type KustomizeDeploy struct {
   385  	// KustomizePath is the path to Kustomization files.
   386  	// Defaults to `.`.
   387  	KustomizePath string `yaml:"path,omitempty"`
   388  
   389  	// Flags are additional flags passed to `kubectl`.
   390  	Flags KubectlFlags `yaml:"flags,omitempty"`
   391  }
   392  
   393  // HelmRelease describes a helm release to be deployed.
   394  type HelmRelease struct {
   395  	// Name is the name of the Helm release.
   396  	Name string `yaml:"name,omitempty" yamltags:"required"`
   397  
   398  	// ChartPath is the path to the Helm chart.
   399  	ChartPath string `yaml:"chartPath,omitempty" yamltags:"required"`
   400  
   401  	// ValuesFiles are the paths to the Helm `values` files.
   402  	ValuesFiles []string `yaml:"valuesFiles,omitempty"`
   403  
   404  	// Values are key-value pairs supplementing the Helm `values` file.
   405  	Values map[string]string `yaml:"values,omitempty,omitempty"`
   406  
   407  	// Namespace is the Kubernetes namespace.
   408  	Namespace string `yaml:"namespace,omitempty"`
   409  
   410  	// Version is the version of the chart.
   411  	Version string `yaml:"version,omitempty"`
   412  
   413  	// SetValues are key-value pairs.
   414  	// If present, Skaffold will send `--set` flag to Helm CLI and append all pairs after the flag.
   415  	SetValues map[string]string `yaml:"setValues,omitempty"`
   416  
   417  	// SetValueTemplates are key-value pairs.
   418  	// If present, Skaffold will try to parse the value part of each key-value pair using
   419  	// environment variables in the system, then send `--set` flag to Helm CLI and append
   420  	// all parsed pairs after the flag.
   421  	SetValueTemplates map[string]string `yaml:"setValueTemplates,omitempty"`
   422  
   423  	// Wait if `true`, Skaffold will send `--wait` flag to Helm CLI.
   424  	// Defaults to `false`.
   425  	Wait bool `yaml:"wait,omitempty"`
   426  
   427  	// RecreatePods if `true`, Skaffold will send `--recreate-pods` flag to Helm CLI.
   428  	// Defaults to `false`.
   429  	RecreatePods bool `yaml:"recreatePods,omitempty"`
   430  
   431  	// SkipBuildDependencies should build dependencies be skipped.
   432  	SkipBuildDependencies bool `yaml:"skipBuildDependencies,omitempty"`
   433  
   434  	// UseHelmSecrets instructs skaffold to use secrets plugin on deployment.
   435  	UseHelmSecrets bool `yaml:"useHelmSecrets,omitempty"`
   436  
   437  	// Overrides are key-value pairs.
   438  	// If present, Skaffold will build a Helm `values` file that overrides
   439  	// the original and use it to call Helm CLI (`--f` flag).
   440  	Overrides util.HelmOverrides `yaml:"overrides,omitempty"`
   441  
   442  	// Packaged parameters for packaging helm chart (`helm package`).
   443  	Packaged *HelmPackaged `yaml:"packaged,omitempty"`
   444  
   445  	// ImageStrategy adds image configurations to the Helm `values` file.
   446  	ImageStrategy HelmImageStrategy `yaml:"imageStrategy,omitempty"`
   447  }
   448  
   449  // HelmPackaged parameters for packaging helm chart (`helm package`).
   450  type HelmPackaged struct {
   451  	// Version sets the `version` on the chart to this semver version.
   452  	Version string `yaml:"version,omitempty"`
   453  
   454  	// AppVersion sets the `appVersion` on the chart to this version.
   455  	AppVersion string `yaml:"appVersion,omitempty"`
   456  }
   457  
   458  // HelmImageStrategy adds image configurations to the Helm `values` file.
   459  type HelmImageStrategy struct {
   460  	HelmImageConfig `yaml:",inline"`
   461  }
   462  
   463  // HelmImageConfig describes an image configuration.
   464  type HelmImageConfig struct {
   465  	// HelmFQNConfig is the image configuration uses the syntax `IMAGE-NAME=IMAGE-REPOSITORY:IMAGE-TAG`.
   466  	HelmFQNConfig *HelmFQNConfig `yaml:"fqn,omitempty" yamltags:"oneOf=helmImageStrategy"`
   467  
   468  	// HelmConventionConfig is the image configuration uses the syntax `IMAGE-NAME.repository=IMAGE-REPOSITORY, IMAGE-NAME.tag=IMAGE-TAG`.
   469  	HelmConventionConfig *HelmConventionConfig `yaml:"helm,omitempty" yamltags:"oneOf=helmImageStrategy"`
   470  }
   471  
   472  // HelmFQNConfig is the image config to use the FullyQualifiedImageName as param to set.
   473  type HelmFQNConfig struct {
   474  	// Property defines the image config.
   475  	Property string `yaml:"property,omitempty"`
   476  }
   477  
   478  // HelmConventionConfig is the image config in the syntax of image.repository and image.tag.
   479  type HelmConventionConfig struct {
   480  }
   481  
   482  // Artifact are the items that need to be built, along with the context in which
   483  // they should be built.
   484  type Artifact struct {
   485  	// ImageName is the name of the image to be built.
   486  	// For example: `gcr.io/k8s-skaffold/example`.
   487  	ImageName string `yaml:"image,omitempty" yamltags:"required"`
   488  
   489  	// Workspace is the directory containing the artifact's sources.
   490  	// Defaults to `.`.
   491  	Workspace string `yaml:"context,omitempty"`
   492  
   493  	// Sync *alpha* lists local files synced to pods instead
   494  	// of triggering an image build when modified.
   495  	// This is a mapping of local files to sync to remote folders.
   496  	// For example: `{"*.py": ".", "css/**/*.css": "app/css"}`.
   497  	Sync map[string]string `yaml:"sync,omitempty"`
   498  
   499  	// ArtifactType describes how to build an artifact.
   500  	ArtifactType `yaml:",inline"`
   501  
   502  	// BuilderPlugin is the plugin used to build this artifact.
   503  	BuilderPlugin *BuilderPlugin `yaml:"plugin,omitempty"`
   504  }
   505  
   506  // Profile *beta* profiles are used to override any `build`, `test` or `deploy` configuration.
   507  type Profile struct {
   508  	// Name is a unique profile name.
   509  	// For example: `profile-prod`.
   510  	Name string `yaml:"name,omitempty" yamltags:"required"`
   511  
   512  	// Pipeline contains the definitions to replace the default skaffold pipeline.
   513  	Pipeline `yaml:",inline"`
   514  
   515  	// Patches lists patches applied to the configuration.
   516  	// Patches use the JSON patch notation.
   517  	Patches []JSONPatch `yaml:"patches,omitempty"`
   518  
   519  	// Activation criteria by which a profile can be auto-activated.
   520  	// The profile is auto-activated if any one of the activations are triggered.
   521  	// An activation is triggered if all of the criteria (env, kubeContext, command) are triggered.
   522  	Activation []Activation `yaml:"activation,omitempty"`
   523  }
   524  
   525  // JSONPatch patch to be applied by a profile.
   526  type JSONPatch struct {
   527  	// Op is the operation carried by the patch: `add`, `remove`, `replace`, `move`, `copy` or `test`.
   528  	// Defaults to `replace`.
   529  	Op string `yaml:"op,omitempty"`
   530  
   531  	// Path is the position in the yaml where the operation takes place.
   532  	// For example, this targets the `dockerfile` of the first artifact built.
   533  	// For example: `/build/artifacts/0/docker/dockerfile`.
   534  	Path string `yaml:"path,omitempty" yamltags:"required"`
   535  
   536  	// From is the source position in the yaml, used for `copy` or `move` operations.
   537  	From string `yaml:"from,omitempty"`
   538  
   539  	// Value is the value to apply. Can be any portion of yaml.
   540  	Value *util.YamlpatchNode `yaml:"value,omitempty"`
   541  }
   542  
   543  // Activation criteria by which a profile is auto-activated.
   544  type Activation struct {
   545  	// Env is a `key=value` pair. The profile is auto-activated if an Environment
   546  	// Variable `key` has value `value`.
   547  	// For example: `ENV=production`.
   548  	Env string `yaml:"env,omitempty"`
   549  
   550  	// KubeContext is a Kubernetes context for which the profile is auto-activated.
   551  	// For example: `minikube`.
   552  	KubeContext string `yaml:"kubeContext,omitempty"`
   553  
   554  	// Command is a Skaffold command for which the profile is auto-activated.
   555  	// For example: `dev`.
   556  	Command string `yaml:"command,omitempty"`
   557  }
   558  
   559  // ArtifactType describes how to build an artifact.
   560  type ArtifactType struct {
   561  	// DockerArtifact *beta* describes an artifact built from a Dockerfile.
   562  	DockerArtifact *DockerArtifact `yaml:"docker,omitempty" yamltags:"oneOf=artifact"`
   563  
   564  	// BazelArtifact *beta* requires bazel CLI to be installed and the sources to
   565  	// contain [Bazel](https://bazel.build/) configuration files.
   566  	BazelArtifact *BazelArtifact `yaml:"bazel,omitempty" yamltags:"oneOf=artifact"`
   567  
   568  	// JibMavenArtifact *alpha* builds images using the
   569  	// [Jib plugin for Maven](https://github.com/GoogleContainerTools/jib/tree/master/jib-maven-plugin).
   570  	JibMavenArtifact *JibMavenArtifact `yaml:"jibMaven,omitempty" yamltags:"oneOf=artifact"`
   571  
   572  	// JibGradleArtifact *alpha* builds images using the
   573  	// [Jib plugin for Gradle](https://github.com/GoogleContainerTools/jib/tree/master/jib-gradle-plugin).
   574  	JibGradleArtifact *JibGradleArtifact `yaml:"jibGradle,omitempty" yamltags:"oneOf=artifact"`
   575  
   576  	// KanikoArtifact *alpha* builds images using [kaniko](https://github.com/GoogleContainerTools/kaniko).
   577  	KanikoArtifact *KanikoArtifact `yaml:"kaniko,omitempty" yamltags:"oneOf=artifact"`
   578  }
   579  
   580  // KanikoArtifact *alpha* describes an artifact built from a Dockerfile,
   581  // with kaniko.
   582  type KanikoArtifact struct {
   583  	// AdditionalFlags are additional flags to be passed to Kaniko command line.
   584  	// See [Kaniko Additional Flags](https://github.com/GoogleContainerTools/kaniko#additional-flags).
   585  	// Deprecated - instead the named, unique fields should be used, e.g. `buildArgs`, `cache`, `target`.
   586  	AdditionalFlags []string `yaml:"flags,omitempty"`
   587  
   588  	// DockerfilePath locates the Dockerfile relative to workspace.
   589  	// Defaults to `Dockerfile`.
   590  	DockerfilePath string `yaml:"dockerfile,omitempty"`
   591  
   592  	// Target is the Dockerfile target name to build.
   593  	Target string `yaml:"target,omitempty"`
   594  
   595  	// BuildArgs are arguments passed to the docker build.
   596  	// For example: `{"key1": "value1", "key2": "value2"}`.
   597  	BuildArgs map[string]*string `yaml:"buildArgs,omitempty"`
   598  
   599  	// BuildContext is where the build context for this artifact resides.
   600  	BuildContext *KanikoBuildContext `yaml:"buildContext,omitempty"`
   601  
   602  	// Image is the Docker image used by the Kaniko pod.
   603  	// Defaults to the latest released version of `gcr.io/kaniko-project/executor`.
   604  	Image string `yaml:"image,omitempty"`
   605  
   606  	// Cache configures Kaniko caching. If a cache is specified, Kaniko will
   607  	// use a remote cache which will speed up builds.
   608  	Cache *KanikoCache `yaml:"cache,omitempty"`
   609  }
   610  
   611  // DockerArtifact *beta* describes an artifact built from a Dockerfile,
   612  // usually using `docker build`.
   613  type DockerArtifact struct {
   614  	// DockerfilePath locates the Dockerfile relative to workspace.
   615  	// Defaults to `Dockerfile`.
   616  	DockerfilePath string `yaml:"dockerfile,omitempty"`
   617  
   618  	// Target is the Dockerfile target name to build.
   619  	Target string `yaml:"target,omitempty"`
   620  
   621  	// BuildArgs are arguments passed to the docker build.
   622  	// For example: `{"key1": "value1", "key2": "value2"}`.
   623  	BuildArgs map[string]*string `yaml:"buildArgs,omitempty"`
   624  
   625  	// CacheFrom lists the Docker images used as cache sources.
   626  	// For example: `["golang:1.10.1-alpine3.7", "alpine:3.7"]`.
   627  	CacheFrom []string `yaml:"cacheFrom,omitempty"`
   628  }
   629  
   630  // BazelArtifact *beta* describes an artifact built with [Bazel](https://bazel.build/).
   631  type BazelArtifact struct {
   632  	// BuildTarget is the `bazel build` target to run.
   633  	// For example: `//:skaffold_example.tar`.
   634  	BuildTarget string `yaml:"target,omitempty" yamltags:"required" json:"target"`
   635  
   636  	// BuildArgs are additional args to pass to `bazel build`.
   637  	// For example: `["-flag", "--otherflag"]`.
   638  	BuildArgs []string `yaml:"args,omitempty"`
   639  }
   640  
   641  // JibMavenArtifact *alpha* builds images using the
   642  // [Jib plugin for Maven](https://github.com/GoogleContainerTools/jib/tree/master/jib-maven-plugin).
   643  type JibMavenArtifact struct {
   644  	// Module selects which Maven module to build, for a multi module project.
   645  	Module string `yaml:"module"`
   646  
   647  	// Profile selects which Maven profile to activate.
   648  	Profile string `yaml:"profile"`
   649  
   650  	// Flags are additional build flags passed to Maven.
   651  	// For example: `["-x", "-DskipTests"]`.
   652  	Flags []string `yaml:"args,omitempty"`
   653  }
   654  
   655  // JibGradleArtifact *alpha* builds images using the
   656  // [Jib plugin for Gradle](https://github.com/GoogleContainerTools/jib/tree/master/jib-gradle-plugin).
   657  type JibGradleArtifact struct {
   658  	// Project selects which Gradle project to build.
   659  	Project string `yaml:"project"`
   660  
   661  	// Flags are additional build flags passed to Gradle.
   662  	// For example: `["--no-build-cache"]`.
   663  	Flags []string `yaml:"args,omitempty"`
   664  }