Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 7 additions & 16 deletions AzureDevOpsPowerShell/Public/Api/Git/Pushes/Add-FilesToRepo.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -3,32 +3,23 @@ function Add-FilesToRepo {
.SYNOPSIS
Upload path to a repo in Azure DevOps.
.DESCRIPTION
Upload path to a repo in Azure DevOps.
Upload path to a repo in Azure DevOps. Only works if the repo isn't initialized yet.
.EXAMPLE
$params = @{
CollectionUri = "https://dev.azure.com/contoso"
Name = "Repo 1"
ProjectName = "Project 1"
Path = "C:\git\BRC\AzureDevOpsPowerShellAPI"
}
New-AzDoRepo @params
Add-FilesToRepo @params

This example creates a new Azure DevOps repo with splatting parameters
This example adds the files in the path to the repository
.EXAMPLE
$env:SYSTEM_ACCESSTOKEN = '***'
'test', 'test2' | New-AzDoRepo -CollectionUri "https://dev.azure.com/contoso" -ProjectName "Project 1"
'test', 'test2' | New-AzDoRepo -CollectionUri "https://dev.azure.com/contoso" -ProjectName "Project 1" -Path "C:\git\BRC\AzureDevOpsPowerShellAPI"

This example creates a new Azure DevOps repo for each in pipeline
This example adds the files in the path to the repositories 'test' and 'test2'
.OUTPUTS
[PSCustomObject]@{
CollectionUri = $CollectionUri
ProjectName = $ProjectName
RepoName = $res.name
RepoId = $res.id
RepoURL = $res.url
WebUrl = $res.webUrl
HttpsUrl = $res.remoteUrl
SshUrl = $res.sshUrl
}
[PSCustomObject]. An object containing information about the commit and repository
.NOTES
#>
[CmdletBinding(SupportsShouldProcess, ConfirmImpact = 'High')]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ function New-AzDoRepo {
$RepoName,

# Name of the project where the new repository has to be created
[Parameter(Mandatory)]
[Parameter(Mandatory, ValueFromPipelineByPropertyName)]
[string]
$ProjectName
)
Expand Down
77 changes: 39 additions & 38 deletions docs/en-US/.pages
Original file line number Diff line number Diff line change
@@ -1,43 +1,44 @@
nav:
- Home:
- index.md
- ...| About*.md
- index.md
- ...| About*.md
- ...| Example*.md
- Modules:
- Approvals And Checks:
- Check Configurations:
- Add-AzDoPipelineBranchControl.md
- Build:
- General Settings:
- Set-AzDoProjectSetting.md
- Core:
- Projects:
- ... | *AzDoProject.md
- Distributed Task:
- VariableGroups:
- ... | *AzDoVariableGroup*.md
- Environments:
- Approvals And Checks:
- Check Configurations:
- Add-AzDoPipelineBranchControl.md
- Build:
- General Settings:
- Set-AzDoProjectSetting.md
- Core:
- Projects:
- ... | *AzDoProject.md
- Distributed Task:
- VariableGroups:
- ... | *AzDoVariableGroup*.md
- Environments:
- ... | *AzDoEnvironment.md
- Git:
- Pushes:
- Add-FilesToRepo.md
- Repositories:
- ... | *AzDoRepo.md
- Pipelines:
- Environments:
- ... | *AzDoEnvironment.md
- Git:
- Pushes:
- Add-FilesToRepo.md
- Repositories:
- ... | *AzDoRepo.md
- Pipelines:
- ... | *AzDoPipeline.md
- Policy:
- Configuration:
- Get-AzDoBranchPolicy.md
- Set-AzDoBranchPolicyBuildValidation.md
- Set-AzDoBranchPolicyCommentResolution.md
- Set-AzDoBranchPolicyMergeStrategy.md
- Set-AzDoBranchPolicyMinimalApproval.md
- Types:
- Get-AzDoBranchPolicyType.md
- Service Endpoints:
- Endpoint proxy:
- Test-AzDoServiceConnection.md
- Endpoints:
- Get-AzDoServiceConnection.md
- New-AzDoServiceConnection.md
- Pipelines:
- ... | *AzDoPipeline.md
- Policy:
- Configuration:
- Get-AzDoBranchPolicy.md
- Set-AzDoBranchPolicyBuildValidation.md
- Set-AzDoBranchPolicyCommentResolution.md
- Set-AzDoBranchPolicyMergeStrategy.md
- Set-AzDoBranchPolicyMinimalApproval.md
- Types:
- Get-AzDoBranchPolicyType.md
- Service Endpoints:
- Endpoint proxy:
- Test-AzDoServiceConnection.md
- Endpoints:
- Get-AzDoServiceConnection.md
- New-AzDoServiceConnection.md
29 changes: 29 additions & 0 deletions docs/en-US/Example_Usage.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Example usage

This example shows you how can you can add a repository to your existing Azure DevOps project, add files to it, and create pipelines from those files.

## Get Azure DevOps project

```powershell
Connect-AzAccount

$project = Get-AzDoProject -CollectionUri "https://dev.azure.com/contoso" -ProjectName "MyProject"
```

## Create a repository

```powershell
$repo = $project | New-AzDoRepo -RepoName "RepoTest"
```

## Add files to your repository

```powershell
$repo | Add-FilesToRepo -Path "C:/git/MyProject/MyRepo"
```

## Create a pipeline in your Azure DevOps Project

```powershell
$repo | New-AzDoPipeline -PipelineName "TestPipeline" -Path "/pipelines/pipeline1.yml"
```