Documentation
¶
Index ¶
- type Git
- func (g *Git) Add(files []string) error
- func (g *Git) Checkout() error
- func (g *Git) Clean() error
- func (g *Git) Clone() (string, error)
- func (g *Git) Commit(message string) error
- func (g *Git) GetBranches() (sourceBranch, workingBranch, targetBranch string)
- func (g *Git) GetChangedFiles(workingDir string) ([]string, error)
- func (g *Git) GetDirectory() (directory string)
- func (g *Git) GetURL() string
- func (g *Git) IsRemoteBranchUpToDate() (bool, error)
- func (g *Git) Push() (bool, error)
- func (g *Git) PushBranch(branch string) error
- func (g *Git) PushTag(tag string) error
- type Spec
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Git ¶
type Git struct {
// contains filtered or unexported fields
}
Git contains the git scm handler
func (*Git) GetBranches ¶ added in v0.53.0
func (*Git) GetDirectory ¶
GetDirectory returns the working git directory.
func (*Git) IsRemoteBranchUpToDate ¶ added in v0.45.0
IsRemoteBranchUpToDate checks if the working branch should be push to remote
func (*Git) PushBranch ¶ added in v0.44.0
PushBranch push tags
type Spec ¶ added in v0.26.0
type Spec struct {
// "url" specifies the git url to work on.
//
// compatible:
// * scm
//
// example:
// * git@github.com:updatecli/updatecli.git
// * https://github.com/updatecli/updatecli.git
//
// remarks:
// when using the ssh protocol, the user must have the right to clone the repository
// based on its local ssh configuration
URL string `yaml:",omitempty" jsonschema:"required"`
// "username" specifies the username when using the HTTP protocol
//
// compatible
// * scm
Username string `yaml:",omitempty"`
// "password" specifies the password when using the HTTP protocol
//
// compatible:
// * scm
Password string `yaml:",omitempty"`
// "branch" defines the git branch to work on.
//
// compatible:
// * scm
//
// default:
// main
//
// remark:
// depending on which resource references the GitHub scm, the behavior will be different.
//
// If the scm is linked to a source or a condition (using scmid), the branch will be used to retrieve
// file(s) from that branch.
//
// If the scm is linked to target then Updatecli will push any changes to that branch
//
// For more information, please refer to the following issue:
// https://github.com/updatecli/updatecli/issues/1139
Branch string `yaml:",omitempty"`
// WorkingBranchPrefix defines the prefix used to create a working branch.
//
// compatible:
// * scm
//
// default:
// updatecli
//
// remark:
// A working branch is composed of three components:
// 1. WorkingBranchPrefix
// 2. Target Branch
// 3. PipelineID
//
// If WorkingBranchPrefix is set to ”, then
// the working branch will look like "<branch>_<pipelineID>".
WorkingBranchPrefix *string `yaml:",omitempty"`
// WorkingBranchSeparator defines the separator used to create a working branch.
//
// compatible:
// * scm
//
// default:
// "_"
WorkingBranchSeparator *string `yaml:",omitempty"`
// "user" specifies the user associated with new git commit messages created by Updatecli
//
// compatible:
// * scm
User string `yaml:",omitempty"`
// "email" defines the email used to commit changes.
//
// compatible:
// * scm
//
// default:
// default set to your global git configuration
Email string `yaml:",omitempty"`
// "directory" defines the local path where the git repository is cloned.
//
// compatible:
// * scm
//
// remark:
// Unless you know what you are doing, it is highly recommended to use the default value.
// The reason is that Updatecli may automatically clean up the directory after a pipeline execution.
//
// default:
// The default value is based on your local temporary directory like /tmp/updatecli/<url> on Linux
Directory string `yaml:",omitempty"`
// "force" is used during the git push phase to run `git push --force`.
//
// compatible:
// * scm
//
// default:
// false
//
// remark:
// When force is set to true, Updatecli also recreate the working branches that
// diverged from their base branch.
Force bool `yaml:",omitempty"`
// "commitMessage" is used to generate the final commit message.
//
// compatible:
// * scm
//
// remark:
// it's worth mentioning that the commit message is applied to all targets linked to the same scm.
//
// default:
// false
CommitMessage commit.Commit `yaml:",omitempty"`
// "gpg" specifies the GPG key and passphrased used for commit signing
//
// compatible:
// * scm
GPG sign.GPGSpec `yaml:",omitempty"`
// "submodules" defines if Updatecli should checkout submodules.
//
// compatible:
// * scm
//
// default: true
Submodules *bool `yaml:",omitempty"`
// "workingBranch" defines if Updatecli should use a temporary branch to work on.
// If set to `true`, Updatecli create a temporary branch to work on, based on the branch value.
//
// compatible:
// * scm
//
// default: false
WorkingBranch *bool `yaml:",omitempty"`
}
Spec contains settings to manipulate a git repository.
func (*Spec) Merge ¶ added in v0.28.0
Merge returns nil if it successfully merges the child Spec into target receiver. Please note that child attributes always overrides receiver's
func (*Spec) MergeFromEnv ¶ added in v0.28.0
MergeFromEnv updates the target receiver with the "non zero-ed" environment variables
Click to show internal directories.
Click to hide internal directories.