tasks

package
v0.15.0-zentao-beta-5 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2022 License: Apache-2.0 Imports: 19 Imported by: 2

Documentation

Index

Constants

View Source
const RAW_ACCOUNT_TABLE = "bitbucket_api_accounts"
View Source
const RAW_COMMIT_TABLE = "bitbucket_api_commits"
View Source
const RAW_DEPLOYMENT_TABLE = "bitbucket_api_deployments"
View Source
const RAW_ISSUE_COMMENTS_TABLE = "bitbucket_api_issue_comments"
View Source
const RAW_ISSUE_TABLE = "bitbucket_api_issues"
View Source
const RAW_PIPELINE_TABLE = "bitbucket_api_pipelines"
View Source
const RAW_PULL_REQUEST_COMMENTS_TABLE = "bitbucket_api_pull_request_comments"
View Source
const RAW_PULL_REQUEST_TABLE = "bitbucket_api_pull_requests"
View Source
const RAW_REPOSITORIES_TABLE = "bitbucket_api_repositories"

Variables

View Source
var CollectApiCommitsMeta = core.SubTaskMeta{
	Name:             "collectApiCommits",
	EntryPoint:       CollectApiCommits,
	EnabledByDefault: false,
	Required:         false,
	Description:      "Collect commits data from Bitbucket api",
	DomainTypes:      []string{core.DOMAIN_TYPE_CODE},
}
View Source
var CollectApiDeploymentsMeta = core.SubTaskMeta{
	Name:             "collectApiDeployments",
	EntryPoint:       CollectApiDeployments,
	EnabledByDefault: true,
	Description:      "Collect deployment data from bitbucket api",
	DomainTypes:      []string{core.DOMAIN_TYPE_CICD},
}
View Source
var CollectApiIssueCommentsMeta = core.SubTaskMeta{
	Name:             "collectApiIssueComments",
	EntryPoint:       CollectApiIssueComments,
	EnabledByDefault: true,
	Required:         true,
	Description:      "Collect issue comments data from bitbucket api",
	DomainTypes:      []string{core.DOMAIN_TYPE_TICKET},
}
View Source
var CollectApiIssuesMeta = core.SubTaskMeta{
	Name:             "collectApiIssues",
	EntryPoint:       CollectApiIssues,
	EnabledByDefault: true,
	Description:      "Collect issues data from Bitbucket api",
	DomainTypes:      []string{core.DOMAIN_TYPE_TICKET},
}
View Source
var CollectApiPipelinesMeta = core.SubTaskMeta{
	Name:             "collectApiPipelines",
	EntryPoint:       CollectApiPipelines,
	EnabledByDefault: true,
	Description:      "Collect pipeline data from bitbucket api",
	DomainTypes:      []string{core.DOMAIN_TYPE_CICD},
}
View Source
var CollectApiPrCommentsMeta = core.SubTaskMeta{
	Name:             "collectApiPullRequestsComments",
	EntryPoint:       CollectApiPullRequestsComments,
	EnabledByDefault: true,
	Required:         true,
	Description:      "Collect pull requests comments data from bitbucket api",
	DomainTypes:      []string{core.DOMAIN_TYPE_CODE_REVIEW},
}
View Source
var CollectApiPullRequestsMeta = core.SubTaskMeta{
	Name:             "collectApiPullRequests",
	EntryPoint:       CollectApiPullRequests,
	EnabledByDefault: true,
	Required:         true,
	Description:      "Collect PullRequests data from Bitbucket api",
	DomainTypes:      []string{core.DOMAIN_TYPE_CODE_REVIEW},
}
View Source
var CollectApiRepoMeta = core.SubTaskMeta{
	Name:        "collectApiRepo",
	EntryPoint:  CollectApiRepositories,
	Required:    true,
	Description: "Collect repositories data from Bitbucket api",
	DomainTypes: []string{core.DOMAIN_TYPE_CODE},
}
View Source
var ConvertAccountsMeta = core.SubTaskMeta{
	Name:             "convertAccounts",
	EntryPoint:       ConvertAccounts,
	EnabledByDefault: true,
	Required:         true,
	Description:      "Convert tool layer table bitbucket_accounts into  domain layer table accounts",
	DomainTypes:      []string{core.DOMAIN_TYPE_CROSS},
}
View Source
var ConvertCommitsMeta = core.SubTaskMeta{
	Name:             "convertCommits",
	EntryPoint:       ConvertCommits,
	EnabledByDefault: false,
	Required:         false,
	Description:      "Convert tool layer table bitbucket_commits into  domain layer table commits",
	DomainTypes:      []string{core.DOMAIN_TYPE_CODE},
}
View Source
var ConvertDeploymentMeta = core.SubTaskMeta{
	Name:             "convertDeployments",
	EntryPoint:       ConvertDeployments,
	EnabledByDefault: true,
	Description:      "Convert tool layer table bitbucket_pipeline into domain layer table pipeline",
	DomainTypes:      []string{core.DOMAIN_TYPE_CROSS},
}
View Source
var ConvertIssueCommentsMeta = core.SubTaskMeta{
	Name:             "convertIssueComments",
	EntryPoint:       ConvertIssueComments,
	EnabledByDefault: true,
	Description:      "ConvertIssueComments data from Bitbucket api",
	DomainTypes:      []string{core.DOMAIN_TYPE_TICKET},
}
View Source
var ConvertIssuesMeta = core.SubTaskMeta{
	Name:             "convertIssues",
	EntryPoint:       ConvertIssues,
	EnabledByDefault: true,
	Description:      "Convert tool layer table bitbucket_issues into  domain layer table issues",
	DomainTypes:      []string{core.DOMAIN_TYPE_TICKET},
}
View Source
var ConvertPipelineMeta = core.SubTaskMeta{
	Name:             "convertPipelines",
	EntryPoint:       ConvertPipelines,
	EnabledByDefault: true,
	Description:      "Convert tool layer table bitbucket_pipeline into domain layer table pipeline",
	DomainTypes:      []string{core.DOMAIN_TYPE_CROSS},
}
View Source
var ConvertPrCommentsMeta = core.SubTaskMeta{
	Name:             "convertPullRequestComments",
	EntryPoint:       ConvertPullRequestComments,
	EnabledByDefault: true,
	Description:      "ConvertPullRequestComments data from Bitbucket api",
	DomainTypes:      []string{core.DOMAIN_TYPE_CODE_REVIEW},
}
View Source
var ConvertPullRequestsMeta = core.SubTaskMeta{
	Name:             "convertPullRequests",
	EntryPoint:       ConvertPullRequests,
	EnabledByDefault: true,
	Required:         true,
	Description:      "ConvertPullRequests data from Bitbucket api",
	DomainTypes:      []string{core.DOMAIN_TYPE_CODE_REVIEW},
}
View Source
var ConvertRepoMeta = core.SubTaskMeta{
	Name:             "convertRepo",
	EntryPoint:       ConvertRepo,
	EnabledByDefault: true,
	Description:      "Convert tool layer table bitbucket_repos into  domain layer table repos and boards",
	DomainTypes:      []string{core.DOMAIN_TYPE_CODE},
}
View Source
var ExtractApiCommitsMeta = core.SubTaskMeta{
	Name:             "extractApiCommits",
	EntryPoint:       ExtractApiCommits,
	EnabledByDefault: false,
	Required:         false,
	Description:      "Extract raw commit data into tool layer table bitbucket_commits",
	DomainTypes:      []string{core.DOMAIN_TYPE_CODE},
}
View Source
var ExtractApiDeploymentsMeta = core.SubTaskMeta{
	Name:             "extractApiDeployments",
	EntryPoint:       ExtractApiDeployments,
	EnabledByDefault: true,
	Description:      "Extract raw deployments data into tool layer table BitbucketDeployment",
	DomainTypes:      []string{core.DOMAIN_TYPE_CICD},
}
View Source
var ExtractApiIssueCommentsMeta = core.SubTaskMeta{
	Name:             "extractApiIssueComments",
	EntryPoint:       ExtractApiIssueComments,
	EnabledByDefault: true,
	Required:         true,
	Description:      "Extract raw issue comments data into tool layer table BitbucketIssueComments",
	DomainTypes:      []string{core.DOMAIN_TYPE_TICKET},
}
View Source
var ExtractApiIssuesMeta = core.SubTaskMeta{
	Name:             "extractApiIssues",
	EntryPoint:       ExtractApiIssues,
	EnabledByDefault: true,
	Description:      "Extract raw Issues data into tool layer table bitbucket_issues",
	DomainTypes:      []string{core.DOMAIN_TYPE_TICKET},
}
View Source
var ExtractApiPipelinesMeta = core.SubTaskMeta{
	Name:             "extractApiPipelines",
	EntryPoint:       ExtractApiPipelines,
	EnabledByDefault: true,
	Description:      "Extract raw pipelines data into tool layer table BitbucketPipeline",
	DomainTypes:      []string{core.DOMAIN_TYPE_CICD},
}
View Source
var ExtractApiPrCommentsMeta = core.SubTaskMeta{
	Name:             "extractApiPullRequestsComments",
	EntryPoint:       ExtractApiPullRequestsComments,
	EnabledByDefault: true,
	Required:         true,
	Description:      "Extract raw pull requests comments data into tool layer table BitbucketPrComments",
	DomainTypes:      []string{core.DOMAIN_TYPE_CODE_REVIEW},
}
View Source
var ExtractApiPullRequestsMeta = core.SubTaskMeta{
	Name:             "extractApiPullRequests",
	EntryPoint:       ExtractApiPullRequests,
	EnabledByDefault: true,
	Required:         true,
	Description:      "Extract raw PullRequests data into tool layer table bitbucket_pull_requests",
	DomainTypes:      []string{core.DOMAIN_TYPE_CODE_REVIEW},
}
View Source
var ExtractApiRepoMeta = core.SubTaskMeta{
	Name:        "extractApiRepo",
	EntryPoint:  ExtractApiRepositories,
	Required:    true,
	Description: "Extract raw Repositories data into tool layer table bitbucket_repos",
	DomainTypes: []string{core.DOMAIN_TYPE_CODE},
}

