Skip to content

Conversation

@coryb
Copy link
Contributor

@coryb coryb commented Nov 25, 2020

This adds the sprig template funcs for general usage
Also I have added several docker image parsing template funcs which I have needed for various docker image publishing routines.

return map[string]interface{}{
// dockerDomain returns the domain/host information for the provided
// docker image
"dockerDomain": func(in string) string {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does it have to be dockerFoo? Could this be imageRefDomain or something a bit more OCI-friendly? 😉

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was chatting on slack, but I was suggesting since we had interpolation support in heredocs, I prefer if we use regular string functions rather than template functions.

Along with the array support proposal, you could do something like:

[]string dockerRegistries() {
	"titusregistry.us-east-1.netflix.net"
	"titusregistry.us-west-2.netflix.net"
}

[]string pushTargets(string ref) {
	for (string registry in dockerRegistries) {
		"${registry}/${dockerPath(ref)}:${dockerTag(ref)}
	}
}

fs titusPush(string ref) {
	for (string target in pushTargets(ref)) {
		dockerPush target
	}
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants