Skip to content

Commit

Permalink
AzureDevOpsDsc: Increase Azure DevOps API timeout and other minor fix…
Browse files Browse the repository at this point in the history
…es (#28)

- AzureDevOpsDsc
    - Increased Azure DevOps, API timeout to 5 minutes to allow for busy/slow API
      operations (issue #25).
    - Updated contextual help (issue #5).
    - Removed `Classes` directory from being output in packaged module (issue #10).
    - Removed `Examples` directory from being output in packaged module (issue #11).
    - Moved 'Ensure' and 'RequiredAction' enums into 'Enum' directory and out of
      'prefix.ps1' (issue #12).
  • Loading branch information
SphenicPaul authored Jan 29, 2021
1 parent 48e919e commit f1d8097
Show file tree
Hide file tree
Showing 16 changed files with 73 additions and 41 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
([issue #1](https://github.com/dsccommunity/AzureDevOpsDsc/issues/1))
- Added the `AzDevOpsProject`, DSC Resource
- Fixed non-terminating, integration tests ([issue #18](https://github.com/dsccommunity/AzureDevOpsDsc/issues/18))
- Increased Azure DevOps, API timeout to 5 minutes to allow for busy/slow API
operations ([issue #25](https://github.com/dsccommunity/AzureDevOpsDsc/issues/25)).
- Updated contextual help ([issue #5](https://github.com/dsccommunity/AzureDevOpsDsc/issues/5)).
- Removed `Classes` directory from being output in packaged module ([issue #10](https://github.com/dsccommunity/AzureDevOpsDsc/issues/10)).
- Removed `Examples` directory from being output in packaged module ([issue #11](https://github.com/dsccommunity/AzureDevOpsDsc/issues/11)).
- Moved 'Ensure' and 'RequiredAction' enums into 'Enum' directory and out of
'prefix.ps1' ([issue #12](https://github.com/dsccommunity/AzureDevOpsDsc/issues/12)).
- AzureDevOpsDsc.Common
- Added 'wrapper' functionality around the [Azure DevOps REST API](https://docs.microsoft.com/en-us/rest/api/azure/devops/)

Expand Down
2 changes: 0 additions & 2 deletions build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@
# ModuleBuilder Configuration #
####################################################
CopyPaths:
- Classes
- en-US
- Examples
- Modules
Encoding: UTF8
VersionedOutputDirectory: true
Expand Down
4 changes: 4 additions & 0 deletions source/Classes/001.DscResourceBase.ps1
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
<#
.SYNOPSIS
Defines a base class from which other DSC resources inherit from.
#>
class DscResourceBase
{
hidden [System.String]GetDscResourceKey()
Expand Down
4 changes: 4 additions & 0 deletions source/Classes/002.AzDevOpsApiDscResourceBase.ps1
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
<#
.SYNOPSIS
Defines a base class from which other DSC resources that use the AzureDevOps API inherit from.
#>
class AzDevOpsApiDscResourceBase : DscResourceBase
{
[System.String]$ResourceName = $this.GetResourceName()
Expand Down
11 changes: 4 additions & 7 deletions source/Classes/003.AzDevOpsDscResourceBase.ps1
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
# This enum is re-defined here so it is recognised by 'Import-DscResource' (which won't pre/post-parse the 'using' statements)
#enum Ensure
#{
# Present
# Absent
#}

<#
.SYNOPSIS
Defines a base class from which other AzureDevOps DSC resources inherit from.
#>
class AzDevOpsDscResourceBase : AzDevOpsApiDscResourceBase
{
[DscProperty()]
Expand Down
18 changes: 18 additions & 0 deletions source/Classes/010.AzDevOpsProject.ps1
Original file line number Diff line number Diff line change
@@ -1,3 +1,21 @@
<#
.SYNOPSIS
A DSC Resource for Azure DevOps that represents the 'Project' resource.
.PARAMETER ProjectId
The 'Id' of the Azure DevOps, 'Project' resource.
.PARAMETER ProjectName
The 'Name' of the Azure DevOps, 'Project' resource.
.PARAMETER ProjectDescription
The 'Description' of the Azure DevOps, 'Project' resource.
.PARAMETER SourceControlType
The 'SourceControlType' of the Azure DevOps, 'Project' resource. Valid options are 'Git' and 'Tfvc'.
If the 'Project' resource already exists in Azure DevOps, the 'SourceControlType' cannot be changed to another type.
#>
[DscResource()]
[Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSDSCStandardDSCFunctionsInResource', '', Justification='Test() and Set() method are inherited from base, "AzDevOpsDscResourceBase" class')]
class AzDevOpsProject : AzDevOpsDscResourceBase
Expand Down
9 changes: 9 additions & 0 deletions source/Enum/Ensure.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<#
.SYNOPSIS
Defines whether the DSC resource should be Present or Absent.
#>
enum Ensure
{
Present
Absent
}
14 changes: 14 additions & 0 deletions source/Enum/RequiredAction.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<#
.SYNOPSIS
Defines the `RequiredAction` of the DSC resource.
#>
enum RequiredAction
{
None
Get
New
Set
Remove
Test
Error
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@ function Get-AzDevOpsApiWaitTimeoutMs
[OutputType([Int32])]
param ()

return 10000
return 300000
}
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ function Test-AzDevOpsApiTimeoutExceeded
$EndTime,

[Parameter(Mandatory = $true)]
[ValidateRange(250,10000)]
[ValidateRange(250,300000)]
[Int32]
$TimeoutMs
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ function Wait-AzDevOpsApiResource
$WaitIntervalMilliseconds = $(Get-AzDevOpsApiWaitIntervalMs),

[Parameter()]
[ValidateRange(250,10000)]
[ValidateRange(250,300000)]
[Alias('Timeout','TimeoutMilliseconds')]
[System.Int32]
$WaitTimeoutMilliseconds = $(Get-AzDevOpsApiWaitTimeoutMs),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ function Wait-AzDevOpsOperation
$WaitIntervalMilliseconds = $(Get-AzDevOpsApiWaitIntervalMs),

[Parameter()]
[ValidateRange(250,10000)]
[ValidateRange(250,300000)]
[Alias('Timeout','TimeoutMilliseconds')]
[System.Int32]
$WaitTimeoutMilliseconds = $(Get-AzDevOpsApiWaitTimeoutMs),
Expand Down
13 changes: 7 additions & 6 deletions source/en-US/about_AzureDevOpsDsc.help.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,24 @@ TOPIC
about_AzureDevOpsDsc

SHORT DESCRIPTION
DSC Resources for deployment and configuration of Azure DevOps and Azure DevOps Server.
DSC Resources for deployment and configuration of Azure DevOps Services and Azure DevOps Server.

LONG DESCRIPTION
This module contains DSC Resources for deployment and configuration of Azure DevOps and Azure DevOps Server.
This module contains DSC Resources for deployment and configuration of Azure DevOps Services and Azure DevOps Server.

EXAMPLES
PS C:\> {{ add examples here }}
PS C:\> Get-DscResource -Module AzureDevOpsDsc

NOTE:
Thank you to all those who contributed to this module, by writing code, sharing opinions, and provided feedback.

TROUBLESHOOTING NOTE:
Look out on the Github repository for issues and new releases.
Go to the Github repository for read about issues, submit a new issue, and read
about new releases. https://github.com/dsccommunity/AzureDevOpsDsc

SEE ALSO
- {{ Please add Project URI such as github }}}
- https://github.com/dsccommunity/AzureDevOpsDsc

KEYWORDS
{{ Add coma separated keywords here }}
DSC, DscResource, AzureDevOps, VSTS, TFS

20 changes: 0 additions & 20 deletions source/prefix.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,3 @@ Import-Module -Name $script:azureDevOpsDscCommonModulePath

# Define localization data
$script:localizedData = Get-LocalizedData -DefaultUICulture 'en-US'


# Define 'enums' for module
enum Ensure
{
Present
Absent
}

enum RequiredAction
{
None
Get
New
Set
Remove
Test
Error
}

Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ InModuleScope 'AzureDevOpsDsc.Common' {

Describe "$script:subModuleName\Api\Function\$script:commandName" -Tag $script:tag {

[Int32]$expectedWaitTimeoutMs = 10000
[Int32]$expectedWaitTimeoutMs = 300000


Context 'When input parameters are valid' {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ InModuleScope 'AzureDevOpsDsc.Common' {
@{
StartTime = [DateTime]::new(2020,11,12, 09,35,00, 0)
EndTime = [DateTime]::new(2021,11,12, 09,35,00, 0) # 1 year longer than timeout
TimeoutMs = 10000
TimeoutMs = 300000
}
)
$testCasesTimeoutNotExceeded = @(
Expand Down

0 comments on commit f1d8097

Please sign in to comment.