tasks

package
v0.12.0-rc4 Latest Latest
Warning

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

Go to latest
Published: Jul 29, 2022 License: Apache-2.0 Imports: 21 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"
View Source
const RAW_USER_TABLE = "gitlab_api_users"

Variables

View Source
var CollectAccountsMeta = core.SubTaskMeta{
	Name:             "collectAccounts",
	EntryPoint:       CollectAccounts,
	EnabledByDefault: true,
	Description:      "collect gitlab users",
	DomainTypes:      []string{core.DOMAIN_TYPE_CROSS},
}
View Source
var CollectApiCommitsMeta = core.SubTaskMeta{
	Name:             "collectApiCommits",
	EntryPoint:       CollectApiCommits,
	EnabledByDefault: false,
	Description:      "Collect commit data from gitlab api",
	DomainTypes:      []string{core.DOMAIN_TYPE_CODE},
}
View Source
var CollectApiIssuesMeta = core.SubTaskMeta{
	Name:             "collectApiIssues",
	EntryPoint:       CollectApiIssues,
	EnabledByDefault: true,
	Description:      "Collect issues data from Gitlab api",
	DomainTypes:      []string{core.DOMAIN_TYPE_TICKET},
}
View Source
var CollectApiMergeRequestsMeta = core.SubTaskMeta{
	Name:             "collectApiMergeRequests",
	EntryPoint:       CollectApiMergeRequests,
	EnabledByDefault: true,
	Description:      "Collect merge requests data from gitlab api",
	DomainTypes:      []string{core.DOMAIN_TYPE_CODE_REVIEW},
}
View Source
var CollectApiMrCommitsMeta = core.SubTaskMeta{
	Name:             "collectApiMergeRequestsCommits",
	EntryPoint:       CollectApiMergeRequestsCommits,
	EnabledByDefault: true,
	Description:      "Collect merge requests commits data from gitlab api",
	DomainTypes:      []string{core.DOMAIN_TYPE_CODE_REVIEW},
}
View Source
var CollectApiMrNotesMeta = core.SubTaskMeta{
	Name:             "collectApiMergeRequestsNotes",
	EntryPoint:       CollectApiMergeRequestsNotes,
	EnabledByDefault: true,
	Description:      "Collect merge requests notes data from gitlab api",
	DomainTypes:      []string{core.DOMAIN_TYPE_CODE_REVIEW},
}
View Source
var CollectApiPipelinesMeta = core.SubTaskMeta{
	Name:             "collectApiPipelines",
	EntryPoint:       CollectApiPipelines,
	EnabledByDefault: true,
	Description:      "Collect pipeline data from gitlab api",
	DomainTypes:      []string{core.DOMAIN_TYPE_CICD},
}
View Source
var CollectProjectMeta = core.SubTaskMeta{
	Name:             "collectApiProject",
	EntryPoint:       CollectApiProject,
	EnabledByDefault: true,
	Description:      "Collect project data from gitlab api",
	DomainTypes:      []string{core.DOMAIN_TYPE_CODE, core.DOMAIN_TYPE_TICKET},
}
View Source
var CollectTagMeta = core.SubTaskMeta{
	Name:             "collectApiTag",
	EntryPoint:       CollectApiTag,
	EnabledByDefault: false,
	Description:      "Collect tag data from gitlab api",
	DomainTypes:      []string{core.DOMAIN_TYPE_CODE},
}
View Source
var ConvertAccountsMeta = core.SubTaskMeta{
	Name:             "convertAccounts",
	EntryPoint:       ConvertAccounts,
	EnabledByDefault: true,
	Description:      "Convert tool layer table gitlab_users into  domain layer table users",
	DomainTypes:      []string{core.DOMAIN_TYPE_CROSS},
}
View Source
var ConvertApiMergeRequestsMeta = core.SubTaskMeta{
	Name:             "convertApiMergeRequests",
	EntryPoint:       ConvertApiMergeRequests,
	EnabledByDefault: true,
	Description:      "Update domain layer PullRequest according to GitlabMergeRequest",
	DomainTypes:      []string{core.DOMAIN_TYPE_CODE_REVIEW},
}
View Source
var ConvertApiMrCommitsMeta = core.SubTaskMeta{
	Name:             "convertApiMergeRequestsCommits",
	EntryPoint:       ConvertApiMergeRequestsCommits,
	EnabledByDefault: true,
	Description:      "Update domain layer PullRequestCommit according to GitlabMrCommit",
	DomainTypes:      []string{core.DOMAIN_TYPE_CODE_REVIEW},
}
View Source
var ConvertCommitsMeta = core.SubTaskMeta{
	Name:             "convertApiCommits",
	EntryPoint:       ConvertApiCommits,
	EnabledByDefault: false,
	Description:      "Update domain layer commit according to GitlabCommit",
	DomainTypes:      []string{core.DOMAIN_TYPE_CODE},
}
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",
	DomainTypes:      []string{core.DOMAIN_TYPE_TICKET},
}
View Source
var ConvertIssuesMeta = core.SubTaskMeta{
	Name:             "convertIssues",
	EntryPoint:       ConvertIssues,
	EnabledByDefault: true,
	Description:      "Convert tool layer table gitlab_issues into  domain layer table issues",
	DomainTypes:      []string{core.DOMAIN_TYPE_TICKET},
}
View Source
var ConvertMrCommentMeta = core.SubTaskMeta{
	Name:             "convertMergeRequestComment",
	EntryPoint:       ConvertMergeRequestComment,
	EnabledByDefault: true,
	Description:      "Update domain layer Comment according to GitlabMrComment",
	DomainTypes:      []string{core.DOMAIN_TYPE_CODE_REVIEW},
}
View Source
var ConvertMrLabelsMeta = core.SubTaskMeta{
	Name:             "convertMrLabels",
	EntryPoint:       ConvertMrLabels,
	EnabledByDefault: true,
	Description:      "Convert tool layer table gitlab_mr_labels into  domain layer table pull_request_labels",
	DomainTypes:      []string{core.DOMAIN_TYPE_CODE_REVIEW},
}
View Source
var ConvertProjectMeta = core.SubTaskMeta{
	Name:             "convertApiProject",
	EntryPoint:       ConvertApiProjects,
	EnabledByDefault: true,
	Description:      "Update domain layer Repo according to GitlabProject",
	DomainTypes:      []string{core.DOMAIN_TYPE_CODE, core.DOMAIN_TYPE_TICKET},
}
View Source
var EnrichMergeRequestsMeta = core.SubTaskMeta{
	Name:             "enrichMrs",
	EntryPoint:       EnrichMergeRequests,
	EnabledByDefault: true,
	Description:      "Enrich merge requests data from GitlabCommit, GitlabMrNote and GitlabMergeRequest",
	DomainTypes:      []string{core.DOMAIN_TYPE_CODE_REVIEW},
}
View Source
var ExtractAccountsMeta = core.SubTaskMeta{
	Name:             "extractAccounts",
	EntryPoint:       ExtractAccounts,
	EnabledByDefault: true,
	Description:      "Extract raw workspace data into tool layer table _tool_gitlab_accounts",
	DomainTypes:      []string{core.DOMAIN_TYPE_CROSS},
}
View Source
var ExtractApiCommitsMeta = core.SubTaskMeta{
	Name:             "extractApiCommits",
	EntryPoint:       ExtractApiCommits,
	EnabledByDefault: false,
	Description:      "Extract raw commit data into tool layer table GitlabCommit,GitlabAccount and GitlabProjectCommit",
	DomainTypes:      []string{core.DOMAIN_TYPE_CODE},
}
View Source
var ExtractApiIssuesMeta = core.SubTaskMeta{
	Name:             "extractApiIssues",
	EntryPoint:       ExtractApiIssues,
	EnabledByDefault: true,
	Description:      "Extract raw Issues data into tool layer table gitlab_issues",
	DomainTypes:      []string{core.DOMAIN_TYPE_TICKET},
}
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",
	DomainTypes:      []string{core.DOMAIN_TYPE_CODE_REVIEW},
}
View Source
var ExtractApiMrCommitsMeta = core.SubTaskMeta{
	Name:             "extractApiMergeRequestsCommits",
	EntryPoint:       ExtractApiMergeRequestsCommits,
	EnabledByDefault: true,
	Description:      "Extract raw merge requests commit data into tool layer table GitlabMrCommit and GitlabCommit",
	DomainTypes:      []string{core.DOMAIN_TYPE_CODE_REVIEW},
}
View Source
var ExtractApiMrNotesMeta = core.SubTaskMeta{
	Name:             "extractApiMergeRequestsNotes",
	EntryPoint:       ExtractApiMergeRequestsNotes,
	EnabledByDefault: true,
	Description:      "Extract raw merge requests notes data into tool layer table GitlabMrNote",
	DomainTypes:      []string{core.DOMAIN_TYPE_CODE_REVIEW},
}
View Source
var ExtractApiPipelinesMeta = core.SubTaskMeta{
	Name:             "extractApiPipelines",
	EntryPoint:       ExtractApiPipelines,
	EnabledByDefault: true,
	Description:      "Extract raw pipelines data into tool layer table GitlabPipeline",
	DomainTypes:      []string{core.DOMAIN_TYPE_CICD},
}
View Source
var ExtractProjectMeta = core.SubTaskMeta{
	Name:             "extractApiProject",
	EntryPoint:       ExtractApiProject,
	EnabledByDefault: true,
	Description:      "Extract raw project data into tool layer table GitlabProject",
	DomainTypes:      []string{core.DOMAIN_TYPE_CODE, core.DOMAIN_TYPE_TICKET},
}
View Source
var ExtractTagMeta = core.SubTaskMeta{
	Name:             "extractApiTag",
	EntryPoint:       ExtractApiTag,
	EnabledByDefault: false,
	Description:      "Extract raw tag data into tool layer table GitlabTag",
	DomainTypes:      []string{core.DOMAIN_TYPE_CODE},
}

