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