util

package
v0.0.520 Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2020 License: Apache-2.0 Imports: 13 Imported by: 2

Documentation

Index

Constants

View Source
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"
)

Variables

This section is empty.

Functions

func AddAuthToSCMClient added in v0.0.492

func AddAuthToSCMClient(client *scm.Client, token string, isGitHubApp bool)

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 DirExists added in v0.0.492

func DirExists(path string) (bool, error)

DirExists checks if path exists and is a directory

func FileExists added in v0.0.492

func FileExists(path string) (bool, error)

FileExists checks if path exists and is a file

func GetGitHubAppAPIUser added in v0.0.492

func GetGitHubAppAPIUser() (string, error)

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

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

func (*OwnerTokensDir) FindToken added in v0.0.492

func (o *OwnerTokensDir) FindToken(owner string) (string, error)

FindToken finds the token for the given owner

Jump to

Keyboard shortcuts

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