shared

package
v0.0.0-...-48e0c29 Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2022 License: GPL-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	GitHubTokenEnvVar         = "GITHUB_TOKEN"
	JiraTokenEnvVar           = "JIRA_TOKEN"
	StoryPointsCustomField    = "customfield_12310243"
	OpenShiftPipelinesProject = "SRVKP"
)

Variables

This section is empty.

Functions

func GetAndUnmarshalUrl

func GetAndUnmarshalUrl(jenkinsUrl, username, password string, unmarshalTo interface{}) (int, error)

func IsStatusCodeOK

func IsStatusCodeOK(statusCode int) bool

func NewGitHubClient

func NewGitHubClient(ctx context.Context, token string) *github.Client

func NewJiraClient

func NewJiraClient(baseURL string) (*jira.Client, error)

func SchemaToJiraIssue

func SchemaToJiraIssue(schema *JiraIssueSchema, currentSprintID int) (*jira.Issue, error)

Types

type GitHubIssueSchema

type GitHubIssueSchema struct {
	URL    string
	Owner  string
	Repo   string
	Number int
}

func GitHubIssueSchemaFromURL

func GitHubIssueSchemaFromURL(urlString string) (*GitHubIssueSchema, error)

type JenkinsBuild

type JenkinsBuild struct {
	Actions []struct {
		Class      string `json:"_class,omitempty"`
		Parameters []struct {
			Class string      `json:"_class"`
			Name  string      `json:"name"`
			Value interface{} `json:"value"`
		} `json:"parameters,omitempty"`
		Causes []struct {
			Class            string `json:"_class"`
			ShortDescription string `json:"shortDescription"`
			UpstreamBuild    int    `json:"upstreamBuild"`
			UpstreamProject  string `json:"upstreamProject"`
			UpstreamUrl      string `json:"upstreamUrl"`
		} `json:"causes"`
	} `json:"actions"`
	Building        bool   `json:"building"`
	Duration        int    `json:"duration"`
	FullDisplayName string `json:"fullDisplayName"`
	ID              string `json:"id"`
	Number          int    `json:"number"`
	Result          string `json:"result"`
	Timestamp       int64  `json:"timestamp"`
	URL             string `json:"url"`
	PreviousBuild   struct {
		Number int    `json:"number"`
		URL    string `json:"url"`
	} `json:"previousBuild"`
}

func GetBuildJson

func GetBuildJson(buildURL, username, password string) (*JenkinsBuild, int, error)

GetBuildJson returns Build, status code, error

type JenkinsListView

type JenkinsListView struct {
	Class       string `json:"_class"`
	Description string `json:"description"`
	Jobs        []struct {
		Class string `json:"_class"`
		Name  string `json:"name"`
		URL   string `json:"url"`
		Color string `json:"color"`
	} `json:"jobs"`
	Name     string        `json:"name"`
	Property []interface{} `json:"property"`
	URL      string        `json:"url"`
}

func GetListViewJson

func GetListViewJson(listViewUrl, username, password string) (*JenkinsListView, error)

type JiraConfig

type JiraConfig struct {
	BaseURL string
	BoardID int
	Project string
}

type JiraIssueSchema

type JiraIssueSchema struct {
	Key                string // SRVKP-1337
	Type               string // bug, etc
	Project            string // SRVKP
	Priority           string
	Status             string
	FixVersions        []string
	Labels             []string
	Description        string
	Assignee           JiraUser
	StoryPoints        float64
	Title              string
	AddToCurrentSprint bool
}

type JiraUser

type JiraUser struct {
	Name        string
	Email       string
	DisplayName string
	Key         string
}

type JiraVersion

type JiraVersion struct {
	Name     string
	Released bool
}

func GetVersion

func GetVersion(jiraClient *jira.Client, jiraConfig *JiraConfig, version string) (*JiraVersion, error)

func GetVersions

func GetVersions(jiraClient *jira.Client, jiraConfig *JiraConfig) ([]JiraVersion, error)

Jump to

Keyboard shortcuts

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