Documentation ¶
Index ¶
- func AbsPath(path string) string
- func DescImage(r string) (v1.Image, name.Reference, error)
- func ExecCmd(command string, dryRun bool) (string, string, error)
- func FailOnError(err error)
- func FindCodeChange(repository *git.Repository, fromHash plumbing.Hash, pathes []string) ([]plumbing.Hash, error)
- func FormatTags(tags *map[plumbing.Hash]*plumbing.Reference) map[string]string
- func GetImageEnVarPrefix(image string) (string, error)
- func GetRepoRoot(gitRepo *git.Repository) (string, error)
- func GitSemverTagMap(repo git.Repository) (*map[plumbing.Hash]*plumbing.Reference, error)
- func HasDiff(current *object.Commit, ancestor *object.Commit, root string, pathes []string) (bool, error)
- func Infof(format string, args ...interface{})
- func IsDirty(s git.Status) bool
- func IsFileInSourcePathes(root string, filePath string, sourcePathes []string) (bool, error)
- func IsPathInSubdirectory(absFilePath, absSubdirectory string) (bool, error)
- func LastDir(permalink string) (string, error)
- func ListTags(src string) ([]string, error)
- func NewCoreProject(repository_path string, forcedBranch string) (Project, ProjConfig, error)
- func TestGetVersion(t *testing.T)
- func TestUpgradeTag(t *testing.T)
- func Warnf(format string, args ...interface{})
- type DepConfig
- type Dependency
- type Git
- func (gitObj *Git) CloneOrOpen(destBasePath string, singleBranch bool) error
- func (repo *Git) CreateBranch(branchName string) error
- func (g *Git) GetBranch() (string, error)
- func (gitObj *Git) GetEnVarPrefix() (string, error)
- func (g *Git) GetHeadRevision() (*GitRevision, error)
- func (gitObj *Git) GetName() (string, error)
- func (g *Git) GetRevision(hash plumbing.Hash) (*GitRevision, error)
- func (git *Git) GetRoot() (string, error)
- func (git *Git) GoInstall() error
- func (gitObj *Git) HasBranch(branchname string) (bool, string, error)
- func (git *Git) IsGoModule() (bool, error)
- func (gitObj *Git) LsRemote() error
- func (gitObj *Git) MainBranch() (string, string, error)
- func (gitObj *Git) OpenIfExists(destBasePath string) error
- func (repo *Git) TaggedCommit(filename string, message string, tag string, annotatedTag bool, ...) (*plumbing.Hash, *plumbing.Reference, error)
- type GitRevision
- type Image
- type ProjConfig
- type Project
- func (p *Project) AddInPlaceDepsSources(basePath string) error
- func (p *Project) CheckDepImages() ([]name.Reference, error)
- func (p *Project) GetGits() []*Git
- func (project *Project) GetImageName(suffix string, checkRegistry bool) error
- func (p *Project) InstallGoModules() (string, error)
- func (p *Project) RetrieveDepsSources(basePath string) error
- func (p *Project) String() string
- func (p *Project) WriteOutConfig() (string, error)
- type SemVer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FailOnError ¶
func FailOnError(err error)
func FindCodeChange ¶
func FindCodeChange(repository *git.Repository, fromHash plumbing.Hash, pathes []string) ([]plumbing.Hash, error)
FindCodeChange returns:
- the latest ancestor commit for which the source code has changed, then list of following commits for which the source code has not changed
- an error if any
func FormatTags ¶
FormatTags convert a map of tags to a map of human readable tags
func GetImageEnVarPrefix ¶
func GetRepoRoot ¶
func GitSemverTagMap ¶
GitSemverTagMap ...
func Infof ¶
func Infof(format string, args ...interface{})
Infof should be used to describe the example commands that are about to run.
func IsDirty ¶
func IsDirty(s git.Status) bool
IsDirty returns true if all the files are in Unmodified or Untracked status.
func IsFileInSourcePathes ¶
IsFileInSourcePathes checks if the given file path is in one of the given subdirectories If subdirectories is empty, it returns true becuase the file path must be in the root directory
func IsPathInSubdirectory ¶
IsPathInSubdirectory checks if the given file path is in the given subdirectory all paths must be absolute or function will have non-deterministic behavior
func NewCoreProject ¶
func NewCoreProject(repository_path string, forcedBranch string) (Project, ProjConfig, error)
func TestGetVersion ¶
func TestUpgradeTag ¶
Types ¶
type DepConfig ¶
type DepConfig struct { Url string `mapstructure:"url" default:""` Clone bool `mapstructure:"clone" default:"false"` Image string `mapstructure:"image" default:""` Pull bool `mapstructure:"pull" default:"false"` Package string `mapstructure:"package" default:""` Labels labels.Set `mapstructure:"labels"` }
type Dependency ¶
func (*Dependency) GetImageName ¶
func (dep *Dependency) GetImageName(imageRegistry string) (string, error)
func (*Dependency) String ¶
func (dep *Dependency) String() string
type Git ¶
type Git struct { InPlace bool RemoteTags []string RemoteBranches []string Url string Repository *git.Repository // Hash for the HEAD of the remote work branch RemoteHash string WorkBranch string }
func (*Git) CloneOrOpen ¶
CloneOrOpen clones a git repository or opens it if it already exists destBasePath is the base path where the repository will be cloned, if empty a temporary directory is created if singleBranch is true, only the work branch is cloned
func (*Git) CreateBranch ¶
func (*Git) GetEnVarPrefix ¶
func (*Git) GetHeadRevision ¶
func (g *Git) GetHeadRevision() (*GitRevision, error)
GetHeadRevision the reference as 'git describe ' will do
func (*Git) GetRevision ¶
func (g *Git) GetRevision(hash plumbing.Hash) (*GitRevision, error)
GetRevision returns the reference as 'git checkout <hash> && git describe ' would do
func (*Git) HasBranch ¶
HasBranch returns true if the branch exists in the repository and the hash of the branch HEAD it works for local and remote repositories
func (*Git) IsGoModule ¶
func (*Git) LsRemote ¶
LsRemote returns branches and tag of a remote repository https://github.com/go-git/go-git/blob/master/_examples/ls-remote/main.go
func (*Git) OpenIfExists ¶
type GitRevision ¶
func (*GitRevision) GetVersion ¶
func (rev *GitRevision) GetVersion() string
GetVersion returns the reference as 'git describe ' will do except that tag is the latest semver annotated tag
func (*GitRevision) IsRelease ¶
func (rev *GitRevision) IsRelease() bool
func (*GitRevision) UpgradeTag ¶
func (rev *GitRevision) UpgradeTag() (string, error)
type Image ¶
type ProjConfig ¶
type ProjConfig struct { Registry string `mapstructure:"registry" default:""` Dependencies []DepConfig `mapstructure:"dependencies"` SourcePathes []string `mapstructure:"sourcePathes"` }
func NewConfig ¶
func NewConfig(repositoryPath string) (ProjConfig, error)
NewConfig reads ciux config file to buld a Config struct it uses repositoryPath if not null or current directory
type Project ¶
type Project struct { GitMain *Git SourcePathes []string ImageRegistry string Image Image Dependencies []*Dependency // Required for github actions, which fetch a single commit by default ForcedBranch string TemporaryRegistry string LabelSelector string }
func NewProject ¶
func NewProject(repository_path string, forcedBranch string, mainProjectOnly bool, labelSelector string) (Project, error)
NewProject creates a new Project struct It reads the repository_path/.ciux.yaml configuration file and retrieve the work branch for all dependencies
func (*Project) AddInPlaceDepsSources ¶
func (*Project) GetImageName ¶
GetImageName compute the name and tag for the project image
it checks the git repository for changes a suffix can be added to image name image existence in the registry can be checked
func (*Project) InstallGoModules ¶
func (*Project) RetrieveDepsSources ¶
func (*Project) WriteOutConfig ¶
WriteOutConfig writes out the shell configuration file used be the CI/CD pipeline