Categorygithub.com/GoogleContainerTools/skaffoldintegrationexamplestagging-with-environment-variables
# README
=== Example: using the envTemplate tag policy :icons: font
This example reuses the image name and uses an environment variable FOO
to tag the image.
The way you configure it in skaffold.yaml
is the following build stanza:
[source,yaml]
build: artifacts: - image: gcr.io/k8s-skaffold/skaffold-example tagPolicy: # <1> envTemplate: # <1> template: "{{.IMAGE_NAME}}:{{.FOO}}" # <2>
<1> define tagPolicy to be envTemplate <2> use https://golang.org/pkg/text/template[go templates] syntax
The IMAGE_NAME
variable is built-in and reuses the value defined in the artifacts' image
.
ifndef::env-github[]
==== link:{github-repo-tree}/examples/tagging-with-environment-variables[Example files icon:github[]] [source,yaml, indent=3, title=skaffold.yaml]
include::skaffold.yaml[]
[source,go, indent=3, title=main.go, syntax=go]
include::main.go[]
[source,docker, indent=3, title=Dockerfile]
include::Dockerfile[]
[source,yaml, indent=3, title=k8s-pod.yaml]
include::k8s-pod.yaml[]
endif::[]