skaffold icon indicating copy to clipboard operation
skaffold copied to clipboard

Built images are always tagged :latest. Where do I set the environment variable to use the tagPolicy/envTemplate ?

Open vinnytwice opened this issue 3 years ago • 0 comments
trafficstars

Expected behavior

built docker image with :dev tag

Actual behavior

built docker image with :latest tag

Information

  • Skaffold version: v1.39.1
  • Operating system: MacOs Monterey 12.4
  • Installed via: Homebrew
  • Contents of skaffold.yaml:
apiVersion: skaffold/v2alpha3
kind: Config
deploy:
  kubectl:
    manifests:
      - ./infrastructure/k8s/*
build:
  tagPolicy:
    envTemplate:
      template: "{{.SERVER_DEV_IMAGE_TAG}}"
    # dateTime:
    #   format: "2006-01-02_15-04-05.999_MST"
    #   timezone: "Local"
  local:
    push: false
  artifacts:
    - image: vinnytwice/fixit-server
      context: ./
      docker:
        dockerfile: Dockerfile
      sync:
        manual:
          - src: 'api/src/**/*.js'
            dest: .

I'm just starting with both Kubernetes and Skaffold and I'm trying to set the tag as :dev for the built docker image using tagPolicy/envTemplate but it always gets tagged as :latest, using dateTime works as expected. I added export SERVER_DEV_IMAGE_TAG=dev to zshrc via vim ~/.zshrc but still but image has the :latest tag. If I just set the variable in the VsCode terminal window with export SERVER_DEV_IMAGE_TAG=dev it then works as expected tagging the image :dev. Why then the zshrc variable is not read? Many thanks Cheers

vinnytwice avatar Jul 19 '22 00:07 vinnytwice

are you running skaffold build from the zsh shell? You should check if the variable is set in the shell.

echo $SERVER_DEV_IMAGE_TAG

I'd recommend setting the variable inline:

SERVER_DEV_IMAGE_TAG=dev skaffold build

I'm closing this issue as it isn't related to Skaffold.

gsquared94 avatar Aug 14 '22 19:08 gsquared94