Documentation
¶
Index ¶
- Variables
- func CheckGitUrlError(err error) error
- type ApplicationInstallation
- type GithubClient
- func (g *GithubClient) DeleteBranch(repoUrl, branchName string) (bool, error)
- func (g *GithubClient) DeletePaCWebhook(repoUrl, webhookUrl string) error
- func (g *GithubClient) DownloadFileContent(repoUrl, branchName, filePath string) ([]byte, error)
- func (g *GithubClient) EnsurePaCMergeRequest(repoUrl string, d *gp.MergeRequestData) (webUrl string, err error)
- func (g *GithubClient) FindUnmergedPaCMergeRequest(repoUrl string, d *gp.MergeRequestData) (*gp.MergeRequest, error)
- func (g *GithubClient) GetAppUserId(userName string) (int64, error)
- func (g *GithubClient) GetBranchSha(repoUrl, branchName string) (string, error)
- func (g *GithubClient) GetBrowseRepositoryAtShaLink(repoUrl, sha string) string
- func (g *GithubClient) GetConfiguredGitAppName() (string, string, error)
- func (g *GithubClient) GetDefaultBranchWithChecks(repoUrl string) (string, error)
- func (g *GithubClient) IsFileExist(repoUrl, branchName, filePath string) (bool, error)
- func (g *GithubClient) IsRepositoryPublic(repoUrl string) (bool, error)
- func (g *GithubClient) SetupPaCWebhook(repoUrl, webhookUrl, webhookSecret string) error
- func (g *GithubClient) UndoPaCMergeRequest(repoUrl string, d *gp.MergeRequestData) (webUrl string, err error)
Constants ¶
This section is empty.
Variables ¶
var GetAppInstallationsForRepository func(githubAppIdStr string, appPrivateKeyPem []byte, repoUrl string) (*ApplicationInstallation, string, error) = getAppInstallationsForRepository
var NewGithubClient func(accessToken string) *GithubClient = newGithubClient
Allow mocking for tests
var NewGithubClientByApp func(appId int64, privateKeyPem []byte, repoUrl string) (*GithubClient, error) = newGithubClientByApp
Allow mocking for tests
var NewGithubClientWithBasicAuth func(username, password string) *GithubClient = newGithubClientWithBasicAuth
Functions ¶
func CheckGitUrlError ¶
CheckGitUrlError returns more specific git error
Types ¶
type ApplicationInstallation ¶
type ApplicationInstallation struct {
Token string
ID int64
Repositories []*github.Repository
}
type GithubClient ¶
type GithubClient struct {
// contains filtered or unexported fields
}
func (*GithubClient) DeleteBranch ¶
func (g *GithubClient) DeleteBranch(repoUrl, branchName string) (bool, error)
DeleteBranch deletes given branch from repository
func (*GithubClient) DeletePaCWebhook ¶
func (g *GithubClient) DeletePaCWebhook(repoUrl, webhookUrl string) error
DeletePaCWebhook deletes Pipelines as Code webhook in the given repository
func (*GithubClient) DownloadFileContent ¶
func (g *GithubClient) DownloadFileContent(repoUrl, branchName, filePath string) ([]byte, error)
func (*GithubClient) EnsurePaCMergeRequest ¶
func (g *GithubClient) EnsurePaCMergeRequest(repoUrl string, d *gp.MergeRequestData) (webUrl string, err error)
EnsurePaCMergeRequest creates or updates existing Pipelines as Code configuration proposal merge request
func (*GithubClient) FindUnmergedPaCMergeRequest ¶
func (g *GithubClient) FindUnmergedPaCMergeRequest(repoUrl string, d *gp.MergeRequestData) (*gp.MergeRequest, error)
FindUnmergedPaCMergeRequest finds out the unmerged merge request that is opened during the component onboarding An onboarding merge request fulfills both: 1) opened based on the base branch which is determined by the Revision or is the default branch of component repository 2) opened from head ref: owner:appstudio-{component.Name} If no onboarding merge request is found, nil is returned.
func (*GithubClient) GetAppUserId ¶
func (g *GithubClient) GetAppUserId(userName string) (int64, error)
GetAppUserId get info about application user
func (*GithubClient) GetBranchSha ¶
func (g *GithubClient) GetBranchSha(repoUrl, branchName string) (string, error)
GetBranchSha returns SHA of top commit in the given branch If branch name is empty, default branch is used.
func (*GithubClient) GetBrowseRepositoryAtShaLink ¶
func (g *GithubClient) GetBrowseRepositoryAtShaLink(repoUrl, sha string) string
func (*GithubClient) GetConfiguredGitAppName ¶
func (g *GithubClient) GetConfiguredGitAppName() (string, string, error)
GetConfiguredGitAppName returns name and slug of GitHub App that created client token.
func (*GithubClient) GetDefaultBranchWithChecks ¶
func (g *GithubClient) GetDefaultBranchWithChecks(repoUrl string) (string, error)
GetDefaultBranchWithChecks returns name of default branch in the given repository also performs additional checks if repo exists and hostname is valid and returns more specific error
func (*GithubClient) IsFileExist ¶
func (g *GithubClient) IsFileExist(repoUrl, branchName, filePath string) (bool, error)
IsFileExist check whether given file exists in the given branch of the reposiotry. If branch is empty string, default branch is used.
func (*GithubClient) IsRepositoryPublic ¶
func (g *GithubClient) IsRepositoryPublic(repoUrl string) (bool, error)
IsRepositoryPublic returns true if the repository could be accessed without authentication
func (*GithubClient) SetupPaCWebhook ¶
func (g *GithubClient) SetupPaCWebhook(repoUrl, webhookUrl, webhookSecret string) error
SetupPaCWebhook creates Pipelines as Code webhook in the given repository
func (*GithubClient) UndoPaCMergeRequest ¶
func (g *GithubClient) UndoPaCMergeRequest(repoUrl string, d *gp.MergeRequestData) (webUrl string, err error)
UndoPaCMergeRequest creates or updates existing Pipelines as Code configuration removal merge request