gitprovider

package
v0.0.0-...-55c26e6 Latest Latest
Warning

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

Go to latest
Published: Nov 28, 2024 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PipelinesAsCodeWebhhokInsecureSslEnvVar = "PAC_WEBHOOK_INSECURE_SSL"
)

Variables

This section is empty.

Functions

func IsInsecureSSL

func IsInsecureSSL() bool

Types

type GitProviderClient

type GitProviderClient interface {
	// EnsurePaCMergeRequest creates or updates existing (if needed) Pipelines as Code configuration proposal merge request.
	// Returns the merge request web URL.
	// If there is no error and web URL is empty, it means that the merge request is not needed (main branch is up to date).
	EnsurePaCMergeRequest(repoUrl string, data *MergeRequestData) (webUrl string, err error)

	// UndoPaCMergeRequest creates or updates existing Pipelines as Code configuration removal merge request.
	// Returns the merge request web URL.
	// If there is no error and web URL is empty, it means that the merge request is not needed (the configuraton has already been deleted).
	UndoPaCMergeRequest(repoUrl string, data *MergeRequestData) (webUrl string, err error)

	// FindUnmergedPaCMergeRequest searches for existing Pipelines as Code configuration proposal merge request
	FindUnmergedPaCMergeRequest(repoUrl string, data *MergeRequestData) (*MergeRequest, error)

	// SetupPaCWebhook creates Pipelines as Code webhook in the given repository
	SetupPaCWebhook(repoUrl, webhookUrl, webhookSecret string) error

	// DeletePaCWebhook deletes Pipelines as Code webhook in the given repository
	DeletePaCWebhook(repoUrl, webhookUrl string) error

	// GetDefaultBranch returns name of default branch in the given repository
	GetDefaultBranch(repoUrl string) (string, error)

	// DeleteBranch deletes given branch from repository.
	// Returns true if branch was deleted, false if the branch didn't exist.
	DeleteBranch(repoUrl, branchName string) (bool, error)

	// GetBranchSha returns SHA of top commit in the given branch
	GetBranchSha(repoUrl, branchName string) (string, error)

	// IsFileExist check whether given file exists in the given branch of the reposiotry
	IsFileExist(repoUrl, branchName, filePath string) (bool, error)

	// IsRepositoryPublic returns true if the repository could be accessed without authentication
	IsRepositoryPublic(repoUrl string) (bool, error)

	// GetBrowseRepositoryAtShaLink returns web URL of repository state at given SHA
	GetBrowseRepositoryAtShaLink(repoUrl, sha string) string

	// GetConfiguredGitAppName returns configured git application name and id.
	// Not all git providers support applications. Currently only GitHub does.
	GetConfiguredGitAppName() (string, string, error)
}

type MergeRequest

type MergeRequest struct {
	Id        int64
	CreatedAt *time.Time
	WebUrl    string
	Title     string
}

type MergeRequestData

type MergeRequestData struct {
	CommitMessage  string
	SignedOff      bool
	BranchName     string
	BaseBranchName string
	Title          string
	Text           string
	AuthorName     string
	AuthorEmail    string
	Files          []RepositoryFile
}

type RepositoryFile

type RepositoryFile struct {
	FullPath string
	Content  []byte
}

Jump to

Keyboard shortcuts

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