Skip to content

Commit aee740f

Browse files
authored
Add community stable back (PowerShell#363)
1 parent 60fe30c commit aee740f

10 files changed

Lines changed: 152 additions & 61 deletions

File tree

.vsts-ci/communityReleaseBuild.yml

Lines changed: 5 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -5,27 +5,8 @@ resources:
55
variables:
66
POWERSHELL_TELEMETRY_OPTOUT: 1
77

8-
jobs:
9-
- job: communityRelease
10-
pool:
11-
name: Hosted Ubuntu 1604
12-
#Your build pipeline references an undefined variable named ‘dockerHost’. Create or edit the build pipeline for this YAML file, define the variable on the Variables tab. See https://go.microsoft.com/fwlink/?linkid=865972
13-
#Your build pipeline references an undefined variable named ‘dockerImage’. Create or edit the build pipeline for this YAML file, define the variable on the Variables tab. See https://go.microsoft.com/fwlink/?linkid=865972
14-
#Your build pipeline references an undefined variable named ‘dockerKey’. Create or edit the build pipeline for this YAML file, define the variable on the Variables tab. See https://go.microsoft.com/fwlink/?linkid=865972
15-
#Your build pipeline references an undefined variable named ‘dockerNamespace’. Create or edit the build pipeline for this YAML file, define the variable on the Variables tab. See https://go.microsoft.com/fwlink/?linkid=865972
16-
#Your build pipeline references an undefined variable named ‘dockerUserName’. Create or edit the build pipeline for this YAML file, define the variable on the Variables tab. See https://go.microsoft.com/fwlink/?linkid=865972
17-
18-
steps:
19-
- powershell: 'docker login $(dockerHost) -u $(dockerUserName) -p "$(dockerKey)"'
20-
displayName: 'docker login'
21-
22-
- powershell: 'Install-module pester -Scope CurrentUser -Force -SkipPublisherCheck'
23-
displayName: 'Install Pester'
24-
25-
- powershell: |
26-
./build.ps1 -Build -ImageName $(dockerHost) -All -Channel community-stable -push -Repository $(dockerNamespace)/$(dockerImage)
27-
displayName: Build
28-
29-
- powershell: 'docker logout $(dockerHost)'
30-
displayName: 'docker logout'
31-
condition: always()
8+
stages:
9+
- template: communityReleaseStage.yml
10+
parameters:
11+
channel: community-stable
12+
jobName: community_stable

.vsts-ci/communityReleasePhase.yml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
parameters:
2+
vmImage: 'ubuntu-16.04'
3+
jobName: 'none'
4+
releaseTag: ''
5+
matrix: ''
6+
maxParallel: 5
7+
dependsOn: []
8+
9+
jobs:
10+
- job: ${{ parameters.jobName }}
11+
dependsOn: ${{ parameters.dependsOn }}
12+
strategy:
13+
matrix: $[ ${{ parameters.matrix }} ]
14+
maxParallel: ${{ parameters.maxParallel }}
15+
variables:
16+
dockerImage: 'powershell'
17+
Channel: ${{ parameters.channel }}
18+
ACR: ${{ parameters.ACR }}
19+
releaseTag: ${{ parameters.releaseTag }}
20+
21+
pool:
22+
vmImage: ${{ parameters.vmImage }}
23+
timeoutInMinutes: 135
24+
25+
26+
steps:
27+
- pwsh: |
28+
Get-ChildItem env: | Out-String -Width 1000
29+
displayName: 'Capture Environment'
30+
condition: and( succeededOrFailed(), ne(variables['Channel'],''))
31+
32+
- pwsh: 'docker login $(dockerHost) -u $(dockerUserName) -p $(dockerKey)'
33+
displayName: 'docker login'
34+
condition: and( succeededOrFailed(), ne(variables['Channel'],''))
35+
36+
- pwsh: 'Install-module pester -Scope CurrentUser -Force -SkipPublisherCheck'
37+
displayName: 'Install Pester'
38+
condition: and( succeededOrFailed(), ne(variables['Channel'],''))
39+
40+
- pwsh: |
41+
$extraParams = @{}
42+
Write-Host 'Not in ACR, will push...'
43+
$extraParams.Add('Push',$true)
44+
45+
./build.ps1 -Build -ImageName $(dockerHost) -name '$(ImageName)' -Channel $(channel) -TestLogPostfix '$(ImageName)-$(Channel)' @extraParams -Repository $(dockerNamespace)/$(dockerImage)
46+
displayName: 'Build'
47+
condition: and( succeededOrFailed(), ne(variables['Channel'],''))
48+
49+
- pwsh: 'docker logout $(dockerHost)'
50+
displayName: 'docker logout'
51+
condition: and( always(), ne(variables['Channel'],''))

.vsts-ci/communityReleaseStage.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
parameters:
2+
channel: 'preview'
3+
jobName: ''
4+
vmImage: 'ubuntu-16.04'
5+
acr: 'All'
6+
useacr: 'false'
7+
osFilter: 'All'
8+
9+
stages:
10+
- stage: GenerateYaml_${{ coalesce(parameters.jobName, parameters.channel) }}
11+
variables:
12+
jobName: ${{ coalesce(parameters.jobName, parameters.channel) }}
13+
dependsOn: []
14+
displayName: Build ${{ parameters.channel }}
15+
jobs:
16+
- job: GenerateYaml_${{ variables.jobName }}
17+
pool:
18+
vmImage: ubuntu-16.04
19+
displayName: Generate Matrix YAML ${{ parameters.channel }}
20+
steps:
21+
- pwsh: |
22+
./build.ps1 -GenerateMatrixJson -Channel ${{ parameters.channel }} -Verbose -Acr ${{ parameters.acr }} -OsFilter ${{ parameters.osFilter }}
23+
displayName: Generate Matrix YAML
24+
condition: succeededOrFailed()
25+
name: matrix
26+
- pwsh: |
27+
dir env:matrix_* | out-string -Width 1000
28+
displayName: Capture Matrix YAML
29+
condition: succeededOrFailed()
30+
- template: communityReleasePhase.yml
31+
parameters:
32+
matrix: dependencies.GenerateYaml_${{ variables.jobName }}.outputs['matrix.matrix_${{ parameters.channel }}_linux']
33+
dependsOn: GenerateYaml_${{ variables.jobName }}
34+
jobName: Build_Linux
35+
maxParallel: 2

.vsts-ci/phase.yml

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,9 @@ jobs:
2727
displayName: 'Enable ACR'
2828
condition: ne(variables['ACR'], 'no')
2929
30-
- ${{ if eq(parameters.useacr, 'true') }}:
31-
- pwsh: 'Get-ChildItem env:'
32-
displayName: 'Capture Environment'
33-
condition: and( succeededOrFailed(), ne(variables['Channel'],''))
30+
- pwsh: 'Get-ChildItem env:'
31+
displayName: 'Capture Environment'
32+
condition: and( succeededOrFailed(), ne(variables['Channel'],''))
3433

3534
- ${{ if eq(parameters.useacr, 'true') }}:
3635
- pwsh: 'az login --service-principal -u $(az_url) -p $(az_key) --tenant $(az_name)'
@@ -48,7 +47,7 @@ jobs:
4847
./build.ps1 -build -name '$(ImageName)' -IncludeKnownIssues -Channel '$(Channel)' -TestLogPostfix '$(ImageName)-$(Channel)' ${{ parameters.ciParameter }} -Repository $(Channel)/powershell
4948
displayName: $(ImageName) $(Channel)
5049
condition: and( succeededOrFailed(), ne(variables['Channel'],''))
51-
continueOnError: ${{ parameters.continueonerror }}
50+
continueOnError: ${{ variables.continueonerror }}
5251
5352
5453
- pwsh: |
@@ -59,12 +58,14 @@ jobs:
5958
}
6059
displayName: Make sure we got test results
6160
condition: and( succeededOrFailed(), ne(variables['Channel'],''))
62-
continueOnError: ${{ parameters.continueonerror }}
61+
continueOnError: ${{ variables.continueonerror }}
62+
6363
6464
- task: PublishTestResults@2
6565
condition: and( succeededOrFailed(), ne(variables['Channel'],''))
6666
displayName: Publish $(ImageName) Test Results **\test*.xml
67-
continueOnError: ${{ parameters.continueonerror }}
67+
continueOnError: ${{ variables.continueonerror }}
68+
6869
inputs:
6970
testRunner: NUnit
7071
testResultsFiles: '**\test*.xml'

