git

package
v0.76.0-rc.4 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: 10 Imported by: 0

Documentation

Index

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 New added in v0.26.0

func New(s Spec, pipelineID string) (*Git, error)

New returns a new git object

func (*Git) Add

func (g *Git) Add(files []string) error

Add run `git add`.

func (*Git) Checkout

func (g *Git) Checkout() error

Checkout create and then uses a temporary git branch.

func (*Git) Clean

func (g *Git) Clean() error

Clean removes the current git repository from local storage.

func (*Git) Clone

func (g *Git) Clone() (string, error)

Clone run `git clone`.

func (*Git) Commit

func (g *Git) Commit(message string) error

Commit run `git commit`.

func (*Git) GetBranches added in v0.53.0

func (g *Git) GetBranches() (sourceBranch, workingBranch, targetBranch string)

func (*Git) GetChangedFiles

func (g *Git) GetChangedFiles(workingDir string) ([]string, error)

func (*Git) GetDirectory

func (g *Git) GetDirectory() (directory string)

GetDirectory returns the working git directory.

func (*Git) GetURL added in v0.53.0

func (g *Git) GetURL() string

GetURL returns a git URL

func (*Git) IsRemoteBranchUpToDate added in v0.45.0

func (g *Git) IsRemoteBranchUpToDate() (bool, error)

IsRemoteBranchUpToDate checks if the working branch should be push to remote

func (*Git) Push

func (g *Git) Push() (bool, error)

Push run `git push`.

func (*Git) PushBranch added in v0.44.0

func (g *Git) PushBranch(branch string) error

PushBranch push tags

func (*Git) PushTag

func (g *Git) PushTag(tag string) error

PushTag 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"`
	//	"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

func (gs *Spec) Merge(child interface{}) error

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

func (gs *Spec) MergeFromEnv(envPrefix string)

MergeFromEnv updates the target receiver with the "non zero-ed" environment variables

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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