Help us shape the future of Go! Take the 2026 Go Developer Survey

azdo

package
v1.36.0 Latest Latest
Warning

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

Go to latest
Published: Oct 15, 2026 License: MIT Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// hostname of the AzDo PaaS service.
	AzDoHostName = "dev.azure.com"
	// environment variable that holds the Azure DevOps PAT
	AzDoPatName = "AZURE_DEVOPS_EXT_PAT"
	// environment variable that holds the Azure DevOps Organization Name
	AzDoEnvironmentOrgName = "AZURE_DEVOPS_ORG_NAME"
	// Environment Configuration name used to store the project Id
	AzDoEnvironmentProjectIdName = "AZURE_DEVOPS_PROJECT_ID"
	// Environment Configuration name used to store the project name
	AzDoEnvironmentProjectName = "AZURE_DEVOPS_PROJECT_NAME"
	// Environment Configuration name used to store repo ID
	AzDoEnvironmentRepoIdName = "AZURE_DEVOPS_REPOSITORY_ID"
	// Environment Configuration name used to store the Repo Name
	AzDoEnvironmentRepoName = "AZURE_DEVOPS_REPOSITORY_NAME"
	// web url for the configured repo. This is displayed on a the command line after a successful
	// invocation of azd pipeline config
	AzDoEnvironmentRepoWebUrl = "AZURE_DEVOPS_REPOSITORY_WEB_URL"
	// success message after azd pipeline config is successful
	AzdoConfigSuccessMessage = "\nSuccessfully configured Azure DevOps Repository %s\n"
	// name of the azure pipeline that will be created
	AzurePipelineName = "Azure Dev Deploy"
	// path to the azure pipeline yaml
	AzurePipelineYamlPath = ".azdo/pipelines/azure-dev.yml"
	// target Azure Cloud
	CloudEnvironment = "AzureCloud"
	// default branch for pipeline and branch policy
	DefaultBranch = "main"
	// azure devops project description
	AzDoProjectDescription = "Azure Developer CLI Project"
	// name of the service connection that will be used in the AzDo project. This will store the Azure service principal
	ServiceConnectionName = "azconnection"
)

Functions

func CreateBuildPolicy

func CreateBuildPolicy(
	ctx context.Context,
	connection *azuredevops.Connection,
	projectId string,
	repoId string,
	buildDefinition *build.BuildDefinition,
	env *environment.Environment) error

create the PR build policy to ensure that the pipeline runs on a new pull request this also disables direct pushes to the default branch and requires changes to go through a PR.

func CreatePipeline

func CreatePipeline(
	ctx context.Context,
	projectId string,
	name string,
	repoName string,
	connection *azuredevops.Connection,
	credentials *entraid.AzureCredentials,
	env *environment.Environment,
	console input.Console,
	provisioningProvider provisioning.Options,
	additionalSecrets map[string]string,
	additionalVariables map[string]string) (*build.BuildDefinition, error)

create a new Azure DevOps pipeline

func CreateRepository

func CreateRepository(
	ctx context.Context,
	projectId string,
	repoName string,
	connection *azuredevops.Connection,
) (*git.GitRepository, error)

create a new repository in the current project

func CreateServiceConnection

func CreateServiceConnection(
	ctx context.Context,
	connection *azuredevops.Connection,
	projectId string,
	projectName string,
	azdEnvironment *environment.Environment,
	credentials *entraid.AzureCredentials,
	console input.Console) (*serviceendpoint.ServiceEndpoint, error)

create a new service connection that will be used in the deployment pipeline

func EnsureOrgNameExists

func EnsureOrgNameExists(
	ctx context.Context,
	envManager environment.Manager,
	env *environment.Environment,
	console input.Console,
) (
	string, bool, error)

helper method to ensure an Azure DevOps organization name exists either in .env or system environment variables

func EnsurePatExists

func EnsurePatExists(ctx context.Context, env *environment.Environment, console input.Console) (
	string, bool, error)

helper method to ensure an Azure DevOps PAT exists either in .env or system environment variables

func GetConnection

func GetConnection(
	ctx context.Context, organization string, personalAccessToken string) (*azuredevops.Connection, error)

helper method to return an Azure DevOps connection used the AzDo go sdk

func GetDefaultGitRepositoriesInProject

func GetDefaultGitRepositoriesInProject(
	ctx context.Context,
	projectName string,
	connection *azuredevops.Connection,
) (*git.GitRepository, error)

returns a default repo from a newly created AzDo project. this relies on the fact that new projects automatically get a repo named the same as the project

func GetGitRepositoriesInProject

func GetGitRepositoriesInProject(
	ctx context.Context,
	projectName string,
	orgName string,
	connection *azuredevops.Connection,
	console input.Console,
) (*git.GitRepository, error)

prompt the user to select a repo and return a repository object

func GetGitRepository

func GetGitRepository(
	ctx context.Context,
	projectName string,
	repoName string,
	connection *azuredevops.Connection,
) (*git.GitRepository, error)

GetGitRepository find the repository by its name

func GetProjectByName

func GetProjectByName(
	ctx context.Context,
	connection *azuredevops.Connection,
	name string,
) (*core.TeamProjectReference, error)

return an azdo project by name

func GetProjectFromExisting

func GetProjectFromExisting(
	ctx context.Context,
	connection *azuredevops.Connection,
	console input.Console,
) (string, string, error)

prompt the user to select form a list of existing Azure DevOps projects

func GetProjectFromNew

func GetProjectFromNew(
	ctx context.Context,
	repoPath string,
	connection *azuredevops.Connection,
	env *environment.Environment,
	console input.Console,
) (string, string, error)

prompts the user for a new AzDo project name and creates the project returns project name, project id, error

func ListTypes

func ListTypes(
	ctx context.Context,
	connection *azuredevops.Connection,
	projectId string) (*[]serviceendpoint.ServiceEndpointType, error)

func QueueBuild

func QueueBuild(
	ctx context.Context,
	connection *azuredevops.Connection,
	projectId string,
	buildDefinition *build.BuildDefinition,
	branchName string) error

run a pipeline. This is used to invoke the deploy pipeline after a successful push of the code

func ServiceConnection

func ServiceConnection(
	ctx context.Context,
	connection *azuredevops.Connection,
	projectId string, serviceConnectionName *string) (*serviceendpoint.ServiceEndpoint, error)

Types

This section is empty.

Jump to

Keyboard shortcuts

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