Functions

func CollectAccounts added in v0.12.0

func CollectAccounts(taskCtx core.SubTaskContext) error

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 ConvertAccounts added in v0.12.0

func ConvertAccounts(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 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 ConvertMrLabels added in v0.12.0

func ConvertMrLabels(taskCtx core.SubTaskContext) error

func EnrichMergeRequests

func EnrichMergeRequests(taskCtx core.SubTaskContext) error

func ExtractAccounts added in v0.12.0

func ExtractAccounts(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.DalCursorIterator, 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, connection *models.GitlabConnection) (*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 {
	ConnectionId uint64
	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"`
	HttpUrlToRepo     string              `json:"http_url_to_repo"`
}

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"`
	Since                      string
	models.TransformationRules `mapstructure:"transformationRules" json:"transformationRules"`
}

func DecodeAndValidateTaskOptions added in v0.12.0

func DecodeAndValidateTaskOptions(options map[string]interface{}) (*GitlabOptions, error)

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 `json:"web_url"`
		AvatarUrl string `json:"avatar_url"`
		Username  string
		Id        int    `json:"id"`
		Name      string `json:"name"`
	}
	Description string
	State       string
	Iid         int
	Assignees   []struct {
		AvatarUrl string `json:"avatar_url"`
		WebUrl    string `json:"web_url"`
		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 {
		Id       int    `json:"id"`
		Username string `json:"username"`
	}
	Type string `json:"type"`
}

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
	Labels           []string `json:"labels"`
}

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