Skip to content

anthonydahanne/stash

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

65 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Stash tools

Go package of Stash tools

Installation

make

Usage

go get github.com/xoom/stash

import "github.com/xoom/stash"

Stash Rest API Documentation

NewClient

stashClient := stash.NewClient("stash_user", "stash_pwd", "http://stash-url.local:7990")

CreateRepository

repository, err := stashClient.CreateRepository("PROJ", "slug")

GetRepositories

repository, err := stashClient.GetRepository("PROJ", "slug")

GetBranches

branches, err := stashClient.GetBranches("PROJ", "slug")

GetRepository

repository, err := stashClient.GetRepository("PROJ", "slug")

CreateBranchRestriction

branchRestriction, err := stashClient.CreateBranchRestriction("PROJ", "slug", "develop", "user")

GetBranchRestrictions

branchRestrictions, err := stashClient.GetBranchRestrictions("PROJ", "slug")

DeleteBranchRestriction

err := stashClient.DeleteBranchRestriction("PROJ", "slug", branchRestriction.Id)

GetPullRequests

// get all pull requests
pullRequests, err := stashClient.GetPullRequests("PROJ", "slug", "")

// get pull request by state
state := "OPEN"
pullRequests, err := stashClient.GetPullRequests("PROJ", "slug", state)

CreatePullRequest

title     := "A Title"
des       := "A Description"
from      := "feature/file1"
to        := "develop"
reviewers := []string{"bob", "bill"}

pullRequest, err := stashClient.CreatePullRequest("PROJ", "slug", title, desc, from, to, reviewers)

GetRawFile

filePath := "foo/bar"
branch   := "develop"

data, _ := stashClient.GetRawFile("PRJ", "slug", filePath, branch)

fmt.Println(string(data))

stash

Development

Local stash instance

Download and run a development instance of stash via a docker image.

# pick a directory where to save the data generated by the container
export STASH_DATA="${HOME}/stash/data"

# for a linux host
$ docker run -u root -v $STASH_DATA:/var/atlassian/application-data/stash atlassian/stash chown -R daemon  /var/atlassian/application-data/stash

$ docker run -v $STASH_DATA:/var/atlassian/application-data/stash --name="stash" -d -p 7990:7990 -p 7999:7999 atlassian/stash

# for a MacOs Host via 'boot2docker'
$ docker run -u root -v $STASH_DATA:/var/atlassian/application-data/stash --name=stash -d -p 7990:7990 -p 7999:7999 atlassian/stash

Open your browser to http://localhost:7990 and follow the setup instructions.

** If your are using boot2docker get your IP via boot2docker ip

About

Go package of Stash tools

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published