Home > OS >  How to make skaffold dev skip building image entirely?
How to make skaffold dev skip building image entirely?

Time:11-24

Is there a way to make skaffold dev completely skip image building including the initial one? I have a prebuilt image. All I want skaffold to do is deploy the K8s Deployment YAML file and sync local files to it. I couldn't find a working example of how to do this. Closest was this one but it assumes an initial image build.

skaffold dev --auto-build=false stills builds.

my skaffold.yaml

apiVersion: skaffold/v2beta26
kind: Config
build:
  artifacts:
  - image: gcr.io/my-project/my-repo
    context: .
    sync:
      infer: ["**/*"]
deploy:
  kubectl:
    manifests:
    - skaffold/*.yaml
skaffold dev --auto-build=false --default-repo gcr.io/my-project

Listing files to watch...
 - gcr.io/my-project/my-repo
Generating tags...
 - gcr.io/my-project/my-repo -> gcr.io/my-project/my-repo:v0.7.4-182-gb47cd3b5-dirty
Checking cache...
 - gcr.io/my-project/my-repo: Not found. Building
Starting build...
Building [gcr.io/my-project/my-repo]...

Update: Using skaffold v1.35.0 on an Ubuntu VM, deploying to remote GKE cluster version 1.20.10-gke.1600 created via Google Cloud Console. Storing images in Google Container Registry (gcr.io).

CodePudding user response:

Skaffold's build.local.tryImportMissing: true setting will cause Skaffold to use a tagged image if it already exists. In your example above, Skaffold would look for gcr.io/my-project/my-repo:v0.7.4-182-gb47cd3b5-dirty.

You could combine tryImportMissing with skaffold dev --tag {fixed-tag} argument to override the tagging policy to specify a fixed tag.

And skaffold dev also supports --auto-build=false --auto-deploy=false to avoid re-building and re-deploying changed images.

  • Related