Functions

func CollectApiCommits

func CollectApiCommits(taskCtx core.SubTaskContext) errors.Error

func CollectApiDeployments added in v0.15.0

func CollectApiDeployments(taskCtx core.SubTaskContext) errors.Error

func CollectApiIssueComments

func CollectApiIssueComments(taskCtx core.SubTaskContext) errors.Error

func CollectApiIssues

func CollectApiIssues(taskCtx core.SubTaskContext) errors.Error

func CollectApiPipelines added in v0.14.0

func CollectApiPipelines(taskCtx core.SubTaskContext) errors.Error

func CollectApiPullRequests

func CollectApiPullRequests(taskCtx core.SubTaskContext) errors.Error

func CollectApiPullRequestsComments

func CollectApiPullRequestsComments(taskCtx core.SubTaskContext) errors.Error

func CollectApiRepositories

func CollectApiRepositories(taskCtx core.SubTaskContext) errors.Error

func ConvertAccounts

func ConvertAccounts(taskCtx core.SubTaskContext) errors.Error

func ConvertCommits

func ConvertCommits(taskCtx core.SubTaskContext) errors.Error

func ConvertDeployments added in v0.15.0

func ConvertDeployments(taskCtx core.SubTaskContext) errors.Error

func ConvertIssueComments

