template

package
v2.3.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 26, 2024 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FetchTemplateVariableYaml

func FetchTemplateVariableYaml(source string, logger *zap.SugaredLogger) (string, error)

FetchTemplateVariableYaml extract variables from go template yaml and package them into yaml supports most standard go-template grammar, but can't deal with complex situation like range in range / local vars using $ NOTE the return value should not be fully trusted

func GetTemplateVariableYaml

func GetTemplateVariableYaml(variables []*models.Variable, variableYaml string) (string, error)

GetTemplateVariableYaml returns variable yaml of yamlTemplate or templateService

func GetYamlVariables

func GetYamlVariables(s string, logger *zap.SugaredLogger) ([]*models.ChartVariable, error)

GetYamlVariables extract variables from go template yaml to Zadig-defined vars use regex to search {{.rar}} and turn to {key: var} NOTE this function DOES NOT support full go-template grammar, like {{- range }} / {{- eq }} / {{- if }} / nested data technically this function should be deprecated

func SafeMergeVariableYaml

func SafeMergeVariableYaml(variableYamls ...string) (string, map[string]string, error)

SafeMergeVariableYaml merge yamls support go template grammar, you can put {{.xxx}} as value in variable yaml

Types

type BuildReference

type BuildReference struct {
	BuildName   string `json:"build_name"`
	ProjectName string `json:"project_name"`
}

type BuildTemplateReference

type BuildTemplateReference struct {
	BuildName     string   `json:"build_name"`
	ProjectName   string   `json:"project_name"`
	ServiceModule []string `json:"service_module"`
}

type Chart

type Chart struct {
	Name       string                  `json:"name"`
	CodehostID int                     `json:"codehostID"`
	Owner      string                  `json:"owner"`
	Namespace  string                  `json:"namespace"`
	Repo       string                  `json:"repo"`
	Branch     string                  `json:"branch"`
	Path       string                  `json:"path"`
	Variables  []*models.ChartVariable `json:"variables,omitempty"`

	Files []*fs.FileInfo `json:"files,omitempty"`
}

type DockerfileDetail

type DockerfileDetail struct {
	ID        string                  `json:"id"`
	Name      string                  `json:"name"`
	Content   string                  `json:"content"`
	Variables []*models.ChartVariable `json:"variable"`
}

func GetDockerfileTemplateDetail

func GetDockerfileTemplateDetail(id string, logger *zap.SugaredLogger) (*DockerfileDetail, error)

type DockerfileListObject

type DockerfileListObject struct {
	ID   string `json:"id"`
	Name string `json:"name"`
}

type DockerfileTemplate

type DockerfileTemplate struct {
	Name    string `json:"name"`
	Content string `json:"content"`
}

type ScanningTemplateReference

type ScanningTemplateReference struct {
	ScanningName string `json:"scanning_name"`
	ScanningID   string `json:"id"`
	DisplayName  string `json:"display_name"`
	ProjectName  string `json:"project_name"`
}

type ServiceReference

type ServiceReference struct {
	ProjectName string `json:"project_name"`
	ServiceName string `json:"service_name"`
	Production  bool   `json:"production"`
}

type YamlDetail

type YamlDetail struct {
	ID                 string                           `json:"id"`
	Name               string                           `json:"name"`
	Content            string                           `json:"content"`
	VariableYaml       string                           `json:"variable_yaml"`
	ServiceVariableKVs []*commontypes.ServiceVariableKV `json:"service_variable_kvs"`
}

type YamlListObject

type YamlListObject struct {
	ID   string `json:"id"`
	Name string `json:"name"`
}

type YamlTemplate

type YamlTemplate struct {
	Name               string                           `json:"name"`
	Content            string                           `json:"content"`
	VariableYaml       string                           `json:"variable_yaml"`
	ServiceVariableKVs []*commontypes.ServiceVariableKV `json:"service_variable_kvs"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL