Skip to content

Commit

Permalink
Switch to installing GitVersion using dotnet tool install (#349)
Browse files Browse the repository at this point in the history
* using dotnet to install GitVersion

* Update templates

* Update pipeline to use windows-latest

* Update Sampler/Templates/Sampler/azure-pipelines.yml.template

Co-authored-by: Gael <[email protected]>
  • Loading branch information
johlju and gaelcolas authored Feb 16, 2022
1 parent 5f71c0f commit 8913d5d
Show file tree
Hide file tree
Showing 4 changed files with 62 additions and 41 deletions.
14 changes: 13 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,22 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### Fixed

- When running test using Pester 5, and the build configuration (`build.yaml`)
do not specify the location of tests in the key `Path`, the pipeline will
no longer run the tests twice. Fixes [#337](https://github.com/gaelcolas/Sampler/issues/337)

### Changed

- Switch to installing GitVersion using `dotnet tool install`. Fixes [#348](https://github.com/gaelcolas/Sampler/issues/348)
- Updated pipeline to use the build worker image 'ubuntu-latest'.
- Updated pipeline to use the build worker image 'windows-latest'.
- Updated the Plaster templates
- to use 'dotnet tool install' in the pipeline.
- to use build image 'ubuntu-latest' in the pipeline.
- to use build image 'windows-latest' in the pipeline.

## [0.112.1] - 2022-01-23

### Removed
Expand All @@ -24,7 +36,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Added New-SamplerPipeline to create build, Sampler Module or Chocolatey pipeline.
- Extra configuration files for passing to Azure Policy Guest Configuration Package on creation.

#### Fixed
### Fixed

- Fixed `Resolve-Dependency.ps1` to not fail when `PowerShell-yaml` module was specified but already loaded (handle on dll). Fixes [#335](https://github.com/gaelcolas/Sampler/issues/335)
- Fixed default source folder to source and not src.
Expand Down
29 changes: 16 additions & 13 deletions Sampler/Templates/Sampler/azure-pipelines.yml.template
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,17 @@ stages:
- job: Package_Module
displayName: 'Package Module'
pool:
vmImage: 'ubuntu 16.04'
vmImage: 'ubuntu-latest'
steps:
- task: GitVersion@5
name: gitVersion
displayName: 'Evaluate Next Version'
inputs:
runtime: 'core'
configFilePath: 'GitVersion.yml'
- pwsh: |
dotnet tool install --global GitVersion.Tool
$gitVersionObject = dotnet-gitversion | ConvertFrom-Json
$gitVersionObject.PSObject.Properties.ForEach{
Write-Host -Object "Setting Task Variable '$($_.Name)' with value '$($_.Value)'."
Write-Host -Object "##vso[task.setvariable variable=$($_.Name);]$($_.Value)"
}
Write-Host -Object "##vso[build.updatebuildnumber]$($gitVersionObject.FullSemVer)"
displayName: Calculate ModuleVersion (GitVersion)

- task: PowerShell@2
name: package
Expand All @@ -40,7 +43,7 @@ stages:
arguments: '-ResolveDependency -tasks pack'
pwsh: true
env:
ModuleVersion: $(gitVersion.NuGetVersionV2)
ModuleVersion: $(NuGetVersionV2)

- task: PublishPipelineArtifact@1
displayName: 'Publish Build Artifact'
Expand All @@ -57,7 +60,7 @@ stages:
displayName: 'Linux'
timeoutInMinutes: 0
pool:
vmImage: 'ubuntu 16.04'
vmImage: 'ubuntu-latest'
steps:
- task: DownloadPipelineArtifact@2
displayName: 'Download Build Artifact'
Expand Down Expand Up @@ -92,7 +95,7 @@ stages:
displayName: 'Windows (PowerShell)'
timeoutInMinutes: 0
pool:
vmImage: 'windows-2019'
vmImage: 'windows-latest'
steps:
- task: DownloadPipelineArtifact@2
displayName: 'Download Build Artifact'
Expand Down Expand Up @@ -128,7 +131,7 @@ stages:
displayName: 'Windows (Windows PowerShell)'
timeoutInMinutes: 0
pool:
vmImage: 'windows-2019'
vmImage: 'windows-latest'
steps:
- task: DownloadPipelineArtifact@2
displayName: 'Download Build Artifact'
Expand Down Expand Up @@ -205,7 +208,7 @@ stages:
- test_windows_core
- test_windows_ps
pool:
vmImage: 'ubuntu 16.04'
vmImage: 'ubuntu-latest'
timeoutInMinutes: 0
steps:
- pwsh: |
Expand Down Expand Up @@ -286,7 +289,7 @@ stages:
- job: Deploy_Module
displayName: 'Deploy Module'
pool:
vmImage: 'ubuntu 16.04'
vmImage: 'ubuntu-latest'
steps:
- task: DownloadPipelineArtifact@2
displayName: 'Download Build Artifact'
Expand Down
31 changes: 17 additions & 14 deletions Sampler/Templates/Sampler/azure-pipelines_dsccommunity.yml.template
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,17 @@ stages:
- job: Package_Module
displayName: 'Package Module'
pool:
vmImage: 'ubuntu 16.04'
vmImage: 'ubuntu-latest'
steps:
- task: GitVersion@5
name: gitVersion
displayName: 'Evaluate Next Version'
inputs:
runtime: 'core'
configFilePath: 'GitVersion.yml'
- pwsh: |
dotnet tool install --global GitVersion.Tool
$gitVersionObject = dotnet-gitversion | ConvertFrom-Json
$gitVersionObject.PSObject.Properties.ForEach{
Write-Host -Object "Setting Task Variable '$($_.Name)' with value '$($_.Value)'."
Write-Host -Object "##vso[task.setvariable variable=$($_.Name);]$($_.Value)"
}
Write-Host -Object "##vso[build.updatebuildnumber]$($gitVersionObject.FullSemVer)"
displayName: Calculate ModuleVersion (GitVersion)
- task: PowerShell@2
name: package
displayName: 'Build & Package Module'
Expand All @@ -41,7 +44,7 @@ stages:
arguments: '-ResolveDependency -tasks pack'
pwsh: true
env:
ModuleVersion: $(gitVersion.NuGetVersionV2)
ModuleVersion: $(NuGetVersionV2)
- task: PublishPipelineArtifact@1
displayName: 'Publish Build Artifact'
inputs:
Expand All @@ -56,7 +59,7 @@ stages:
- job: Test_HQRM
displayName: 'HQRM'
pool:
vmImage: 'windows-2019'
vmImage: 'windows-latest'
timeoutInMinutes: 0
steps:
- task: DownloadPipelineArtifact@2
Expand Down Expand Up @@ -84,7 +87,7 @@ stages:
- job: Test_Unit
displayName: 'Unit'
pool:
vmImage: 'windows-2019'
vmImage: 'windows-latest'
timeoutInMinutes: 0
steps:
- task: DownloadPipelineArtifact@2
Expand Down Expand Up @@ -122,7 +125,7 @@ stages:
#- job: Test_Unit_Linux
# displayName: 'Unit Linux'
# pool:
# vmImage: 'ubuntu 16.04'
# vmImage: 'ubuntu-latest'
# timeoutInMinutes: 0
# steps:
# - task: DownloadPipelineArtifact@2
Expand Down Expand Up @@ -157,7 +160,7 @@ stages:
- job: Test_Integration
displayName: 'Integration'
pool:
vmImage: 'windows-2019'
vmImage: 'windows-latest'
timeoutInMinutes: 0
steps:
- task: DownloadPipelineArtifact@2
Expand Down Expand Up @@ -192,7 +195,7 @@ stages:
displayName: 'Publish Code Coverage'
dependsOn: Test_Unit
pool:
vmImage: 'ubuntu 16.04'
vmImage: 'ubuntu-latest'
timeoutInMinutes: 0
steps:
- pwsh: |
Expand Down Expand Up @@ -254,7 +257,7 @@ stages:
- job: Deploy_Module
displayName: 'Deploy Module'
pool:
vmImage: 'ubuntu 16.04'
vmImage: 'ubuntu-latest'
steps:
- task: DownloadPipelineArtifact@2
displayName: 'Download Pipeline Artifact'
Expand Down
29 changes: 16 additions & 13 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,17 @@ stages:
- job: Package_Module
displayName: 'Package Module'
pool:
vmImage: 'ubuntu 18.04'
vmImage: 'ubuntu-latest'
steps:
- task: GitVersion@5
name: gitVersion
displayName: 'Evaluate Next Version'
inputs:
runtime: 'core'
configFilePath: 'GitVersion.yml'
- pwsh: |
dotnet tool install --global GitVersion.Tool
$gitVersionObject = dotnet-gitversion | ConvertFrom-Json
$gitVersionObject.PSObject.Properties.ForEach{
Write-Host -Object "Setting Task Variable '$($_.Name)' with value '$($_.Value)'."
Write-Host -Object "##vso[task.setvariable variable=$($_.Name);]$($_.Value)"
}
Write-Host -Object "##vso[build.updatebuildnumber]$($gitVersionObject.FullSemVer)"
displayName: Calculate ModuleVersion (GitVersion)
- task: PowerShell@2
name: package
Expand All @@ -40,7 +43,7 @@ stages:
arguments: '-ResolveDependency -tasks pack'
pwsh: true
env:
ModuleVersion: $(gitVersion.NuGetVersionV2)
ModuleVersion: $(NuGetVersionV2)

- task: PublishPipelineArtifact@1
displayName: 'Publish Pipeline Artifact'
Expand All @@ -57,7 +60,7 @@ stages:
displayName: 'Linux'
timeoutInMinutes: 0
pool:
vmImage: 'ubuntu 18.04'
vmImage: 'ubuntu-latest'
steps:
- task: DownloadPipelineArtifact@2
displayName: 'Download Pipeline Artifact'
Expand Down Expand Up @@ -92,7 +95,7 @@ stages:
displayName: 'Windows (PowerShell Core)'
timeoutInMinutes: 0
pool:
vmImage: 'windows-2019'
vmImage: 'windows-latest'
steps:
- task: DownloadPipelineArtifact@2
displayName: 'Download Pipeline Artifact'
Expand Down Expand Up @@ -128,7 +131,7 @@ stages:
displayName: 'Windows (Windows PowerShell)'
timeoutInMinutes: 0
pool:
vmImage: 'windows-2019'
vmImage: 'windows-latest'
steps:
- task: DownloadPipelineArtifact@2
displayName: 'Download Pipeline Artifact'
Expand Down Expand Up @@ -204,7 +207,7 @@ stages:
- test_windows_core
- test_windows_ps
pool:
vmImage: 'ubuntu 18.04'
vmImage: 'ubuntu-latest'
timeoutInMinutes: 0
steps:
- pwsh: |
Expand Down Expand Up @@ -276,7 +279,7 @@ stages:
- job: Deploy_Module
displayName: 'Deploy Module'
pool:
vmImage: 'ubuntu 18.04'
vmImage: 'ubuntu-latest'
steps:
- task: DownloadPipelineArtifact@2
displayName: 'Download Pipeline Artifact'
Expand Down

0 comments on commit 8913d5d

Please sign in to comment.