Пример #1
0
func (tracker *issueTracker) getVersionResource(ver *version.Version) (*jira.Version, error) {
	var (
		projectKey  = tracker.config.ProjectKey()
		versionName = ver.ReleaseTagString()
		api         = newClient(tracker.config)
	)

	// In case the resource cache is empty, fill it.
	if tracker.versionCache == nil {
		vs, _, err := api.Projects.ListVersions(projectKey)
		if err != nil {
			return nil, err
		}

		m := make(map[string]*jira.Version, len(vs))
		for _, v := range vs {
			m[v.Name] = v
		}
		tracker.versionCache = m
	}

	// Return the resource we are looking for.
	if res, ok := tracker.versionCache[versionName]; ok {
		return res, nil
	}
	return nil, nil
}
Пример #2
0
func (tracker *issueTracker) issuesByRelease(v *version.Version) ([]*jira.Issue, error) {
	label := v.ReleaseTagString()
	return tracker.searchIssues("labels = %v", label)
}