pipeline

package
v0.0.0-...-ddafa38 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2024 License: MIT Imports: 41 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AuthTypeFederated         PipelineAuthType = "federated"
	AuthTypeClientCredentials PipelineAuthType = "client-credentials"

	AzurePipelineClientIdEnvVarName string = "AZURE_PIPELINE_CLIENT_ID"
)

Variables

View Source
var (
	ErrAuthNotSupported = errors.New("pipeline authentication configuration is not supported")
	DefaultRoleNames    = []string{"Contributor", "User Access Administrator"}
)
View Source
var ErrRemoteHostIsNotAzDo = errors.New("existing remote is not an Azure DevOps host")

ErrRemoteHostIsNotAzDo the error used when a non Azure DevOps remote is found

View Source
var ErrRemoteHostIsNotGitHub = errors.New("not a github host")

ErrRemoteHostIsNotGitHub the error used when a non GitHub remote is found

View Source
var ErrSSHNotSupported = errors.New("ssh git remote is not supported. " +
	"Use HTTPS git remote to connect the remote repository")

ErrSSHNotSupported the error used when ssh git remote is detected

Functions

This section is empty.

Types

type AzdoCiProvider

type AzdoCiProvider struct {
	Env        *environment.Environment
	AzdContext *azdcontext.AzdContext
	// contains filtered or unexported fields
}

AzdoCiProvider implements a CiProvider using Azure DevOps to manage CI with azdo pipelines.

func (*AzdoCiProvider) Name

func (p *AzdoCiProvider) Name() string

name returns the name of the provider.

type AzdoRepositoryDetails

type AzdoRepositoryDetails struct {
	// contains filtered or unexported fields
}

AzdoRepositoryDetails provides extra state needed for the AzDo provider. this is stored as the details property in repoDetails

type AzdoScmProvider

type AzdoScmProvider struct {
	// contains filtered or unexported fields
}

AzdoScmProvider implements ScmProvider using Azure DevOps as the provider for source control manager.

func (*AzdoScmProvider) GitPush

func (p *AzdoScmProvider) GitPush(
	ctx context.Context,
	gitRepo *gitRepositoryDetails,
	remoteName string,
	branchName string) error

Push code and queue pipeline

func (*AzdoScmProvider) Name

func (p *AzdoScmProvider) Name() string

name returns the name of the provider

func (*AzdoScmProvider) StoreRepoDetails

func (p *AzdoScmProvider) StoreRepoDetails(ctx context.Context, repo *azdoGit.GitRepository) error

stores repo details in state for use in other functions. Also saves AzDo project details to .env

type CiPipeline

type CiPipeline interface {
	// contains filtered or unexported methods
}

CiPipeline provides the functional contract for a CI/CD provider to define getting the pipeline name and the url to access the pipeline.

type CiProvider

type CiProvider interface {
	// contains filtered or unexported methods
}

CiProvider defines the base behavior for a continuous integration provider.

func NewAzdoCiProvider

func NewAzdoCiProvider(
	envManager environment.Manager,
	env *environment.Environment,
	azdContext *azdcontext.AzdContext,
	console input.Console,
	commandRunner exec.CommandRunner,
) CiProvider

func NewGitHubCiProvider

func NewGitHubCiProvider(
	env *environment.Environment,
	credentialProvider account.SubscriptionCredentialProvider,
	entraIdService entraid.EntraIdService,
	ghCli *github.Cli,
	gitCli *git.Cli,
	console input.Console) CiProvider

type CredentialOptions

type CredentialOptions struct {
	EnableClientCredentials    bool
	EnableFederatedCredentials bool
	FederatedCredentialOptions []*graphsdk.FederatedIdentityCredential
}

CredentialOptions represents the options for configuring credentials for a pipeline.

type GitHubCiProvider

type GitHubCiProvider struct {
	// contains filtered or unexported fields
}

GitHubCiProvider implements a CiProvider using GitHub to manage CI pipelines as GitHub actions.

func (*GitHubCiProvider) Name

func (p *GitHubCiProvider) Name() string

name returns the name of the provider.

type GitHubScmProvider

type GitHubScmProvider struct {
	// contains filtered or unexported fields
}

GitHubScmProvider implements ScmProvider using GitHub as the provider for source control manager.

func (*GitHubScmProvider) GitPush

func (p *GitHubScmProvider) GitPush(
	ctx context.Context,
	gitRepo *gitRepositoryDetails,
	remoteName string,
	branchName string) error

func (*GitHubScmProvider) Name

func (p *GitHubScmProvider) Name() string

name returns the name of the provider

type PipelineAuthType

type PipelineAuthType string

type PipelineConfigResult

type PipelineConfigResult struct {
	RepositoryLink string
	PipelineLink   string
}

type PipelineManager

type PipelineManager struct {
	// contains filtered or unexported fields
}

PipelineManager takes care of setting up the scm and pipeline. The manager allows to use and test scm providers without a cobra command.

func NewPipelineManager

func NewPipelineManager(
	ctx context.Context,
	envManager environment.Manager,
	entraIdService entraid.EntraIdService,
	gitCli *git.Cli,
	azdCtx *azdcontext.AzdContext,
	env *environment.Environment,
	console input.Console,
	args *PipelineManagerArgs,
	serviceLocator ioc.ServiceLocator,
	importManager *project.ImportManager,
	userConfigManager config.UserConfigManager,
) (*PipelineManager, error)

func (*PipelineManager) CiProviderName

func (pm *PipelineManager) CiProviderName() string

func (*PipelineManager) Configure

func (pm *PipelineManager) Configure(ctx context.Context, projectName string) (result *PipelineConfigResult, err error)

Configure is the main function from the pipeline manager which takes care of creating or setting up the git project, the ci pipeline and the Azure connection.

func (*PipelineManager) ScmProviderName

func (pm *PipelineManager) ScmProviderName() string

type PipelineManagerArgs

type PipelineManagerArgs struct {
	PipelineServicePrincipalId   string
	PipelineServicePrincipalName string
	PipelineRemoteName           string
	PipelineRoleNames            []string
	PipelineProvider             string
	PipelineAuthTypeName         string
	ServiceManagementReference   string
}

PipelineManagerArgs represents the arguments passed to the pipeline manager from Azd CLI

type ScmProvider

type ScmProvider interface {

	//Hook function to allow SCM providers to handle scenarios after the git push is complete
	GitPush(ctx context.Context,
		gitRepo *gitRepositoryDetails,
		remoteName string,
		branchName string) error
	// contains filtered or unexported methods
}

ScmProvider defines the base behavior for a source control manager provider.

func NewAzdoScmProvider

func NewAzdoScmProvider(
	envManager environment.Manager,
	env *environment.Environment,
	azdContext *azdcontext.AzdContext,
	commandRunner exec.CommandRunner,
	console input.Console,
	gitCli *git.Cli,
) ScmProvider

func NewGitHubScmProvider

func NewGitHubScmProvider(
	console input.Console,
	ghCli *github.Cli,
	gitCli *git.Cli,
) ScmProvider

Jump to

Keyboard shortcuts

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