Skip to content

Commit 9303c31

Browse files
authored
Merge pull request #55 from WeAreInSpark/docs/lucas
update docs and examples
2 parents 0ee2de3 + 2eaf93e commit 9303c31

4 files changed

Lines changed: 76 additions & 55 deletions

File tree

AzureDevOpsPowerShell/Public/Api/Git/Pushes/Add-FilesToRepo.ps1

Lines changed: 7 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3,32 +3,23 @@ function Add-FilesToRepo {
33
.SYNOPSIS
44
Upload path to a repo in Azure DevOps.
55
.DESCRIPTION
6-
Upload path to a repo in Azure DevOps.
6+
Upload path to a repo in Azure DevOps. Only works if the repo isn't initialized yet.
77
.EXAMPLE
88
$params = @{
99
CollectionUri = "https://dev.azure.com/contoso"
1010
Name = "Repo 1"
1111
ProjectName = "Project 1"
12+
Path = "C:\git\BRC\AzureDevOpsPowerShellAPI"
1213
}
13-
New-AzDoRepo @params
14+
Add-FilesToRepo @params
1415
15-
This example creates a new Azure DevOps repo with splatting parameters
16+
This example adds the files in the path to the repository
1617
.EXAMPLE
17-
$env:SYSTEM_ACCESSTOKEN = '***'
18-
'test', 'test2' | New-AzDoRepo -CollectionUri "https://dev.azure.com/contoso" -ProjectName "Project 1"
18+
'test', 'test2' | New-AzDoRepo -CollectionUri "https://dev.azure.com/contoso" -ProjectName "Project 1" -Path "C:\git\BRC\AzureDevOpsPowerShellAPI"
1919
20-
This example creates a new Azure DevOps repo for each in pipeline
20+
This example adds the files in the path to the repositories 'test' and 'test2'
2121
.OUTPUTS
22-
[PSCustomObject]@{
23-
CollectionUri = $CollectionUri
24-
ProjectName = $ProjectName
25-
RepoName = $res.name
26-
RepoId = $res.id
27-
RepoURL = $res.url
28-
WebUrl = $res.webUrl
29-
HttpsUrl = $res.remoteUrl
30-
SshUrl = $res.sshUrl
31-
}
22+
[PSCustomObject]. An object containing information about the commit and repository
3223
.NOTES
3324
#>
3425
[CmdletBinding(SupportsShouldProcess, ConfirmImpact = 'High')]

AzureDevOpsPowerShell/Public/Api/Git/Repositories/New-AzDoRepo.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ function New-AzDoRepo {
4343
$RepoName,
4444

4545
# Name of the project where the new repository has to be created
46-
[Parameter(Mandatory)]
46+
[Parameter(Mandatory, ValueFromPipelineByPropertyName)]
4747
[string]
4848
$ProjectName
4949
)

docs/en-US/.pages

Lines changed: 39 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,44 @@
11
nav:
22
- Home:
3-
- index.md
4-
- ...| About*.md
3+
- index.md
4+
- ...| About*.md
5+
- ...| Example*.md
56
- Modules:
6-
- Approvals And Checks:
7-
- Check Configurations:
8-
- Add-AzDoPipelineBranchControl.md
9-
- Build:
10-
- General Settings:
11-
- Set-AzDoProjectSetting.md
12-
- Core:
13-
- Projects:
14-
- ... | *AzDoProject.md
15-
- Distributed Task:
16-
- VariableGroups:
17-
- ... | *AzDoVariableGroup*.md
18-
- Environments:
7+
- Approvals And Checks:
8+
- Check Configurations:
9+
- Add-AzDoPipelineBranchControl.md
10+
- Build:
11+
- General Settings:
12+
- Set-AzDoProjectSetting.md
13+
- Core:
14+
- Projects:
15+
- ... | *AzDoProject.md
16+
- Distributed Task:
17+
- VariableGroups:
18+
- ... | *AzDoVariableGroup*.md
1919
- Environments:
20-
- ... | *AzDoEnvironment.md
21-
- Git:
22-
- Pushes:
23-
- Add-FilesToRepo.md
24-
- Repositories:
25-
- ... | *AzDoRepo.md
26-
- Pipelines:
20+
- Environments:
21+
- ... | *AzDoEnvironment.md
22+
- Git:
23+
- Pushes:
24+
- Add-FilesToRepo.md
25+
- Repositories:
26+
- ... | *AzDoRepo.md
2727
- Pipelines:
28-
- ... | *AzDoPipeline.md
29-
- Policy:
30-
- Configuration:
31-
- Get-AzDoBranchPolicy.md
32-
- Set-AzDoBranchPolicyBuildValidation.md
33-
- Set-AzDoBranchPolicyCommentResolution.md
34-
- Set-AzDoBranchPolicyMergeStrategy.md
35-
- Set-AzDoBranchPolicyMinimalApproval.md
36-
- Types:
37-
- Get-AzDoBranchPolicyType.md
38-
- Service Endpoints:
39-
- Endpoint proxy:
40-
- Test-AzDoServiceConnection.md
41-
- Endpoints:
42-
- Get-AzDoServiceConnection.md
43-
- New-AzDoServiceConnection.md
28+
- Pipelines:
29+
- ... | *AzDoPipeline.md
30+
- Policy:
31+
- Configuration:
32+
- Get-AzDoBranchPolicy.md
33+
- Set-AzDoBranchPolicyBuildValidation.md
34+
- Set-AzDoBranchPolicyCommentResolution.md
35+
- Set-AzDoBranchPolicyMergeStrategy.md
36+
- Set-AzDoBranchPolicyMinimalApproval.md
37+
- Types:
38+
- Get-AzDoBranchPolicyType.md
39+
- Service Endpoints:
40+
- Endpoint proxy:
41+
- Test-AzDoServiceConnection.md
42+
- Endpoints:
43+
- Get-AzDoServiceConnection.md
44+
- New-AzDoServiceConnection.md

docs/en-US/Example_Usage.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# Example usage
2+
3+
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.
4+
5+
## Get Azure DevOps project
6+
7+
```powershell
8+
Connect-AzAccount
9+
10+
$project = Get-AzDoProject -CollectionUri "https://dev.azure.com/contoso" -ProjectName "MyProject"
11+
```
12+
13+
## Create a repository
14+
15+
```powershell
16+
$repo = $project | New-AzDoRepo -RepoName "RepoTest"
17+
```
18+
19+
## Add files to your repository
20+
21+
```powershell
22+
$repo | Add-FilesToRepo -Path "C:/git/MyProject/MyRepo"
23+
```
24+
25+
## Create a pipeline in your Azure DevOps Project
26+
27+
```powershell
28+
$repo | New-AzDoPipeline -PipelineName "TestPipeline" -Path "/pipelines/pipeline1.yml"
29+
```

0 commit comments

Comments
 (0)