func ConvertIssueComments(taskCtx core.SubTaskContext) errors.Error

func ConvertIssues

func ConvertIssues(taskCtx core.SubTaskContext) errors.Error

func ConvertPipelines added in v0.14.0

func ConvertPipelines(taskCtx core.SubTaskContext) errors.Error

func ConvertPullRequestComments

func ConvertPullRequestComments(taskCtx core.SubTaskContext) errors.Error

func ConvertPullRequests

func ConvertPullRequests(taskCtx core.SubTaskContext) errors.Error

func ConvertRepo

func ConvertRepo(taskCtx core.SubTaskContext) errors.Error

func CreateApiClient

func CreateApiClient(taskCtx core.TaskContext, connection *models.BitbucketConnection) (*helper.ApiAsyncClient, errors.Error)

func ExtractApiCommits

func ExtractApiCommits(taskCtx core.SubTaskContext) errors.Error

func ExtractApiDeployments added in v0.15.0

func ExtractApiDeployments(taskCtx core.SubTaskContext) errors.Error

func ExtractApiIssueComments

func ExtractApiIssueComments(taskCtx core.SubTaskContext) errors.Error

func ExtractApiIssues

func ExtractApiIssues(taskCtx core.SubTaskContext) errors.Error

func ExtractApiPipelines added in v0.14.0

