Documentation ¶
Index ¶
- Constants
- func AddAuthToSCMClient(client *scm.Client, token string, isGitHubApp bool)
- func BlobURLForProvider(providerType string, baseURL *url.URL, owner, repo, branch string, ...) string
- func CallExternalPluginsWithActivityRecord(l *logrus.Entry, externalPlugins []plugins.ExternalPlugin, ...)
- func CallExternalPluginsWithWebhook(l *logrus.Entry, externalPlugins []plugins.ExternalPlugin, webhook scm.Webhook, ...)
- func DirExists(path string) (bool, error)
- func ExternalPluginsForEvent(pluginConfig *plugins.ConfigAgent, eventKind string, srcRepo string) []plugins.ExternalPlugin
- func FileExists(path string) (bool, error)
- func GetBotName(cfg config.Getter) string
- func GetGitHubAppAPIUser() (string, error)
- func GetGitHubAppSecretDir() string
- func GetGitServer(cfg config.Getter) string
- func GetSCMClient(owner string, cfg config.Getter) (scmprovider.SCMClient, *scm.Client, string, string, error)
- func GetSCMToken(gitKind string) (string, error)
- func GitKind(cfg config.Getter) string
- func HMACToken() string
- func ParseExternalPluginEvent(req *http.Request, secretToken string) (scm.Webhook, *v1alpha1.ActivityRecord, error)
- func Stopper() chan struct{}
- func ToValidName(name string) string
- func ToValidNameTruncated(name string, maxLength int) string
- func URLJoin(paths ...string) string
- type OwnerTokensDir
Constants ¶
const ( // CommitStatusPendingDescription is the description used for PR commit status for pipelines we have just kicked off. CommitStatusPendingDescription = "Pipeline pending" // OverriddenByPrefix is the beginning of the description for commit statuses set by /override OverriddenByPrefix = "Overridden by" // GitHubAppGitRemoteUsername Username for git https URLs when using a GitHub App token. // see https://developer.github.com/apps/building-github-apps/authenticating-with-github-apps/#http-based-git-access-by-an-installation GitHubAppGitRemoteUsername = "x-access-token" // GitHubAppSecretDirEnvVar is the name of the environment variable which would contain secrets when this is configured // with the GitHub App. GitHubAppSecretDirEnvVar = "GITHUB_APP_SECRET_DIR" // #nosec // GitHubAppAPIUserFilename is the filename inside the GitHub App secrets dir which will contain the user we will // use for GitHub API calls when present. GitHubAppAPIUserFilename = "username" // LighthousePipelineActivityNameLabel is added to the LighthouseJob with // the name of the PipelineActivity corresponding to it. LighthousePipelineActivityNameLabel = "lighthouse.jenkins-x.io/activityName" // LighthouseJobAnnotation is added in resources created by lighthouse and // carries the name of the job that the pod is running. Since // job names can be arbitrarily long, this is added as // an annotation instead of a label. LighthouseJobAnnotation = "lighthouse.jenkins-x.io/job" // OrgLabel is added in resources created by Lighthouse and // carries the org associated with the job, eg kubernetes-sigs. OrgLabel = "lighthouse.jenkins-x.io/refs.org" // RepoLabel is added in resources created by Lighthouse and // carries the repo associated with the job, eg test-infra RepoLabel = "lighthouse.jenkins-x.io/refs.repo" // PullLabel is added in resources created by Lighthouse and // carries the PR number associated with the job, eg 321. PullLabel = "lighthouse.jenkins-x.io/refs.pull" // ContextLabel is added in resources created by Lighthouse and contains the job context. ContextLabel = "lighthouse.jenkins-x.io/context" // BranchLabel is added in resources created by Lighthouse and contains the branch name for the job. BranchLabel = "lighthouse.jenkins-x.io/branch" // BuildNumLabel is added in resources created by Lighthouse and contains the build number for the job. BuildNumLabel = "lighthouse.jenkins-x.io/buildNum" // LastCommitSHALabel is added in resources created by Lighthouse and contains the SHA being built. LastCommitSHALabel = "lighthouse.jenkins-x.io/lastCommitSHA" // BaseSHALabel is added in resources created by Lighthouse and contains the base SHA (for PRs) to be merged against.. BaseSHALabel = "lighthouse.jenkins-x.io/baseSHA" // CloneURIAnnotation is added in resources created by Lighthouse and contains the clone URI for the git repo. CloneURIAnnotation = "lighthouse.jenkins-x.io/cloneURI" // GithubServer the default github server URL GithubServer = "https://github.com" // ProwConfigMapName name of the ConfgMap holding the config ProwConfigMapName = "config" // ProwPluginsConfigMapName name of the ConfigMap holding the plugins config ProwPluginsConfigMapName = "plugins" // ProwConfigFilename config file name ProwConfigFilename = "config.yaml" // ProwPluginsFilename plugins file name ProwPluginsFilename = "plugins.yaml" // LighthouseCommandPrefix is an optional prefix for commands to deal with things like GitLab hijacking /approve LighthouseCommandPrefix = "lh-" // LighthouseUserAgent is the header value for User-Agent when Lighthouse calls external plugins LighthouseUserAgent = "LighthouseHook" // LighthouseWebhookKindHeader is the header key used for the webhook kind when relaying to external plugins LighthouseWebhookKindHeader = "X-Lighthouse-Webhook-Kind" // LighthouseSignatureHeader is the header key used for the signature when relaying to external plugins LighthouseSignatureHeader = "X-Lighthouse-Signature" // LighthousePayloadTypeHeader is the header key displaying what type of payload this is, either "webhook" or "activity" LighthousePayloadTypeHeader = "X-Lighthouse-Payload-Type" // LighthousePayloadTypeWebhook is the webhook type LighthousePayloadTypeWebhook = "webhook" // LighthousePayloadTypeActivity is the activity type LighthousePayloadTypeActivity = "activity" )
Variables ¶
This section is empty.
Functions ¶
func AddAuthToSCMClient ¶ added in v0.0.492
AddAuthToSCMClient configures an existing go-scm client with transport and authorization using the given token, depending on whether the token is a GitHub App token
func BlobURLForProvider ¶ added in v0.0.717
func BlobURLForProvider(providerType string, baseURL *url.URL, owner, repo, branch string, fullPath string) string
BlobURLForProvider gets the link to the blob for an individual file in a commit or branch
func CallExternalPluginsWithActivityRecord ¶ added in v0.0.650
func CallExternalPluginsWithActivityRecord(l *logrus.Entry, externalPlugins []plugins.ExternalPlugin, activity *v1alpha1.ActivityRecord, hmacToken string, wg *sync.WaitGroup)
CallExternalPluginsWithActivityRecord dispatches the provided activity record to the external plugins.
func CallExternalPluginsWithWebhook ¶ added in v0.0.650
func CallExternalPluginsWithWebhook(l *logrus.Entry, externalPlugins []plugins.ExternalPlugin, webhook scm.Webhook, hmacToken string, wg *sync.WaitGroup)
CallExternalPluginsWithWebhook dispatches the provided webhook to the external plugins.
func ExternalPluginsForEvent ¶ added in v0.0.650
func ExternalPluginsForEvent(pluginConfig *plugins.ConfigAgent, eventKind string, srcRepo string) []plugins.ExternalPlugin
ExternalPluginsForEvent returns whether there are any external plugins that need to get the present event.
func FileExists ¶ added in v0.0.492
FileExists checks if path exists and is a file
func GetBotName ¶ added in v0.0.697
GetBotName returns the bot name from the environment
func GetGitHubAppAPIUser ¶ added in v0.0.492
GetGitHubAppAPIUser returns the username to be used for GitHub API calls with the GitHub App, if so configured. If there is no configured secrets dir, it returns an empty string.
func GetGitHubAppSecretDir ¶ added in v0.0.492
func GetGitHubAppSecretDir() string
GetGitHubAppSecretDir returns the location of the GitHub App secrets dir, if defined, and an empty string otherwise
func GetGitServer ¶ added in v0.0.697
GetGitServer returns the git server base URL from the environment
func GetSCMClient ¶ added in v0.0.697
func GetSCMClient(owner string, cfg config.Getter) (scmprovider.SCMClient, *scm.Client, string, string, error)
GetSCMClient gets the Lighthouse SCM client, go-scm client, server URL, and token for the current user and server
func GetSCMToken ¶ added in v0.0.697
GetSCMToken gets the SCM secret from the environment
func HMACToken ¶ added in v0.0.697
func HMACToken() string
HMACToken gets the HMAC token from the environment
func ParseExternalPluginEvent ¶ added in v0.0.650
func ParseExternalPluginEvent(req *http.Request, secretToken string) (scm.Webhook, *v1alpha1.ActivityRecord, error)
ParseExternalPluginEvent parses a webhook relayed to an external plugin
func Stopper ¶ added in v0.0.699
func Stopper() chan struct{}
Stopper returns a channel that remains open until an interrupt is received.
func ToValidName ¶ added in v0.0.525
ToValidName converts the given string into a valid Kubernetes resource name
func ToValidNameTruncated ¶ added in v0.0.525
ToValidNameTruncated converts the given string into a valid Kubernetes resource name, truncating the result if it is more than maxLength characters.
Types ¶
type OwnerTokensDir ¶ added in v0.0.492
type OwnerTokensDir struct {
// contains filtered or unexported fields
}
OwnerTokensDir handles finding owner based tokens in a directory for GitHub Apps
func NewOwnerTokensDir ¶ added in v0.0.492
func NewOwnerTokensDir(gitServer, dir string) *OwnerTokensDir
NewOwnerTokensDir creates a new dir token scanner