Documentation ¶
Index ¶
Constants ¶
View Source
const ( FlagAPIToken = "api-token" FlagCommitSHA = "commit" FlagConfigFile = "config" FlagDryRun = "dry-run" FlagMergeRequestID = "id" FlagSCMBaseURL = "base-url" FlagSCMProject = "project" FlagServerListenHost = "listen-host" FlagServerListenPort = "listen-port" FlagUpdatePipeline = "update-pipeline" FlagWebhookSecret = "webhook-secret" )
Variables ¶
View Source
var GitHub = &cli.Command{ Name: "github", Usage: "GitHub related commands", Before: func(ctx *cli.Context) error { ctx.Context = state.WithProvider(ctx.Context, "github") return nil }, Flags: []cli.Flag{ &cli.StringFlag{ Name: FlagAPIToken, Usage: "GitHub API token", EnvVars: []string{ "SCM_ENGINE_TOKEN", }, }, &cli.StringFlag{ Name: FlagSCMBaseURL, Usage: "Base URL for the SCM instance", Value: "https://api.github.com/", EnvVars: []string{ "SCM_ENGINE_BASE_URL", }, }, }, Subcommands: []*cli.Command{ { Name: "evaluate", Usage: "Evaluate a Pull Request", Args: true, ArgsUsage: " [pr_id, pr_id, ...]", Action: Evaluate, Flags: []cli.Flag{ &cli.StringFlag{ Name: FlagSCMProject, Usage: "GitHub project (example: 'jippi/scm-engine')", Required: true, EnvVars: []string{ "GITHUB_REPOSITORY", }, }, &cli.StringFlag{ Name: FlagMergeRequestID, Usage: "The Pull Request ID to process, if not provided as a CLI flag", EnvVars: []string{ "SCM_ENGINE_PULL_REQUEST_ID", }, }, &cli.StringFlag{ Name: FlagCommitSHA, Usage: "The git commit sha", EnvVars: []string{ "GITHUB_SHA", }, }, }, }, }, }
View Source
var GitLab = &cli.Command{ Name: "gitlab", Usage: "GitLab related commands", Before: func(cCtx *cli.Context) error { cCtx.Context = state.WithBaseURL(cCtx.Context, cCtx.String(FlagSCMBaseURL)) cCtx.Context = state.WithProvider(cCtx.Context, "gitlab") cCtx.Context = state.WithToken(cCtx.Context, cCtx.String(FlagAPIToken)) return nil }, Flags: []cli.Flag{ &cli.StringFlag{ Name: FlagAPIToken, Usage: "GitLab API token", EnvVars: []string{ "SCM_ENGINE_TOKEN", }, }, &cli.StringFlag{ Name: FlagSCMBaseURL, Usage: "Base URL for the SCM instance", Value: "https://gitlab.com/", EnvVars: []string{ "SCM_ENGINE_BASE_URL", "CI_SERVER_URL", }, }, }, Subcommands: []*cli.Command{ { Name: "evaluate", Usage: "Evaluate a Merge Request", Args: true, ArgsUsage: " [mr_id, mr_id, ...]", Action: Evaluate, Flags: []cli.Flag{ &cli.BoolFlag{ Name: FlagUpdatePipeline, Usage: "Update the CI pipeline status with progress", Value: false, EnvVars: []string{ "SCM_ENGINE_UPDATE_PIPELINE", }, }, &cli.StringFlag{ Name: FlagSCMProject, Usage: "GitLab project (example: 'gitlab-org/gitlab')", EnvVars: []string{ "GITLAB_PROJECT", "CI_PROJECT_PATH", }, }, &cli.StringFlag{ Name: FlagMergeRequestID, Usage: "The Merge Request ID to process, if not provided as a CLI flag", EnvVars: []string{ "CI_MERGE_REQUEST_IID", }, }, &cli.StringFlag{ Name: FlagCommitSHA, Usage: "The git commit sha", EnvVars: []string{ "CI_COMMIT_SHA", }, }, }, }, { Name: "server", Usage: "Start HTTP server for webhook event driven usage", Hidden: true, Action: Server, Flags: []cli.Flag{ &cli.StringFlag{ Name: FlagWebhookSecret, Usage: "Used to validate received payloads. Sent with the request in the X-Gitlab-Token HTTP header", EnvVars: []string{ "SCM_ENGINE_WEBHOOK_SECRET", }, }, &cli.StringFlag{ Name: FlagServerListenHost, Usage: "IP that the HTTP server should listen on", Value: "0.0.0.0", EnvVars: []string{ "SCM_ENGINE_LISTEN_ADDR", }, }, &cli.IntFlag{ Name: FlagServerListenPort, Usage: "Port that the HTTP server should listen on", Value: 3000, EnvVars: []string{ "SCM_ENGINE_LISTEN_PORT", "PORT", }, }, &cli.BoolFlag{ Name: FlagUpdatePipeline, Usage: "Update the CI pipeline status with progress", Value: true, EnvVars: []string{ "SCM_ENGINE_UPDATE_PIPELINE", }, }, }, }, }, }
View Source
var GlobalOptionsTemplate = `` /* 133-byte string literal not displayed */
Functions ¶
Types ¶
type MergeRequest ¶ added in v0.4.0
type Payload ¶ added in v0.4.0
type Payload struct { EventType string `json:"event_type"` Project Project `json:"project"` // "project" is sent for all events ObjectAttributes *MergeRequest `json:"object_attributes,omitempty"` // "object_attributes" is sent on "merge_request" events MergeRequest *MergeRequest `json:"merge_request,omitempty"` // "merge_request" is sent on "note" activity }
Click to show internal directories.
Click to hide internal directories.