func ExtractApiPipelines(taskCtx core.SubTaskContext) errors.Error

func ExtractApiPullRequests

func ExtractApiPullRequests(taskCtx core.SubTaskContext) errors.Error

func ExtractApiPullRequestsComments

func ExtractApiPullRequestsComments(taskCtx core.SubTaskContext) errors.Error

func ExtractApiRepositories

func ExtractApiRepositories(taskCtx core.SubTaskContext) errors.Error

func GetIssuesIterator

func GetIssuesIterator(taskCtx core.SubTaskContext) (*helper.DalCursorIterator, errors.Error)

func GetPullRequestsIterator

func GetPullRequestsIterator(taskCtx core.SubTaskContext) (*helper.DalCursorIterator, errors.Error)

func GetQuery

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

func GetRawMessageFromResponse

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

func GetTotalPagesFromResponse

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

Types

type ApiRepoResponse

type ApiRepoResponse BitbucketApiRepo

type BitbucketAccountResponse

type BitbucketAccountResponse struct {
	UserName      string    `json:"username"`
	DisplayName   string    `json:"display_name"`
	AccountId     string    `json:"account_id"`
	AccountStatus string    `json:"account_status"`
	CreateOn      time.Time `json:"create_on"`
	Links         struct {
		Self       struct{ Href string } `json:"self"`
		Html       struct{ Href string } `json:"html"`
		Avatar     struct{ Href string } `json:"avatar"`
		Followers  struct{ Href string } `json:"followers"`
		Following  struct{ Href string } `json:"following"`
		Repository struct{ Href string } `json:"repository"`
	}
}

type BitbucketApiParams

type BitbucketApiParams struct {
	ConnectionId uint64
	Owner        string
	Repo         string
}

type BitbucketApiPipeline added in v0.14.0

type BitbucketApiPipeline struct {
	Uuid  string `json:"uuid"`
	Type  string `json:"type"`
	State struct {
		Name   string `json:"name"`
		Type   string `json:"type"`
		Result *struct {
			Name string `json:"name"`
			Type string `json:"type"`
		} `json:"result"`
		Stage *struct {
			Name string `json:"name"`
			Type string `json:"type"`
		} `json:"stage"`
	} `json:"state"`
	BuildNumber int                         `json:"build_number"`
	Creator     *BitbucketAccountResponse   `json:"creator"`
	Repo        *BitbucketApiRepo           `json:"repository"`
	Target      *bitbucketApiPipelineTarget `json:"target"`
	Trigger     struct {
		Name string `json:"name"`
		Type string `json:"type"`
	} `json:"trigger"`
	CreatedOn         *time.Time `json:"created_on"`
	CompletedOn       *time.Time `json:"completed_on"`
	RunNumber         int        `json:"run_number"`
	DurationInSeconds uint64     `json:"duration_in_seconds"`
	BuildSecondsUsed  int        `json:"build_seconds_used"`
	FirstSuccessful   bool       `json:"first_successful"`
	Expired           bool       `json:"expired"`
	HasVariables      bool       `json:"has_variables"`
	Links             struct {
		Self struct {
			Href string `json:"href"`
		} `json:"self"`
		Steps struct {
			Href string `json:"href"`
		} `json:"steps"`
	} `json:"links"`
}

