Documentation
¶
Index ¶
- Constants
- func EscapeBashCharacters(s string) string
- func ExpandAndPrintVars(vars Variables)
- func ExpandEnv(s string) string
- func FindProject(remoteOrigin string) (*project, error)
- func GetAllGroupParentId(groupId int) ([]int, error)
- func GetIndexOfVar(vars []Variable, key string) int
- func IsVarPartOfScope(environment string, varScope string) bool
- func IsVarPresent(vars []Variable, key string) bool
- type GitlabApiClient
- type GitlabGroup
- type GitlabNamespace
- type GitlabProject
- type HTTPClient
- type Variable
- type Variables
Constants ¶
const GitlabApiVersion = "v4"
Variables ¶
This section is empty.
Functions ¶
func EscapeBashCharacters ¶
function EscapeBashCharacters espace bash characters
func ExpandAndPrintVars ¶
func ExpandAndPrintVars(vars Variables)
ExpandAndPrintVars expands the variables and prints them to stdout
func ExpandEnv ¶
ExpandEnv replaces ${var} or $var in the string based on the values of the current environment variables. The replacement is case-sensitive. References to undefined variables are replaced by the empty string. A default value can be given by using the form ${var:-default value}. The default value is used only if var is unset or empty. A different value can be given by using the form ${var:default value}. The default value is used if var is unset. References to other variables are expanded as the string is processed. Recursive references are not allowed. If there is an error in the syntax of the variable reference, the reference is replaced by the empty string.
func FindProject ¶
func GetAllGroupParentId ¶
func GetIndexOfVar ¶
GetIndexOfVar returns the index of a variable in a list of variables
func IsVarPartOfScope ¶
IsVarPartOfScope is checking if the environment is part of the scope for example if the environment is "staging" and the scope is "staging" it returns true if the environment is "staging" and the scope is "staging*" it returns true if the environment is "staging/mtrg" and the scope is "staging*" it returns true if the environment is "staging/mtrg" and the scope is "production" it returns false
func IsVarPresent ¶
IsVarPresent checks if a variable is present in a list of variables
Types ¶
type GitlabApiClient ¶
type GitlabApiClient struct {
HttpClient HTTPClient
}
func NewGitlapApiClient ¶
func NewGitlapApiClient() *GitlabApiClient
type GitlabGroup ¶
type GitlabGroup struct {
Id int `json:"id"`
Name string `json:"name"`
ParentId int `json:"parent_id"`
}
func GetGroup ¶
func GetGroup(groupId int) (*GitlabGroup, error)
func (*GitlabGroup) GetAllGroupParentId ¶
func (g *GitlabGroup) GetAllGroupParentId() ([]int, error)
func (*GitlabGroup) GetAllVars ¶
func (g *GitlabGroup) GetAllVars(scope string) ([]Variable, error)
func (*GitlabGroup) GetParentId ¶
func (g *GitlabGroup) GetParentId() int
func (*GitlabGroup) GetVarsOfGroup ¶
func (g *GitlabGroup) GetVarsOfGroup(scope string) (Variables, error)
func (*GitlabGroup) IsRootGroup ¶
func (g *GitlabGroup) IsRootGroup() bool
type GitlabNamespace ¶
type GitlabProject ¶
type GitlabProject struct {
Id int `json:"id"`
Namespace GitlabNamespace `json:"namespace"`
}
func GetProject ¶
func GetProject(projectId int) (*GitlabProject, error)
func (*GitlabProject) GetAllVars ¶
func (p *GitlabProject) GetAllVars(scope string) ([]Variable, error)
func (*GitlabProject) GetGroupId ¶
func (r *GitlabProject) GetGroupId() int
func (*GitlabProject) GetVarsOfProject ¶
func (p *GitlabProject) GetVarsOfProject(scope string) (Variables, error)
func (*GitlabProject) IsRootGroup ¶
func (r *GitlabProject) IsRootGroup() bool
type Variable ¶
type Variable struct {
VariableType string `json:"variable_type"`
Key string `json:"key"`
Value string `json:"value"`
Protected bool `json:"protected"`
Masked bool `json:"masked"`
Raw bool `json:"raw"`
EnvironmentScope string `json:"environment_scope"`
}
type Variables ¶
type Variables []Variable
func FilterVars ¶
FilterVars filters the variables based on the scope
func (Variables) GetVarOfScope ¶
GetVarOfScope returns the variable of a scope