tasks

package
v0.0.0-...-1fa52ee Latest Latest
Warning

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

Go to latest
Published: Apr 3, 2024 License: Apache-2.0, BSD-2-Clause, ISC, + 1 more Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const RAW_ACCOUNTS_TABLE = "github_graphql_accounts"
View Source
const (
	RAW_DEPLOYMENT = "github_graphql_deployment"
)
View Source
const RAW_GRAPHQL_JOBS_TABLE = "github_graphql_jobs"
View Source
const RAW_ISSUES_TABLE = "github_graphql_issues"
View Source
const RAW_PRS_TABLE = "github_graphql_prs"

Variables

View Source
var CollectAccountMeta = plugin.SubTaskMeta{
	Name:             "Collect Users",
	EntryPoint:       CollectAccount,
	EnabledByDefault: true,
	Description:      "Collect Account data from GithubGraphql api, does not support either timeFilter or diffSync.",
	DomainTypes:      []string{plugin.DOMAIN_TYPE_CROSS},
}
View Source
var CollectDeploymentsMeta = plugin.SubTaskMeta{
	Name:             "Collect Deployments",
	EntryPoint:       CollectDeployments,
	EnabledByDefault: true,
	Description:      "collect github deployments to raw and tool layer from GithubGraphql api",
	DomainTypes:      []string{plugin.DOMAIN_TYPE_CICD},
}
View Source
var CollectIssuesMeta = plugin.SubTaskMeta{
	Name:             "Collect Issues",
	EntryPoint:       CollectIssues,
	EnabledByDefault: true,
	Description:      "Collect Issue data from GithubGraphql api, supports both timeFilter and diffSync.",
	DomainTypes:      []string{plugin.DOMAIN_TYPE_TICKET},
}
View Source
var CollectJobsMeta = plugin.SubTaskMeta{
	Name:             "Collect Job Runs",
	EntryPoint:       CollectJobs,
	EnabledByDefault: true,
	Description:      "Collect Jobs(CheckRun) data from GithubGraphql api, supports both timeFilter and diffSync.",
	DomainTypes:      []string{plugin.DOMAIN_TYPE_CICD},
}
View Source
var CollectPrsMeta = plugin.SubTaskMeta{
	Name:             "Collect Pull Requests",
	EntryPoint:       CollectPrs,
	EnabledByDefault: true,
	Description:      "Collect Pr data from GithubGraphql api, supports both timeFilter and diffSync.",
	DomainTypes:      []string{plugin.DOMAIN_TYPE_CODE_REVIEW},
}
View Source
var ExtractAccountsMeta = plugin.SubTaskMeta{
	Name:             "Extract Users",
	EntryPoint:       ExtractAccounts,
	EnabledByDefault: true,
	Description:      "extract raw account data into tool layer table github_accounts",
	DomainTypes:      []string{plugin.DOMAIN_TYPE_CROSS},
}
View Source
var ExtractDeploymentsMeta = plugin.SubTaskMeta{
	Name:             "Extract Deployments",
	EntryPoint:       ExtractDeployments,
	EnabledByDefault: true,
	Description:      "extract raw deployment data into tool layer table github_graphql_deployment",
	DomainTypes:      []string{plugin.DOMAIN_TYPE_CICD},
}
View Source
var ExtractIssuesMeta = plugin.SubTaskMeta{
	Name:             "Extract Issues",
	EntryPoint:       ExtractIssues,
	EnabledByDefault: true,
	Description:      "Extract raw Issues data into tool layer table github_issues",
	DomainTypes:      []string{plugin.DOMAIN_TYPE_TICKET},
}
View Source
var ExtractJobsMeta = plugin.SubTaskMeta{
	Name:             "Extract Jobs",
	EntryPoint:       ExtractJobs,
	EnabledByDefault: true,
	Description:      "Extract raw run data into tool layer table github_jobs",
	DomainTypes:      []string{plugin.DOMAIN_TYPE_CICD},
}
View Source
var ExtractPrsMeta = plugin.SubTaskMeta{
	Name:             "Extract Pull Requests",
	EntryPoint:       ExtractPrs,
	EnabledByDefault: true,
	Description:      "Extract raw PullRequests data into tool layer table github_pull_requests",
	DomainTypes:      []string{plugin.DOMAIN_TYPE_CODE_REVIEW},
}

Functions

func CollectAccount

func CollectAccount(taskCtx plugin.SubTaskContext) errors.Error

func CollectDeployments

func CollectDeployments(taskCtx plugin.SubTaskContext) errors.Error

CollectDeployments will request github api via graphql and store the result into raw layer.

func CollectIssues

func CollectIssues(taskCtx plugin.SubTaskContext) errors.Error

