Documentation
¶
Index ¶
- Constants
- Variables
- type AzdoCiProvider
- type AzdoRepositoryDetails
- type AzdoScmProvider
- type CiPipeline
- type CiProvider
- type CredentialOptions
- type GitHubCiProvider
- type GitHubScmProvider
- type PipelineAuthType
- type PipelineConfigResult
- type PipelineManager
- func (pm *PipelineManager) CiProviderName() string
- func (pm *PipelineManager) Configure(ctx context.Context, projectName string, infra *project.Infra) (result *PipelineConfigResult, err error)
- func (pm *PipelineManager) ScmProviderName() string
- func (pm *PipelineManager) SetParameters(parameters []provisioning.Parameter)
- type PipelineManagerArgs
- type ScmProvider
Constants ¶
const ( AuthTypeFederated PipelineAuthType = "federated" AuthTypeClientCredentials PipelineAuthType = "client-credentials" AzurePipelineClientIdEnvVarName string = "AZURE_PIPELINE_CLIENT_ID" AzurePipelineMsiResourceId string = "AZURE_PIPELINE_MSI_CLIENT_ID" )
Variables ¶
var ( ErrAuthNotSupported = errors.New("pipeline authentication configuration is not supported") DefaultRoleNames = []string{"Contributor", "User Access Administrator"} )
var ErrRemoteHostIsNotAzDo = errors.New("existing remote is not an Azure DevOps host")
ErrRemoteHostIsNotAzDo the error used when a non Azure DevOps remote is found
var ErrRemoteHostIsNotGitHub = errors.New("not a github host")
ErrRemoteHostIsNotGitHub the error used when a non GitHub remote is found
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) Name ¶
func (p *GitHubScmProvider) Name() string
name returns the name of the provider
type PipelineAuthType ¶
type PipelineAuthType string
type PipelineConfigResult ¶
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, keyVaultService keyvault.KeyVaultService, msiService armmsi.ArmMsiService, prompter prompt.Prompter, dotnetCli *dotnet.Cli, ) (*PipelineManager, error)
func (*PipelineManager) CiProviderName ¶
func (pm *PipelineManager) CiProviderName() string
func (*PipelineManager) Configure ¶
func (pm *PipelineManager) Configure( ctx context.Context, projectName string, infra *project.Infra) (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
func (*PipelineManager) SetParameters ¶
func (pm *PipelineManager) SetParameters(parameters []provisioning.Parameter)
SetParameters adds parameter configuration for the manager to use during pipeline config. Parameters passed here are automatically defined as variables or secrets in the pipeline without user explicitly defining them in the azure.yaml -> pipeline file. This is useful for provisioning providers to define a list of parameters that are required for the pipeline. If parameters is nil, it means that the pipeline manager should not set up any parameters automatically.
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