type BitbucketApiPullRequest

type BitbucketApiPullRequest struct {
	BitbucketId  int    `json:"id"`
	CommentCount int    `json:"comment_count"`
	TaskCount    int    `json:"task_count"`
	Type         string `json:"type"`
	State        string `json:"state"`
	Title        string `json:"title"`
	Description  string `json:"description"`
	MergeCommit  *struct {
		Type  string `json:"type"`
		Hash  string `json:"hash"`
		Links *struct {
			Self struct {
				Href string `json:"href"`
			} `json:"self"`
			Html struct {
				Href string `json:"href"`
			} `json:"html"`
		} `json:"links"`
	} `json:"merge_commit"`
	Links *struct {
		Self struct {
			Href string `json:"href"`
		} `json:"self"`
		Html struct {
			Href string `json:"href"`
		} `json:"html"`
	} `json:"links"`
	ClosedBy           *BitbucketAccountResponse `json:"closed_by"`
	Author             *BitbucketAccountResponse `json:"author"`
	BitbucketCreatedAt time.Time                 `json:"created_on"`
	BitbucketUpdatedAt time.Time                 `json:"updated_on"`
	BaseRef            *struct {
		Branch struct {
			Name string `json:"name"`
		} `json:"branch"`
		Commit struct {
			Type string `json:"type"`
			Hash string `json:"hash"`
		} `json:"commit"`
		Repo *BitbucketApiRepo `json:"repository"`
	} `json:"destination"`
	HeadRef *struct {
		Branch struct {
			Name string `json:"name"`
		} `json:"branch"`
		Commit struct {
			Type string `json:"type"`
			Hash string `json:"hash"`
		} `json:"commit"`
		Repo *BitbucketApiRepo `json:"repository"`
	} `json:"source"`
	Reviewers    []BitbucketAccountResponse `json:"reviewers"`
	Participants []BitbucketAccountResponse `json:"participants"`
}

type BitbucketApiRepo

type BitbucketApiRepo struct {
	BitbucketId string
	Scm         string                  `json:"scm"`
	HasWiki     bool                    `json:"has_wiki"`
	Uuid        string                  `json:"uuid"`
	FullName    string                  `json:"full_name"`
	Language    string                  `json:"language"`
	Description string                  `json:"description"`
	Type        string                  `json:"type"`
	HasIssue    bool                    `json:"has_issue"`
	ForkPolicy  string                  `json:"fork_policy"`
	Owner       models.BitbucketAccount `json:"owner"`
	CreatedAt   time.Time               `json:"created_on"`
	UpdatedAt   *time.Time              `json:"updated_on"`
	Links       struct {
		Clone []struct {
			Href string `json:"href"`
			Name string `json:"name"`
		} `json:"clone"`
		Self struct {
			Href string `json:"href"`
		} `json:"self"`
		Html struct {
			Href string `json:"href"`
		} `json:"html"`
	} `json:"links"`
}

type BitbucketInput

type BitbucketInput struct {
	BitbucketId int
}

type BitbucketIssueCommentsResponse

type BitbucketIssueCommentsResponse struct {
	Type        string     `json:"type"`
	BitbucketId int        `json:"id"`
	CreatedOn   time.Time  `json:"created_on"`
	UpdatedOn   *time.Time `json:"updated_on"`
	Content     struct {
		Type string `json:"type"`
		Raw  string `json:"raw"`
	} `json:"content"`
	User  *BitbucketAccountResponse `json:"user"`
	Issue struct {
		Type       string            `json:"type"`
		Id         int               `json:"id"`
		Repository *BitbucketApiRepo `json:"repository"`
		Links      struct {
			Self struct {
				Href string `json:"href"`
			} `json:"self"`
		} `json:"links"`
		Title string `json:"title"`
	}
	Links struct {
		Self struct {
			Href string `json:"href"`
		} `json:"self"`
		Html struct {
			Href string `json:"href"`
		} `json:"html"`
	} `json:"links"`
}

