Skip to content

Kustomize transformer to replace an image tag with the current git reference

Notifications You must be signed in to change notification settings

tsloughter/kustomize-git-ref-transformer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 

Repository files navigation

Kustomize Tag Transformer with Git Reference

A kustomize plugin that provides a transformer for changing an image tag to the current git commit reference.

Requires jq and yq.

Usage

Simplest usage:

# clone repo somewhere
$ git clone https://github.com/tsloughter/kustomize-git-ref-transformer
$ mkdir -p ~/.config/kustomize/plugin
# link to subdirectory tsloughter in the clone of this repo
$ ln -s <path to dir of clone>/kustomize-git-ref-transformer/tsloughter ~/.config/kustomize/plugin/tsloughter

And add the transformer as gitRefTransformer.yaml to your kustomize resources:

apiVersion: tsloughter/v1
kind: GitRefTransformer
metadata:
  name: git-ref-image-tag-transformer
argsOneLiner: myimage

And include the transformer in your kustomization.yaml

apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
[...]
transformers:
- gitRefTransformer.yaml
$ kustomize build --enable_alpha_plugins path/to/kustomize/files

Options

The transformer can optionally take a new name to give the image and if the third argument is short it will use a short reference for the tag.

apiVersion: tsloughter/v1
kind: GitRefTransformer
metadata:
  name: git-ref-image-tag-transformer
argsOneLiner: ImageName [NewImageName [short]]

If no new image name is given you can not set the git ref to be a short reference, so simply set the new image name to the same as the image name if you want to use a short ref with the same name.

About

Kustomize transformer to replace an image tag with the current git reference

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages