tasks

package
v0.11.0-rc1 Latest Latest
Warning

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

Go to latest
Published: Jun 13, 2022 License: Apache-2.0 Imports: 17 Imported by: 3

Documentation

Index

Constants

View Source
const RAW_COMMIT_TABLE = "gitlab_api_commit"
View Source
const RAW_ISSUE_TABLE = "gitlab_api_issues"
View Source
const RAW_MERGE_REQUEST_COMMITS_TABLE = "gitlab_api_merge_request_commits"
View Source
const RAW_MERGE_REQUEST_NOTES_TABLE = "gitlab_api_merge_request_notes"
View Source
const RAW_MERGE_REQUEST_TABLE = "gitlab_api_merge_requests"
View Source
const RAW_PIPELINE_TABLE = "gitlab_api_pipeline"
View Source
const RAW_PROJECT_TABLE = "gitlab_api_project"
View Source
const RAW_TAG_TABLE = "gitlab_api_tag"

Variables

View Source
var CollectApiIssuesMeta = core.SubTaskMeta{
	Name:             "collectApiIssues",
	EntryPoint:       CollectApiIssues,
	EnabledByDefault: true,
	Description:      "Collect issues data from Gitlab api",
}
View Source
var CollectApiMergeRequestsCommitsMeta = core.SubTaskMeta{
	Name:             "collectApiMergeRequestsCommits",
	EntryPoint:       CollectApiMergeRequestsCommits,
	EnabledByDefault: true,
	Description:      "Collect merge requests commits data from gitlab api",
}
View Source
var CollectApiMergeRequestsMeta = core.SubTaskMeta{
	Name:             "collectApiMergeRequests",
	EntryPoint:       CollectApiMergeRequests,
	EnabledByDefault: true,
	Description:      "Collect merge requests data from gitlab api",
}
View Source
var CollectApiMergeRequestsNotesMeta = core.SubTaskMeta{
	Name:             "collectApiMergeRequestsNotes",
	EntryPoint:       CollectApiMergeRequestsNotes,
	EnabledByDefault: true,
	Description:      "Collect merge requests notes data from gitlab api",
}
View Source
var CollectApiPipelinesMeta = core.SubTaskMeta{
	Name:             "collectApiPipelines",
	EntryPoint:       CollectApiPipelines,
	EnabledByDefault: true,
	Description:      "Collect pipeline data from gitlab api",
}
View Source
var CollectCommitsMeta = core.SubTaskMeta{
	Name:             "collectApiCommits",
	EntryPoint:       CollectApiCommits,
	EnabledByDefault: true,
	Description:      "Collect commit data from gitlab api",
}
View Source
var CollectProjectMeta = core.SubTaskMeta{
	Name:             "collectApiProject",
	EntryPoint:       CollectApiProject,
	EnabledByDefault: true,
	Description:      "Collect project data from gitlab api",
}
View Source
var CollectTagMeta = core.SubTaskMeta{
	Name:             "collectApiTag",
	EntryPoint:       CollectApiTag,
	EnabledByDefault: true,
	Description:      "Collect tag data from gitlab api",
}
View Source
var ConvertApiCommitsMeta = core.SubTaskMeta{
	Name:             "convertApiCommits",
	EntryPoint:       ConvertApiCommits,
	EnabledByDefault: true,
	Description:      "Update domain layer commit according to GitlabCommit",
}
View Source
var ConvertApiMergeRequestsCommitsMeta = core.SubTaskMeta{
	Name:             "convertApiMergeRequestsCommits",
	EntryPoint:       ConvertApiMergeRequestsCommits,
	EnabledByDefault: true,
	Description:      "Update domain layer PullRequestCommit according to GitlabMergeRequestCommit",
}
View Source
var ConvertApiMergeRequestsMeta = core.SubTaskMeta{
	Name:             "convertApiMergeRequests",
	EntryPoint:       ConvertApiMergeRequests,
	EnabledByDefault: true,
	Description:      "Update domain layer PullRequest according to GitlabMergeRequest",
}
View Source
var ConvertApiNotesMeta = core.SubTaskMeta{
	Name:             "convertApiNotes",
	EntryPoint:       ConvertApiNotes,
	EnabledByDefault: true,
	Description:      "Update domain layer Note according to GitlabMergeRequestNote",
}
View Source
var ConvertIssueLabelsMeta = core.SubTaskMeta{
	Name:             "convertIssueLabels",
	EntryPoint:       ConvertIssueLabels,
	EnabledByDefault: true,
	Description:      "Convert tool layer table gitlab_issue_labels into  domain layer table issue_labels",
}
View Source
var ConvertIssuesMeta = core.SubTaskMeta{
	Name:             "convertIssues",
	EntryPoint:       ConvertIssues,
	EnabledByDefault: true,
	Description:      "Convert tool layer table gitlab_issues into  domain layer table issues",
}
View Source
var ConvertMergeRequestCommentMeta = core.SubTaskMeta{
	Name:             "convertMergeRequestComment",
	EntryPoint:       ConvertMergeRequestComment,
	EnabledByDefault: true,
	Description:      "Update domain layer Comment according to GitlabMergeRequestComment",
}
View Source
var ConvertProjectMeta = core.SubTaskMeta{
	Name:             "convertApiProject",
	EntryPoint:       ConvertApiProjects,
	EnabledByDefault: true,
	Description:      "Update domain layer Repo according to GitlabProject",
}
View Source
var EnrichMergeRequestsMeta = core.SubTaskMeta{
	Name:             "enrichMrs",
	EntryPoint:       EnrichMergeRequests,
	EnabledByDefault: true,
	Description:      "Enrich merge requests data from GitlabCommit, GitlabMergeRequestNote and GitlabMergeRequest",
}
View Source
var ExtractApiIssuesMeta = core.SubTaskMeta{
	Name:             "extractApiIssues",
	EntryPoint:       ExtractApiIssues,
	EnabledByDefault: true,
	Description:      "Extract raw Issues data into tool layer table gitlab_issues",
}
View Source
var ExtractApiMergeRequestsCommitsMeta = core.SubTaskMeta{
	Name:             "extractApiMergeRequestsCommits",
	EntryPoint:       ExtractApiMergeRequestsCommits,
	EnabledByDefault: true,
	Description:      "Extract raw merge requests commit data into tool layer table GitlabMergeRequestCommit and GitlabCommit",
}
View Source
var ExtractApiMergeRequestsMeta = core.SubTaskMeta{
	Name:             "extractApiMergeRequests",
	EntryPoint:       ExtractApiMergeRequests,
	EnabledByDefault: true,
	Description:      "Extract raw merge requests data into tool layer table GitlabMergeRequest and GitlabReviewer",
}
View Source
var ExtractApiMergeRequestsNotesMeta = core.SubTaskMeta{
	Name:             "extractApiMergeRequestsNotes",
	EntryPoint:       ExtractApiMergeRequestsNotes,
	EnabledByDefault: true,
	Description:      "Extract raw merge requests notes data into tool layer table GitlabMergeRequestNote",
}
View Source
var ExtractApiPipelinesMeta = core.SubTaskMeta{
	Name:             "extractApiPipelines",
	EntryPoint:       ExtractApiPipelines,
	EnabledByDefault: true,
	Description:      "Extract raw pipelines data into tool layer table GitlabPipeline",
}
View Source
var ExtractCommitsMeta = core.SubTaskMeta{
	Name:             "extractApiCommits",
	EntryPoint:       ExtractApiCommits,
	EnabledByDefault: true,
	Description:      "Extract raw commit data into tool layer table GitlabCommit,GitlabUser and GitlabProjectCommit",
}
View Source
var ExtractProjectMeta = core.SubTaskMeta{
	Name:             "extractApiProject",
	EntryPoint:       ExtractApiProject,
	EnabledByDefault: true,
	Description:      "Extract raw project data into tool layer table GitlabProject",
}
View Source
var ExtractTagMeta = core.SubTaskMeta{
	Name:             "extractApiTag",
	EntryPoint:       ExtractApiTag,
	EnabledByDefault: true,
	Description:      "Extract raw tag data into tool layer table GitlabTag",
}

