Add script to validate length of clustergroup chart and pattern names#643
Conversation
4e539b8 to
a1b23c8
Compare
| @@ -1,4 +1,4 @@ | |||
| NAME ?= $(shell basename "`pwd`") | |||
| NAME ?= $(shell yq .global.pattern values-global.yaml) | |||
There was a problem hiding this comment.
Maybe add a fallback to the old ways here? I am just not remembering when we introduced the .global.pattern. Unless you're sure we have it set everywhere that is
There was a problem hiding this comment.
I'm not sure it is set everywhere (although it probably should be). What if we use yq --exit-status .global.pattern values-global.yaml to enforce that it is set. Then, rather than falling back to the directory name, we enforce they have a proper value.
There was a problem hiding this comment.
So we error out if it does not have it set? Yeah let's go for that! I suppose the pattern's that don't have it, probably won't update common much anyways
There was a problem hiding this comment.
I added the check:
ifeq ($(NAME),)
$(error Pattern name MUST be set in values-global.yaml with the value .global.pattern)
endif
ifeq ($(NAME),null)
$(error Pattern name MUST be set in values-global.yaml with the value .global.pattern)
endifso if it's not set (or if the pattern name is set to be an empty string) we'll error out:
❯ make show
make -f common/Makefile show
make[1]: Entering directory '/home/drewminnear/gh-repos/dminnear-rh/multicloud-gitops'
common/Makefile:7: *** Pattern name MUST be set in values-global.yaml with the value .global.pattern. Stop.
make[1]: Leaving directory '/home/drewminnear/gh-repos/dminnear-rh/multicloud-gitops'
make: *** [Makefile:12: show] Error 2
Fixes validatedpatterns/clustergroup-chart#61 by ensuring that we fail before install if the length of the names will cause invalid DNS problems.
Also, will fix validatedpatterns/pattern-install-chart#18. In addition to the validation added, this PR reads the pattern name from the values-global.yaml file rather than just taking the basename of whatever directory the git repo is cloned into locally.
A failed validation looks like:
A passed validation looks like: