git

package
v0.77.5 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2024 License: Apache-2.0 Imports: 12 Imported by: 0

README

Version Control/Git Service

This service uses gopkg.in/src-d/go-git.v4 git client

Service Id Action Description Request Response
version/control status run version control check on provided URL StatusRequest Info
version/control checkout if target directory already exist with matching origin URL, this action only pulls the latest changes without overriding local ones, otherwise full checkout CheckoutRequest Info

Usage

Checkout/pull

  1. Basic checkout
    pipeline:
      checkout:
        action: vc/git:checkout
        origin:
          URL: https://github.com/src-d/go-git
        dest:
          URL: /tmp/foo
    
  2. Private repo with basic auth
    pipeline:
      checkout:
        action: vc/git:checkout
        origin:
          URL: https://github.com/myacount/myrepo.git
          credentials: myacount
        dest:
          URL: /tmp/myrepo
    
  3. Private key based auth
    • endly -c=myacountpk -k=/path/key_rsa where username is git and password is pharaprase
    • endly -r=checkout
    • @checkout.yaml
    pipeline:
      checkout:
        action: vc/git:checkout
        origin:
          URL: git@github.com/myacount/myrepo.git
          credentials: myrepopk
        dest:
          URL: /tmp/myrepo
    

Committing changes

  • endly -c=myacount
    init:
      target:
        URL: ssh://127.0.0.1
        credentials: localhost
    
    pipeline:
      checkout:
        action: vc/git:checkout
        origin:
          URL: https://github.com/adrianwit/echo
        dest:
          URL: /tmp/echo
    
      update:
        action: exec:run
        target: $target
        commands:
          - echo ' ' >> /tmp/echo/app.go
    
      commit:
        action: vc/git:commit
        message: test commit
        credentials: git
        source:
          URL: /tmp/echo
    

Documentation

Index

Constants

View Source
const ServiceID = "vc/git"

Variables

This section is empty.

Functions

func New

func New() endly.Service

Types

type CheckoutRequest

type CheckoutRequest struct {
	Origin *location.Resource `required:"true" description:"checkout source for git or svn or simply file::/path"`
	Dest   *location.Resource `required:"true" description:"checkout dest defined by host and path URL"`
	Depth  int
}

CheckoutRequest represents checkout request. If target directory exist and contains matching origin URL, only taking the latest changes without overriding local if performed, otherwise full checkout

func (*CheckoutRequest) Init

func (r *CheckoutRequest) Init() error

Init initializes request

func (*CheckoutRequest) Validate

func (r *CheckoutRequest) Validate() error

Validate validates request

type CheckoutResponse

type CheckoutResponse StatusResponse

CheckoutResponse represents checkout response

type CommitRequest

type CommitRequest struct {
	Source      *location.Resource `required:"true" description:"location to local source code"`
	Message     string             `required:"true"`
	Credentials string
}

CommitRequest represents a commit request

func (*CommitRequest) Init

func (r *CommitRequest) Init() error

Init initializes request

func (*CommitRequest) Validate

func (r *CommitRequest) Validate() error

Validate validates request

type CommitResponse

type CommitResponse struct {
	*Info
}

CommitResponse represents a commit response

type Info

type Info struct {
	IsVersionControlManaged bool   //returns true if directory is source controlled managed
	Origin                  string //Origin URL
	Revision                string //Origin Revision
	Branch                  string //current branch
	IsUptoDate              bool
	Added                   []string //new files
	Untracked               []string //untracked files
	Modified                []string //modified files
	Deleted                 []string //deleted files
}

Info represents version control info

func NewInfo

func NewInfo() *Info

NewInfo create new info

func (*Info) HasPendingChanges

func (r *Info) HasPendingChanges() bool

HasPendingChanges returns true if there are any untracked, new, modified, deleted files.

type OutputEvent

type OutputEvent struct {
	*msg.OutputEvent
}

OutputEvent represents an output event

type StatusRequest

type StatusRequest struct {
	Source *location.Resource `required:"true"`
}

StatusRequest represents version control status

func (*StatusRequest) Init

func (r *StatusRequest) Init() error

Init initializes request

func (*StatusRequest) Validate

func (r *StatusRequest) Validate() error

Validate validates request

type StatusResponse

type StatusResponse struct {
	*Info
}

StatusResponse represents version control status response

Jump to

Keyboard shortcuts

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