Functions

func CollectApiCommits

func CollectApiCommits(taskCtx core.SubTaskContext) error

func CollectApiIssues

func CollectApiIssues(taskCtx core.SubTaskContext) error

func CollectApiMergeRequests

func CollectApiMergeRequests(taskCtx core.SubTaskContext) error

func CollectApiMergeRequestsCommits

func CollectApiMergeRequestsCommits(taskCtx core.SubTaskContext) error

func CollectApiMergeRequestsNotes

func CollectApiMergeRequestsNotes(taskCtx core.SubTaskContext) error

func CollectApiPipelines

func CollectApiPipelines(taskCtx core.SubTaskContext) error

func CollectApiProject

func CollectApiProject(taskCtx core.SubTaskContext) error

func CollectApiTag

func CollectApiTag(taskCtx core.SubTaskContext) error

func ConvertApiCommits

func ConvertApiCommits(taskCtx core.SubTaskContext) error

func ConvertApiMergeRequests

func ConvertApiMergeRequests(taskCtx core.SubTaskContext) error

func ConvertApiMergeRequestsCommits

func ConvertApiMergeRequestsCommits(taskCtx core.SubTaskContext) error

func ConvertApiNotes

func ConvertApiNotes(taskCtx core.SubTaskContext) error

func ConvertApiProjects

func ConvertApiProjects(taskCtx core.SubTaskContext) error