func CollectJobs

func CollectJobs(taskCtx plugin.SubTaskContext) errors.Error

func CollectPrs

func CollectPrs(taskCtx plugin.SubTaskContext) errors.Error

func ExtractAccounts

func ExtractAccounts(taskCtx plugin.SubTaskContext) errors.Error

func ExtractDeployments

func ExtractDeployments(taskCtx plugin.SubTaskContext) errors.Error

func ExtractIssues

func ExtractIssues(taskCtx plugin.SubTaskContext) errors.Error

func ExtractJobs

func ExtractJobs(taskCtx plugin.SubTaskContext) errors.Error

func ExtractPrs

func ExtractPrs(taskCtx plugin.SubTaskContext) errors.Error

Types

type GithubAccountEdge

type GithubAccountEdge struct {
	Login     string
	Id        int `graphql:"databaseId"`
	Name      string
	Company   string
	Email     string
	AvatarUrl string
	HtmlUrl   string `graphql:"url"`
}

type GraphqlInlineAccountQuery

type GraphqlInlineAccountQuery struct {
	GithubAccountEdge `graphql:"... on User"`
}

type GraphqlQueryAccount

type GraphqlQueryAccount struct {
	Login     string
	Id        int `graphql:"databaseId"`
	Name      string
	Company   string
	Email     string
	AvatarUrl string
	HtmlUrl   string `graphql:"url"`
	//Type      string
	Organizations struct {
		Nodes []struct {
			Email      string
			Name       string
			DatabaseId int
			Login      string
		}
	} `graphql:"organizations(first: 10)"`
}

type GraphqlQueryAccountWrapper

type GraphqlQueryAccountWrapper struct {
	RateLimit struct {
		Cost int
	}
	Users []GraphqlQueryAccount `graphql:"user(login: $login)" graphql-extend:"true"`
}

type GraphqlQueryCheckRunWrapper

type GraphqlQueryCheckRunWrapper struct {
	RateLimit struct {
		Cost int
	}
	Node []GraphqlQueryCheckSuite `graphql:"node(id: $id)" graphql-extend:"true"`
}

type GraphqlQueryCheckSuite

type GraphqlQueryCheckSuite struct {
	Id       string
	Typename string `graphql:"__typename"`
	// equal to Run in rest
	CheckSuite struct {
		WorkflowRun struct {
			DatabaseId int
		}
		// equal to Job in rest
		CheckRuns struct {
			TotalCount int
			Nodes      []struct {
				Id          string
				Name        string
				DetailsUrl  string
				DatabaseId  int
				Status      string
				StartedAt   *time.Time
				Conclusion  string
				CompletedAt *time.Time

				Steps struct {
					TotalCount int
					Nodes      []struct {
						CompletedAt         *time.Time `json:"completed_at"`
						Conclusion          string     `json:"conclusion"`
						Name                string     `json:"name"`
						Number              int        `json:"number"`
						SecondsToCompletion int        `json:"seconds_to_completion"`
						StartedAt           *time.Time `json:"started_at"`
						Status              string     `json:"status"`
					}
				} `graphql:"steps(first: 50)"`
			}
		} `graphql:"checkRuns(first: 50)"`
	} `graphql:"... on CheckSuite"`
}

type GraphqlQueryCommit

type GraphqlQueryCommit struct {
	Commit struct {
		Oid     string
		Message string
		Author  struct {
			Name  string
			Email string
			Date  time.Time
			User  *GraphqlInlineAccountQuery
		}
		Committer struct {
			Date  time.Time
			Email string
			Name  string
		}
	}
	Url string
}

type GraphqlQueryDeploymentDeployment

type GraphqlQueryDeploymentDeployment struct {
	Task        string `graphql:"task"` // is value always "deploy"? not sure.
	Id          string `graphql:"id"`
	CommitOid   string `graphql:"commitOid"`
	Environment string `graphql:"environment"`
	State       string `graphql:"state"`
	DatabaseId  uint   `graphql:"databaseId"`
	Description string `graphql:"description"`
	Payload     string `graphql:"payload"`
	Ref         *struct {
		ID     string `graphql:"id"`
		Name   string `graphql:"name"`
		Prefix string `graphql:"prefix"`
	} `graphql:"ref"`
	LatestStatus struct {
		Id        string     `graphql:"id"`
		State     string     `graphql:"state"`
		UpdatedAt *time.Time `json:"updatedAt"`
	} `graphql:"latestStatus"`
	Repository struct {
		Id   string `graphql:"id"`
		Name string `graphql:"name"`
		Url  string `graphql:"url"`
	} `graphql:"repository"`
	CreatedAt time.Time
	UpdatedAt time.Time
}