.vsts-ci/stage.yml

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,20 @@
11
parameters:
22
channel: 'preview'
3+
jobName: ''
34
vmImage: 'ubuntu-16.04'
45
winCiParameter: '-CI -TagFilter 1809'
56
acr: 'NoAcr'
67
useacr: 'false'
78
osFilter: 'All'
89

910
stages:
10-
- stage: GenerateYaml_${{ parameters.channel }}
11+
- stage: GenerateYaml_${{ coalesce(parameters.jobName, parameters.channel) }}
12+
variables:
13+
jobName: ${{ coalesce(parameters.jobName, parameters.channel) }}
1114
dependsOn: []
1215
displayName: Build ${{ parameters.channel }}
1316
jobs:
14-
- job: GenerateYaml_${{ parameters.channel }}
17+
- job: GenerateYaml_${{ variables.jobName }}
1518
pool:
1619
vmImage: ubuntu-16.04
1720
displayName: Generate Matrix YAML ${{ parameters.channel }}
@@ -27,14 +30,14 @@ stages:
2730
condition: succeededOrFailed()
2831
- template: phase.yml
2932
parameters:
30-
matrix: dependencies.GenerateYaml_${{ parameters.channel }}.outputs['matrix.matrix_${{ parameters.channel }}_linux']
31-
dependsOn: GenerateYaml_${{ parameters.channel }}
33+
matrix: dependencies.GenerateYaml_${{ variables.jobName }}.outputs['matrix.matrix_${{ parameters.channel }}_linux']
34+
dependsOn: GenerateYaml_${{ variables.jobName }}
3235
jobName: Build_Linux
3336
useacr: ${{ parameters.useacr }}
3437
- template: phase.yml
3538
parameters:
36-
matrix: dependencies.GenerateYaml_${{ parameters.channel }}.outputs['matrix.matrix_${{ parameters.channel }}_windows']
37-
dependsOn: GenerateYaml_${{ parameters.channel }}
39+
matrix: dependencies.GenerateYaml_${{ variables.jobName }}.outputs['matrix.matrix_${{ parameters.channel }}_windows']
40+
dependsOn: GenerateYaml_${{ variables.jobName }}
3841
jobName: Build_Win
3942
vmImage: windows-2019
4043
ciParameter: ${{ parameters.winCiParameter }}