func ConvertCommit

func ConvertCommit(commit *GitlabApiCommit) (*models.GitlabCommit, error)

Convert the API response to our DB model instance

func ConvertIssueLabels

func ConvertIssueLabels(taskCtx core.SubTaskContext) error

func ConvertIssues

func ConvertIssues(taskCtx core.SubTaskContext) error

func ConvertMergeRequestComment

func ConvertMergeRequestComment(taskCtx core.SubTaskContext) error

func EnrichMergeRequests

func EnrichMergeRequests(taskCtx core.SubTaskContext) error

func ExtractApiCommits

func ExtractApiCommits(taskCtx core.SubTaskContext) error

func ExtractApiIssues

func ExtractApiIssues(taskCtx core.SubTaskContext) error

func ExtractApiMergeRequests

func ExtractApiMergeRequests(taskCtx core.SubTaskContext) error

func ExtractApiMergeRequestsCommits

func ExtractApiMergeRequestsCommits(taskCtx core.SubTaskContext) error

func ExtractApiMergeRequestsNotes

func ExtractApiMergeRequestsNotes(taskCtx core.SubTaskContext) error

func ExtractApiPipelines

func ExtractApiPipelines(taskCtx core.SubTaskContext) error

func ExtractApiProject

func ExtractApiProject(taskCtx core.SubTaskContext) error

func ExtractApiTag

func ExtractApiTag(taskCtx core.SubTaskContext) error

func GetMergeRequestsIterator

func GetMergeRequestsIterator(taskCtx core.SubTaskContext) (*helper.CursorIterator, error)

func GetPipelinesIterator

func GetPipelinesIterator(taskCtx core.SubTaskContext) (*helper.CursorIterator, error)

func GetQuery

func GetQuery(reqData *helper.RequestData) (url.Values, error)

func GetRawMessageFromResponse

func GetRawMessageFromResponse(res *http.Response) ([]json.RawMessage, error)

func GetTotalPagesFromResponse

func GetTotalPagesFromResponse(res *http.Response, args *helper.ApiCollectorArgs) (int, error)

func NewGitlabApiClient

func NewGitlabApiClient(taskCtx core.TaskContext) (*helper.ApiAsyncClient, error)

Types

type ApiPipeline

type ApiPipeline struct {
	GitlabId        int                 `json:"id"`
	ProjectId       int                 `json:"project_id"`
	GitlabCreatedAt *helper.Iso8601Time `json:"created_at"`
	UpdatedAt       *helper.Iso8601Time `json:"updated_at"`
	Ref             string
	Sha             string
	Duration        int
	WebUrl          string `json:"web_url"`
	Status          string
}

type ApiSinglePipelineResponse

type ApiSinglePipelineResponse struct {
	GitlabId        int                 `json:"id"`
	ProjectId       int                 `json:"project_id"`
	GitlabCreatedAt *helper.Iso8601Time `json:"created_at"`
	Ref             string
	Sha             string
	WebUrl          string `json:"web_url"`
	Duration        int
	UpdatedAt       *helper.Iso8601Time `json:"updated_at"`
	Coverage        string
	Status          string
}

type GitlabApiCommit

type GitlabApiCommit struct {
	GitlabId       string `json:"id"`
	Title          string
	Message        string
	ProjectId      int
	ShortId        string             `json:"short_id"`
	AuthorName     string             `json:"author_name"`
	AuthorEmail    string             `json:"author_email"`
	AuthoredDate   helper.Iso8601Time `json:"authored_date"`
	CommitterName  string             `json:"committer_name"`
	CommitterEmail string             `json:"committer_email"`
	CommittedDate  helper.Iso8601Time `json:"committed_date"`
	WebUrl         string             `json:"web_url"`
	Stats          struct {
		Additions int
		Deletions int
		Total     int
	}
}

type GitlabApiParams

type GitlabApiParams struct {
	ProjectId int
}

type GitlabApiProject

type GitlabApiProject struct {
	GitlabId          int    `json:"id"`
	Name              string `josn:"name"`
	Description       string `json:"description"`
	DefaultBranch     string `json:"default_branch"`
	PathWithNamespace string `json:"path_with_namespace"`
	WebUrl            string `json:"web_url"`
	CreatorId         int
	Visibility        string              `json:"visibility"`
	OpenIssuesCount   int                 `json:"open_issues_count"`
	StarCount         int                 `json:"star_count"`
	ForkedFromProject *GitlabApiProject   `json:"forked_from_project"`
	CreatedAt         helper.Iso8601Time  `json:"created_at"`
	LastActivityAt    *helper.Iso8601Time `json:"last_activity_at"`
}

type GitlabApiTag

type GitlabApiTag struct {
	Name      string
	Message   string
	Target    string
	Protected bool
	Release   struct {
		TagName     string
		Description string
	}
}

