Documentation ¶
Index ¶
Constants ¶
const ( // JiraAPIProject define project API for JIRA JiraAPIProject = "/rest/api/2/project" // JiraQIssueAll define query for all issue based on a project. JiraQIssueAll = "project = \"%s\" ORDER BY created ASC" )
Variables ¶
var (
// DEBUG debug level, set using environment J2P_DEBUG
DEBUG = 0
)
Functions ¶
func NewJiraClient ¶
NewJiraClient will create HTTP client to connect to JIRA server and do authentication using basic method (user,password).
Types ¶
type Args ¶
type Args struct { Job string Projects ProjectFlags }
Args contain command parameter passed by user. This will define what kind of object that will be migrated to Phabricator.
type Cmd ¶
type Cmd struct { Config *Config JiraCl *jira.Client GonduitCl *gonduit.Client Args Args // contains filtered or unexported fields }
Cmd contains user configuration, HTTP client for JIRA and Phabricator, and command parameters.
func (*Cmd) Init ¶
Init will, (1) get JIRA and phabricator configuration, (2) login to JIRA, (3) create gonduit client.
func (*Cmd) JiraGetProjects ¶
JiraGetProjects will query all project in JIRA filtered by command parameters `-projects` and return it.
func (*Cmd) MigrateProjects ¶
MigrateProjects will migrate all projects from JIRA to Phabricator. Here is what this function will do, (1) It will get all project from JIRA (2) For each project in JIRA (2.1) Create the project in Phabricator (2.2) If its fails -- the project already exist, get the project PHID from Phabricator (2.3) Save the first matched project as mapping for Phabricator project, since there is no way we can check other than name.
func (*Cmd) MigrateTasks ¶
MigrateTasks will migrate all task from JIRA to Phabricator based on list of project registered in `cmd.gonProjects`.
type Config ¶
type Config struct { Jira ConfigJira `json:"jira"` Phab ConfigPhabricator `json:"phabricator"` PrioritiesMap map[string]int `json:"prioritiesMap"` StatusesMap map[string]string `json:"statusesMap"` }
Config contains user configuration, read from `config` file in current directory.
type ConfigJira ¶
type ConfigJira struct { URL string `json:"url"` User string `json:"user"` Pass string `json:"pass"` SearchOpt ConfigJiraSearchOpt `json:"search_opt"` }
ConfigJira contains information about JIRA server and API options.
type ConfigJiraSearchOpt ¶
type ConfigJiraSearchOpt struct { StartAt int `json:"start_at"` MaxResults int `json:"max_results"` }
ConfigJiraSearchOpt contains options when doing query to JIRA.
type ConfigPhabricator ¶
type ConfigPhabricator struct { URL string `json:"url"` Token string `json:"token"` Secure bool `json:"secure"` }
ConfigPhabricator contains information of Phabricator server.
type ProjectFlags ¶
type ProjectFlags []string
ProjectFlags contains list of project passed through command line.
func (*ProjectFlags) Set ¶
func (prflags *ProjectFlags) Set(vv string) error
Set will parse the projects flags.
func (*ProjectFlags) String ¶
func (prflags *ProjectFlags) String() string
String return text representation of project flags.