Skip to content

Commit

Permalink
Set version artificially for the test template runs (#15849)
Browse files Browse the repository at this point in the history
  • Loading branch information
chidozieononiwu authored Oct 1, 2020
1 parent a8e4a8f commit b7c32bf
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 0 deletions.
8 changes: 8 additions & 0 deletions eng/pipelines/templates/jobs/archetype-sdk-client.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,14 @@ jobs:
ArtifactName: 'packages'

steps:
- task: PowerShell@2
displayName: Prep template pipeline for release
condition: and(succeeded(),eq(variables['TestPipeline'],'true'))
inputs:
pwsh: true
workingDirectory: $(Build.SourcesDirectory)
filePath: eng/scripts/SetTestPipelineVersion.ps1

- script: |
echo "##vso[build.addbuildtag]Scheduled"
displayName: 'Tag scheduled builds'
Expand Down
8 changes: 8 additions & 0 deletions eng/pipelines/templates/stages/archetype-java-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,14 @@ stages:
vmImage: ubuntu-18.04

steps:
- task: PowerShell@2
displayName: Prep template pipeline for release
condition: and(succeeded(),eq(variables['TestPipeline'],'true'))
inputs:
pwsh: true
workingDirectory: $(Build.SourcesDirectory)
filePath: eng/scripts/SetTestPipelineVersion.ps1

- task: UsePythonVersion@0
displayName: 'Use Python 3.6'
inputs:
Expand Down
31 changes: 31 additions & 0 deletions eng/scripts/SetTestPipelineVersion.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Overides the project file and CHANGELOG.md for the template project using the next publishable version
# This is to help with testing the release pipeline.
. "${PSScriptRoot}\..\common\scripts\common.ps1"
$latestTags = git tag -l "azure-sdk-template_*"
$semVars = @()

$changeLogFile = "${PSScriptRoot}\..\..\sdk\template\azure-sdk-template\CHANGELOG.md"
$pomFile = "${PSScriptRoot}\..\..\sdk\template\azure-sdk-template\pom.xml"

Foreach ($tags in $latestTags)
{
$semVars += $tags.Replace("azure-sdk-template_", "")
}

$semVarsSorted = [AzureEngSemanticVersion]::SortVersionStrings($semVars)
LogDebug "Last Published Version $($semVarsSorted[0])"

$newVersion = [AzureEngSemanticVersion]::ParseVersionString($semVarsSorted[0])
$newVersion.IncrementAndSetToPrerelease()
LogDebug "Version to publish [ $($newVersion.ToString()) ]"

$pomFileContent = New-Object -TypeName XML
$pomFileContent.PreserveWhitespace = $true
$pomFileContent.load((Resolve-Path $pomFile))
$pomFileContent.project.version = $newVersion.ToString()
Set-Content -Path $pomFile -Value $pomFileContent.OuterXml
Set-Content -Path $changeLogFile -Value @"
# Release History
## $($newVersion.ToString()) ($(Get-Date -f "yyyy-MM-dd"))
- Test Release Pipeline
"@

0 comments on commit b7c32bf

Please sign in to comment.