type GraphqlQueryDeploymentWrapper

type GraphqlQueryDeploymentWrapper struct {
	RateLimit struct {
		Cost int `graphql:"cost"`
	} `graphql:"rateLimit"`
	Repository struct {
		Deployments struct {
			TotalCount  graphql.Int                        `graphql:"totalCount"`
			PageInfo    *helper.GraphqlQueryPageInfo       `graphql:"pageInfo"`
			Deployments []GraphqlQueryDeploymentDeployment `graphql:"nodes"`
		} `graphql:"deployments(first: $pageSize, after: $skipCursor, orderBy: {field: CREATED_AT, direction: DESC})"`
	} `graphql:"repository(owner: $owner, name: $name)"`
}

type GraphqlQueryIssue

type GraphqlQueryIssue struct {
	DatabaseId   int
	Number       int
	State        string
	StateReason  string
	Title        string
	Body         string
	Author       *GraphqlInlineAccountQuery
	Url          string
	ClosedAt     *time.Time
	CreatedAt    time.Time
	UpdatedAt    time.Time
	AssigneeList struct {
		// FIXME now domain layer just support one assignee
		Assignees []GraphqlInlineAccountQuery `graphql:"nodes"`
	} `graphql:"assignees(first: 100)"`
	Milestone *struct {
		Number int
	} `json:"milestone"`
	Labels struct {
		Nodes []struct {
			Id   string
			Name string
		}
	} `graphql:"labels(first: 100)"`
}

type GraphqlQueryIssueWrapper

type GraphqlQueryIssueWrapper struct {
	RateLimit struct {
		Cost int
	}
	Repository struct {
		IssueList struct {
			TotalCount graphql.Int
			Issues     []GraphqlQueryIssue `graphql:"nodes"`
			PageInfo   *helper.GraphqlQueryPageInfo
		} `graphql:"issues(first: $pageSize, after: $skipCursor, orderBy: {field: UPDATED_AT, direction: DESC})"`
	} `graphql:"repository(owner: $owner, name: $name)"`
}

type GraphqlQueryPr

type GraphqlQueryPr struct {
	DatabaseId int
	Number     int
	State      string
	Title      string
	Body       string
	Url        string
	Labels     struct {
		Nodes []struct {
			Id   string
			Name string
		}
	} `graphql:"labels(first: 100)"`
	Author    *GraphqlInlineAccountQuery
	Assignees struct {
		// FIXME now domain layer just support one assignee
		Assignees []GraphqlInlineAccountQuery `graphql:"nodes"`
	} `graphql:"assignees(first: 1)"`
	ClosedAt    *time.Time
	MergedAt    *time.Time
	UpdatedAt   time.Time
	CreatedAt   time.Time
	MergeCommit *struct {
		Oid string
	}
	HeadRefName string
	HeadRefOid  string
	BaseRefName string
	BaseRefOid  string
	Commits     struct {
		PageInfo   *api.GraphqlQueryPageInfo
		Nodes      []GraphqlQueryCommit `graphql:"nodes"`
		TotalCount graphql.Int
	} `graphql:"commits(first: 100)"`
	Reviews struct {
		TotalCount graphql.Int
		Nodes      []GraphqlQueryReview `graphql:"nodes"`
	} `graphql:"reviews(first: 100)"`
}

type GraphqlQueryPrWrapper

type GraphqlQueryPrWrapper struct {
	RateLimit struct {
		Cost int
	}
	// now it orderBy UPDATED_AT and use cursor pagination
	// It may miss some PRs updated when collection.
	// Because these missed PRs will be collected on next, But it's not enough.
	// So Next Millstone(0.17) we should change it to filter by CREATE_AT + collect detail
	Repository struct {
		PullRequests struct {
			PageInfo   *api.GraphqlQueryPageInfo
			Prs        []GraphqlQueryPr `graphql:"nodes"`
			TotalCount graphql.Int
		} `graphql:"pullRequests(first: $pageSize, after: $skipCursor, orderBy: {field: CREATED_AT, direction: DESC})"`
	} `graphql:"repository(owner: $owner, name: $name)"`
}

type GraphqlQueryReview

type GraphqlQueryReview struct {
	Body       string
	Author     *GraphqlInlineAccountQuery
	State      string `json:"state"`
	DatabaseId int    `json:"databaseId"`
	Commit     struct {
		Oid string
	}
	SubmittedAt *time.Time `json:"submittedAt"`
}

type SimpleAccount

type SimpleAccount struct {
	Login string
}

type SimpleWorkflowRun

type SimpleWorkflowRun struct {
	CheckSuiteNodeID string
}

Jump to

Keyboard shortcuts

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