type BitbucketOptions

type BitbucketOptions struct {
	ConnectionId               uint64   `json:"connectionId"`
	Tasks                      []string `json:"tasks,omitempty"`
	Since                      string
	Owner                      string
	Repo                       string
	models.TransformationRules `mapstructure:"transformationRules" json:"transformationRules"`
}

func DecodeAndValidateTaskOptions

func DecodeAndValidateTaskOptions(options map[string]interface{}) (*BitbucketOptions, errors.Error)

type BitbucketPagination

type BitbucketPagination struct {
	Values  []interface{} `json:"values"`
	PageLen int           `json:"pagelen"`
	Size    int           `json:"size"`
	Page    int           `json:"page"`
	Next    string        `json:"next"`
}

type BitbucketPrCommentsResponse

type BitbucketPrCommentsResponse struct {
	BitbucketId int        `json:"id"`
	CreatedOn   time.Time  `json:"created_on"`
	UpdatedOn   *time.Time `json:"updated_on"`
	Content     struct {
		Type string `json:"type"`
		Raw  string `json:"raw"`
	} `json:"content"`
	User    *BitbucketAccountResponse `json:"user"`
	Deleted bool                      `json:"deleted"`
	Type    string                    `json:"type"`
	Links   struct {
		Self struct {
			Href string
		} `json:"self"`
		Html struct {
			Href string
		} `json:"html"`
	} `json:"links"`
	PullRequest struct {
		Type  string `json:"type"`
		Id    int    `json:"id"`
		Title string `json:"title"`
		Links struct {
			Self struct {
				Href string `json:"href"`
			} `json:"self"`
			Html struct {
				Href string `json:"href"`
			} `json:"html"`
		} `json:"links"`
	}
}

type BitbucketTaskData

type BitbucketTaskData struct {
	Options   *BitbucketOptions
	ApiClient *helper.ApiAsyncClient
	Since     *time.Time
	Repo      *models.BitbucketRepo
}

func CreateRawDataSubTaskArgs

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

type CommitsResponse

type CommitsResponse struct {
	Type string    `json:"type"`
	Sha  string    `json:"hash"`
	Date time.Time `json:"date"`
	//Author *models.BitbucketAccount
	Message string `json:"message"`
	Links   struct {
		Self     struct{ Href string }
		Html     struct{ Href string }
		Diff     struct{ Href string }
		Approve  struct{ Href string }
		Comments struct{ Href string }
	} `json:"links"`
	Parents []struct {
		Type  string
		Hash  string
		Links struct {
			Self struct{ Href string }
			Html struct{ Href string }
		}
	} `json:"parents"`
}

type IssuesResponse

type IssuesResponse struct {
	Type        string            `json:"type"`
	BitbucketId int               `json:"id"`
	Repository  *BitbucketApiRepo `json:"repository"`
	Links       struct {
		Self struct {
			Href string `json:"href"`
		} `json:"self"`
		Html struct {
			Href string `json:"href"`
		} `json:"html"`
	} `json:"links"`
	Title   string `json:"title"`
	Content struct {
		Type string `json:"type"`
		Raw  string `json:"raw"`
	} `json:"content"`
	Reporter  *BitbucketAccountResponse `json:"reporter"`
	Assignee  *BitbucketAccountResponse `json:"assignee"`
	State     string                    `json:"state"`
	Kind      string                    `json:"kind"`
	Milestone *struct {
		Id int `json:"id"`
	} `json:"milestone"`
	Component          string    `json:"component"`
	Priority           string    `json:"priority"`
	Votes              int       `json:"votes"`
	Watches            int       `json:"watches"`
	BitbucketCreatedAt time.Time `json:"created_on"`
	BitbucketUpdatedAt time.Time `json:"updated_on"`
}

Jump to

Keyboard shortcuts

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