stash

package
v0.75.0-rc.2 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Spec

type Spec struct {
	client.Spec `yaml:",inline,omitempty"`
	//  "commitMessage" is used to generate the final commit message.
	//
	//  compatible:
	//    * scm
	//
	//  remark:
	//    it's worth mentioning that the commit message settings is applied to all targets linked to the same scm.
	CommitMessage commit.Commit `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 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: (on Linux)
	//    /tmp/updatecli/github/<owner>/<repository>
	Directory 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"`
	//  "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"`
	//	"gpg" specifies the GPG key and passphrased used for commit signing
	//
	//	compatible:
	//		* scm
	GPG sign.GPGSpec `yaml:",omitempty"`
	//	"owner" defines the owner of a repository.
	//
	//	compatible:
	//		* scm
	Owner string `yaml:",omitempty" jsonschema:"required"`
	//	repository specifies the name of a repository for a specific owner.
	//
	//	compatible:
	//		* scm
	Repository string `yaml:",omitempty" jsonschema:"required"`
	//	"user" specifies the user associated with new git commit messages created by Updatecli
	//
	//	compatible:
	//		* scm
	User string `yaml:",omitempty"`
	//  "branch" defines the git branch to work on.
	//
	//  compatible:
	//    * scm
	//
	//  default:
	//    main
	//
	//  remark:
	//    depending on which resource references the Stash 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 creates a new "working branch" based on the branch value.
	//    The working branch created by Updatecli looks like "updatecli_<pipelineID>".
	//    The working branch can be disabled using the "workingBranch" parameter set to false.
	Branch string `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: true
	WorkingBranch *bool `yaml:",omitempty"`
}

Spec defines settings used to interact with Bitbucket release

func (*Spec) Validate

func (s *Spec) Validate() error

type Stash

type Stash struct {
	// Spec contains inputs coming from updatecli configuration
	Spec Spec
	// contains filtered or unexported fields
}

Stash contains information to interact with Stash api

func New

func New(spec interface{}, pipelineID string) (*Stash, error)

New returns a new valid Bitbucket object.

func (*Stash) Add

func (s *Stash) Add(files []string) error

Add run `git add`.

func (*Stash) Checkout

func (s *Stash) Checkout() error

Checkout create and then uses a temporary git branch.

func (*Stash) Clean

func (s *Stash) Clean() error

Clean deletes github working directory.

func (*Stash) Clone

func (s *Stash) Clone() (string, error)

Clone run `git clone`.

func (*Stash) Commit

func (s *Stash) Commit(message string) error

Commit run `git commit`.

func (*Stash) GetBranches added in v0.53.0

func (s *Stash) GetBranches() (sourceBranch, workingBranch, targetBranch string)

func (*Stash) GetChangedFiles

func (s *Stash) GetChangedFiles(workingDir string) ([]string, error)

func (*Stash) GetDirectory

func (s *Stash) GetDirectory() (directory string)

GetDirectory returns the local git repository path.

func (*Stash) GetURL added in v0.53.0

func (s *Stash) GetURL() string

GetURL returns a "Stash" git URL

func (*Stash) IsRemoteBranchUpToDate

func (s *Stash) IsRemoteBranchUpToDate() (bool, error)

IsRemoteBranchUpToDate checks if the branch reference name is published on on the default remote

func (*Stash) Push

func (s *Stash) Push() (bool, error)

Push run `git push` to the corresponding Bitbucket remote branch if not already created.

func (*Stash) PushBranch

func (s *Stash) PushBranch(branch string) error

PushBranch push branch

func (*Stash) PushTag

func (s *Stash) PushTag(tag string) error

PushTag push tags

func (*Stash) SearchTags

func (s *Stash) SearchTags() (tags []string, err error)

Retrieve git tags from a remote bitbucket repository

Jump to

Keyboard shortcuts

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