build.ps1

Lines changed: 33 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -313,18 +313,19 @@ End {
313313
$actualTagData = $allMeta.ActualTagDataByGroup.$tagGroup
314314
$actualChannel = $allMeta.Channel
315315
$useAcr = $allMeta.meta.UseAcr
316+
$continueOnError = $allMeta.meta.ContinueOnError
316317

317318
if ($Build.IsPresent -or $Test.IsPresent)
318319
{
319320
$params = @{
320-
Dockerfile=$dockerFileName
321-
psversion=$allMeta.psversion
322-
SasData= $sasData
323-
actualChannel= $actualChannel
324-
actualTagData= $actualTagData
325-
actualVersion= $windowsVersion
326-
AllMeta= $allMeta
327-
CI=$CI.IsPresent
321+
Dockerfile = $dockerFileName
322+
psversion = $allMeta.psversion
323+
SasData = $sasData
324+
actualChannel = $actualChannel
325+
actualTagData = $actualTagData
326+
actualVersion = $windowsVersion
327+
AllMeta = $allMeta
328+
CI = $CI.IsPresent
328329
}
329330

330331
if($allMeta.BaseImage)
@@ -386,9 +387,14 @@ End {
386387
$dockerfile = "https://github.com/PowerShell/PowerShell-Docker/blob/master$relativeImagePath/docker/Dockerfile"
387388

388389
$osVersion = $allMeta.meta.osVersion
389-
if($osVersion)
390+
if($osVersion -or $GenerateMatrixJson.IsPresent)
390391
{
391-
$osVersion = $osVersion.replace('${fromTag}',$actualTagData.fromTag)
392+
if ($osVersion) {
393+
$osVersion = $osVersion.replace('${fromTag}', $actualTagData.fromTag)
394+
}
395+
else {
396+
$osVersion = ''
397+
}
392398

393399
if(!$tagGroups.ContainsKey($tagGroup))
394400
{
@@ -397,14 +403,15 @@ End {
397403
}
398404

399405
$tag = [PSCustomObject]@{
400-
Architecture = $architecture
401-
OsVersion = $osVersion
402-
Os = $os
403-
Tags = $actualTagData.TagList
404-
Dockerfile = $dockerfile
405-
Channel = $actualChannel
406-
Name = $dockerFileName
407-
UseAcr = $UseAcr
406+
Architecture = $architecture
407+
OsVersion = $osVersion
408+
Os = $os
409+
Tags = $actualTagData.TagList
410+
Dockerfile = $dockerfile
411+
Channel = $actualChannel
412+
Name = $dockerFileName
413+
UseAcr = $UseAcr
414+
ContinueOnError = $continueOnError
408415
}
409416

410417
$tagGroups[$tagGroup] += $tag
@@ -460,6 +467,7 @@ End {
460467
{
461468
Install-Module -Name pester -Scope CurrentUser -Force
462469
}
470+
463471
Write-Verbose -Message "logging to $logPath" -Verbose
464472
$results = Invoke-Pester -Script $testsPath -OutputFile $logPath -PassThru -OutputFormat NUnitXml @extraParams
465473
if(!$results -or $results.FailedCount -gt 0 -or !$results.PassedCount)
@@ -515,10 +523,13 @@ End {
515523
$matrix.$channelName.Add($osName, @{ })
516524
}
517525

518-
if (-not $matrix.$channelName[$osName].ContainsKey($tag.Name)) {
519-
$matrix.$channelName[$osName].Add($tag.Name, @{
520-
Channel = $tag.Channel
521-
ImageName = $tag.Name
526+
$jobName = $tag.Name -replace '-', '_'
527+
if (-not $matrix.$channelName[$osName].ContainsKey($jobName) -and -not $tag.ContinueOnError) {
528+
$matrix.$channelName[$osName].Add($jobName, @{
529+
Channel = $tag.Channel
530+
ImageName = $tag.Name
531+
JobName = $jobName
532+
ContinueOnError = $tag.ContinueOnError
522533
})
523534
}
524535
}

release/community-stable/clearlinux/meta.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,6 @@
66
"tagTemplates": [
77
"#psversion#-clearlinux-#tag#",
88
"clearlinux-#shorttag#"
9-
]
9+
],
10+
"continueOnError": true
1011
}

release/community-stable/parrot/meta.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,6 @@
66
"tagTemplates": [
77
"#psversion#-parrot-#tag#",
88
"parrot-#shorttag#"
9-
]
9+
],
10+
"continueOnError": true
1011
}

tools/buildHelper/buildHelper.psm1

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,9 @@ class DockerImageMetaData {
159159

160160
[bool]
161161
$IsBroken = $false
162+
163+
[bool]
164+
$ContinueOnError = $false
162165
}
163166

164167
class ShortTagMetaData {

vsts-ci.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@ stages:
1414
- template: .vsts-ci/stage.yml
1515
parameters:
1616
channel: preview
17+
- template: .vsts-ci/stage.yml
18+
parameters:
19+
channel: community-stable
20+
jobName: community_stable
1721

1822
- stage: CheckForDuplicateTags
1923
displayName: Check for duplicate tags

0 commit comments

Comments
 (0)