Documentation
¶
Index ¶
- Variables
- func ParseID(id interface{}) (string, error)
- type BlobNode
- type Client
- func (c *Client) ApplyStep(ctx context.Context, evalContext scm.EvalContext, ...) error
- func (client *Client) EvalContext(ctx context.Context) (scm.EvalContext, error)
- func (client *Client) FindMergeRequestsForPeriodicEvaluation(ctx context.Context, filters scm.MergeRequestListFilters) ([]scm.PeriodicEvaluationMergeRequest, error)
- func (client *Client) GetProjectFiles(ctx context.Context, project string, ref *string, files []string) (map[string]string, error)
- func (client *Client) Labels() scm.LabelClient
- func (client *Client) MergeRequests() scm.MergeRequestClient
- func (client *Client) Start(ctx context.Context) error
- func (client *Client) Stop(ctx context.Context, evalError error, allowPipelineFailure bool) error
- type IncludeConfigurationProject
- type IncludeConfigurationRepository
- type IncludeConfigurationResult
- type LabelClient
- func (client *LabelClient) Create(ctx context.Context, opt *scm.CreateLabelOptions) (*scm.Label, *scm.Response, error)
- func (client *LabelClient) List(ctx context.Context) ([]*scm.Label, error)
- func (client *LabelClient) Update(ctx context.Context, opt *scm.UpdateLabelOptions) (*scm.Label, *scm.Response, error)
- type MergeRequestClient
- func (client *MergeRequestClient) GetRemoteConfig(ctx context.Context, filename, ref string) (io.Reader, error)
- func (client *MergeRequestClient) List(ctx context.Context, options *scm.ListMergeRequestsOptions) ([]scm.ListMergeRequest, error)
- func (client *MergeRequestClient) Update(ctx context.Context, opt *scm.UpdateMergeRequestOptions) (*scm.Response, error)
- type PeriodicEvaluationMergeRequestNode
- type PeriodicEvaluationProjectNode
- type PeriodicEvaluationRepository
- type PeriodicEvaluationResult
- type PipelineNode
Constants ¶
This section is empty.
Variables ¶
var SkipPipelineUpdateIfPeriodicAndPipelineStatusIs = []string{
"FAILED",
"SKIPPED",
}
Skip the "update external pipeline" step if the HEAD pipeline is any of the configured options
Disable updating CI pipelines when running periodic evaluations in the background to avoid sending "CI pipeline failed" notification emails to users
If the HEAD CI pipeline for a MR is in "failed" mode and we update the external pipeline, GitLab will send the user (if configured in their profile) a 'your pipeline failed' email every time the background evaluation process runs.
Possible values:
- CANCELED - CANCELING - CREATED - FAILED - MANUAL - PENDING - PREPARING - RUNNING - SCHEDULED - SKIPPED - SUCCESS - WAITING_FOR_CALLBACK - WAITING_FOR_RESOURCE
Functions ¶
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is a wrapper around the GitLab specific implementation of scm.Client interface
func (*Client) ApplyStep ¶ added in v0.3.0
func (c *Client) ApplyStep(ctx context.Context, evalContext scm.EvalContext, update *scm.UpdateMergeRequestOptions, step scm.ActionStep) error
func (*Client) EvalContext ¶
EvalContext creates a new evaluation context for GitLab specific usage
func (*Client) FindMergeRequestsForPeriodicEvaluation ¶ added in v0.12.0
func (client *Client) FindMergeRequestsForPeriodicEvaluation(ctx context.Context, filters scm.MergeRequestListFilters) ([]scm.PeriodicEvaluationMergeRequest, error)
FindMergeRequestsForPeriodicEvaluation will find all Merge Requests legible for periodic re-evaluation.
func (*Client) GetProjectFiles ¶ added in v0.16.0
func (*Client) Labels ¶
func (client *Client) Labels() scm.LabelClient
Labels returns a client target at managing labels/tags
func (*Client) MergeRequests ¶
func (client *Client) MergeRequests() scm.MergeRequestClient
MergeRequests returns a client target at managing merge/pull requests
type IncludeConfigurationProject ¶ added in v0.16.0
type IncludeConfigurationProject struct {
Repository IncludeConfigurationRepository `graphql:"repository"`
}
type IncludeConfigurationRepository ¶ added in v0.16.0
type IncludeConfigurationRepository struct { // Blobs contains a single (optional) node with the content of the ".scm-config.yml" file // read from the projects default branch at the time of reading Blobs graphqlNodesOf[BlobNode] `graphql:"blobs(paths: $files, ref: $ref, first: 100)"` }
type IncludeConfigurationResult ¶ added in v0.16.0
type IncludeConfigurationResult struct {
Project IncludeConfigurationProject `graphql:"project(fullPath: $project)"`
}
IncludeConfigurationResult is the GraphQL response for downloading a list of configuration files from a project repository within GitLab
GraphQL query:
query ($project: ID!, $ref: String ="HEAD", $files: [String!]!) { project(fullPath: $project) { repository { blobs(paths:$files, ref: $ref, first: 100) { nodes { path rawBlob } } } } }
Query Variables
{ "project": "platform/scm-engine-library", "files": ["label/change-type.yml", "label/last-commit-age.yml", "label/need-rebase.yml", "life-cycle/close-merge-request-3-weeks.yml"] }
type LabelClient ¶
type LabelClient struct {
// contains filtered or unexported fields
}
func NewLabelClient ¶
func NewLabelClient(client *Client) *LabelClient
func (*LabelClient) Create ¶
func (client *LabelClient) Create(ctx context.Context, opt *scm.CreateLabelOptions) (*scm.Label, *scm.Response, error)
type MergeRequestClient ¶
type MergeRequestClient struct {
// contains filtered or unexported fields
}
func NewMergeRequestClient ¶
func NewMergeRequestClient(client *Client) *MergeRequestClient
func (*MergeRequestClient) GetRemoteConfig ¶ added in v0.4.0
func (*MergeRequestClient) List ¶ added in v0.3.0
func (client *MergeRequestClient) List(ctx context.Context, options *scm.ListMergeRequestsOptions) ([]scm.ListMergeRequest, error)
func (*MergeRequestClient) Update ¶
func (client *MergeRequestClient) Update(ctx context.Context, opt *scm.UpdateMergeRequestOptions) (*scm.Response, error)
type PeriodicEvaluationMergeRequestNode ¶ added in v0.12.0
type PeriodicEvaluationMergeRequestNode struct { IID string `graphql:"iid"` SHA string `graphql:"diffHeadSha"` HeadPipeline *PipelineNode `graphql:"headPipeline"` }
type PeriodicEvaluationProjectNode ¶ added in v0.12.0
type PeriodicEvaluationProjectNode struct { // FullPath is the complete group + project slug / project identifier for a Project in GitLab FullPath string `graphql:"fullPath"` // MergeRequests contains up to 100 merge requests, sorted by oldest update/last change first MergeRequests graphqlNodesOf[PeriodicEvaluationMergeRequestNode] `` /* 131-byte string literal not displayed */ // Repository contains information about the git repository Repository PeriodicEvaluationRepository `graphql:"repository"` }
type PeriodicEvaluationRepository ¶ added in v0.12.0
type PeriodicEvaluationRepository struct { // Blobs contains a single (optional) node with the content of the ".scm-config.yml" file // read from the projects default branch at the time of reading Blobs graphqlNodesOf[BlobNode] `graphql:"blobs(paths: [$scm_config_file_path])"` }
type PeriodicEvaluationResult ¶ added in v0.12.0
type PeriodicEvaluationResult struct { // Projects contains first 100 projects that matches the filtering conditions Projects graphqlNodesOf[PeriodicEvaluationProjectNode] `graphql:"projects(first: 100, membership: $project_membership, withMergeRequestsEnabled: true, topics: $project_topics)"` }
PeriodicEvaluationResult structs maps to the GraphQL query used to find Merge Requests that should be periodically evaluated.
GraphQL query:
query ( $project_topics: [String!], $config_file: String!, $project_membership: Boolean, $mr_ignore_labels: [String!], $mr_require_labels: [String!] ) { projects( first: 100 membership: $project_membership withMergeRequestsEnabled: true topics: $project_topics ) { nodes { fullPath repository { blobs(paths: [$config_file]) { nodes { rawBlob } } } mergeRequests( first: 100, state: opened, not: {labels: $mr_ignore_labels}, labels: $mr_require_labels, sort: UPDATED_ASC ) { nodes { iid diffHeadSha headPipeline { status } } } } } }
Query Variables
{ "config_file": ".scm-engine.yml", "project_topics": ["scm-engine"], "project_membership": true, "mr_ignore_labels": ["security", "do-not-close"], "mr_require_labels": null }
type PipelineNode ¶ added in v0.19.0
type PipelineNode struct {
Status string `graphql:"status"`
}