type GitlabInput

type GitlabInput struct {
	GitlabId int
	Iid      int
}

type GitlabOptions

type GitlabOptions struct {
	ConnectionId uint64   `json:"connectionId"`
	ProjectId    int      `json:"projectId"`
	Tasks        []string `json:"tasks,omitempty"`
}

type GitlabTaskData

type GitlabTaskData struct {
	Options       *GitlabOptions
	ApiClient     *helper.ApiAsyncClient
	ProjectCommit *models.GitlabProjectCommit
	Since         *time.Time
}

func CreateRawDataSubTaskArgs

func CreateRawDataSubTaskArgs(taskCtx core.SubTaskContext, Table string) (*helper.RawDataSubTaskArgs, *GitlabTaskData)

type IssuesResponse

type IssuesResponse struct {
	ProjectId int `json:"project_id"`
	Milestone struct {
		Due_date    string
		Project_id  int
		State       string
		Description string
		Iid         int
		Id          int
		Title       string
		CreatedAt   helper.Iso8601Time
		UpdatedAt   helper.Iso8601Time
	}
	Author struct {
		State     string
		WebUrl    string
		AvatarUrl string
		Username  string
		Id        int
		Name      string
	}
	Description string
	State       string
	Iid         int
	Assignees   []struct {
		AvatarUrl string
		WebUrl    string
		State     string
		Username  string
		Id        int
		Name      string
	}
	Assignee *struct {
		AvatarUrl string
		WebUrl    string
		State     string
		Username  string
		Id        int
		Name      string
	}
	Type               string
	Labels             []string `json:"labels"`
	UpVotes            int
	DownVotes          int
	MergeRequestsCount int
	Id                 int `json:"id"`
	Title              string
	GitlabUpdatedAt    helper.Iso8601Time  `json:"updated_at"`
	GitlabCreatedAt    helper.Iso8601Time  `json:"created_at"`
	GitlabClosedAt     *helper.Iso8601Time `json:"closed_at"`
	ClosedBy           struct {
		State     string
		WebUrl    string
		AvatarUrl string
		Username  string
		Id        int
		Name      string
	}
	UserNotesCount int
	DueDate        helper.Iso8601Time
	WebUrl         string `json:"web_url"`
	References     struct {
		Short    string
		Relative string
		Full     string
	}
	TimeStats struct {
		TimeEstimate        int64
		TotalTimeSpent      int64
		HumanTimeEstimate   string
		HumanTotalTimeSpent string
	}
	HasTasks         bool
	TaskStatus       string
	Confidential     bool
	DiscussionLocked bool
	IssueType        string
	Serverity        string
	Links            struct {
		Self       string `json:"url"`
		Notes      string
		AwardEmoji string
		Project    string
	}
	TaskCompletionStatus struct {
		Count          int
		CompletedCount int
	}
}

type MergeRequestNote

type MergeRequestNote struct {
	GitlabId        int    `json:"id"`
	MergeRequestId  int    `json:"noteable_id"`
	MergeRequestIid int    `json:"noteable_iid"`
	NoteableType    string `json:"noteable_type"`
	Body            string
	GitlabCreatedAt helper.Iso8601Time `json:"created_at"`
	Confidential    bool
	Resolvable      bool `json:"resolvable"`
	System          bool `json:"system"`
	Author          struct {
		Username string `json:"username"`
	}
}

type MergeRequestRes

type MergeRequestRes struct {
	GitlabId        int `json:"id"`
	Iid             int
	ProjectId       int `json:"project_id"`
	SourceProjectId int `json:"source_project_id"`
	TargetProjectId int `json:"target_project_id"`
	State           string
	Title           string
	Description     string
	WebUrl          string              `json:"web_url"`
	UserNotesCount  int                 `json:"user_notes_count"`
	WorkInProgress  bool                `json:"work_in_progress"`
	SourceBranch    string              `json:"source_branch"`
	TargetBranch    string              `json:"target_branch"`
	GitlabCreatedAt helper.Iso8601Time  `json:"created_at"`
	MergedAt        *helper.Iso8601Time `json:"merged_at"`
	ClosedAt        *helper.Iso8601Time `json:"closed_at"`
	MergeCommitSha  string              `json:"merge_commit_sha"`
	MergedBy        struct {
		Username string `json:"username"`
	} `json:"merged_by"`
	Author struct {
		Id       int    `json:"id"`
		Username string `json:"username"`
	}
	Reviewers        []Reviewer
	FirstCommentTime helper.Iso8601Time
}

type Reviewer

type Reviewer struct {
	GitlabId       int `json:"id"`
	MergeRequestId int
	Name           string
	Username       string
	State          string
	AvatarUrl      string `json:"avatar_url"`
	WebUrl         string `json:"web_url"`
}

Jump to

Keyboard shortcuts

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