Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 39 additions & 0 deletions tools/releaseBuild/azureDevOps/releaseBuild.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: UnifiedPackageBuild-$(Build.BuildId)
trigger:
branches:
include:
- master
- release*
pr:
branches:
include:
- master
- release*

variables:
DOTNET_CLI_TELEMETRY_OPTOUT: 1
POWERSHELL_TELEMETRY_OPTOUT: 1

# Set AzDevOps Agent to clean the machine after the end of the build
resources:
- repo: self
clean: true

jobs:
- template: templates/linux.yml
parameters:
buildName: deb

- template: templates/linux.yml
parameters:
buildName: rpm

- template: templates/linux.yml
parameters:
buildName: fxdependent

- template: templates/linux.yml
parameters:
buildName: alpine

- template: templates/mac.yml
Original file line number Diff line number Diff line change
@@ -1,75 +1,69 @@
resources:
- repo: self
clean: true
jobs:
parameters:
buildName: ''

- job: BuildJob
displayName: Build
jobs:
- job: build_${{ parameters.buildName }}
displayName: Build ${{ parameters.buildName }}
condition: succeeded()
pool: Hosted Ubuntu 1604
strategy:
matrix:
deb packages:
build: ubuntu.14.04-no-appimage
rpm packages:
build: centos.7
fxdependent package:
build: fxdependent
variables:
build: ${{ parameters.buildName }}
steps:

- powershell: |
tools/releaseBuild/setReleaseTag.ps1 -ReleaseTag $(ReleaseTag)
tools/releaseBuild/setReleaseTag.ps1 -ReleaseTag $(ReleaseTagVar) -Variable "ReleaseTagVar"
displayName: 'Run setReleaseTag.ps1'

- powershell: |
Write-Verbose -Verbose "$(build)"

if ('$(build)' -eq 'fxdependent' -and '$(ReleaseTag)' -match '6.0.*')
if ('$(build)' -in 'alpine', 'fxdependent' -and '$(ReleaseTagVar)' -match '6.0.*')
{
$vstsCommandString = "vso[task.setvariable variable=SkipFxDependent]true"
$vstsCommandString = "vso[task.setvariable variable=SkipBuild]true"
}
else
{
$vstsCommandString = "vso[task.setvariable variable=SkipFxDependent]false"
$vstsCommandString = "vso[task.setvariable variable=SkipBuild]false"
}
displayName: 'Skip Alpine or fxdependent for PS v6.0.*'

- powershell: |
Import-Module $(Build.SourcesDirectory)/build.psm1 -Force
New-NugetConfigFile -NugetFeedUrl $(AzDevOpsFeed) -UserName $(AzDevOpsFeedUserName) -ClearTextPAT $(AzDevOpsFeedPAT) -FeedName AzDevOpsFeed -Destination $(Build.SourcesDirectory)/src/Modules

Write-Verbose -Message "$vstsCommandString " -Verbose
Write-Host -Object "##$vstsCommandString"
displayName: 'Skip FxDependent for PS v6.0.*'
if(-not (Test-Path "$(Build.SourcesDirectory)/src/Modules/nuget.config"))
{
throw "nuget.config is not created"
}
displayName: 'Add nuget.config for AzDevOps feed for PSGallery modules '
condition: ne(Variables['SkipBuild'],'true')

- powershell: |
import-module ./build.psm1
Sync-PSTags -AddRemoteIfMissing
displayName: SyncTags
condition: and(succeeded(), ne(variables['SkipFxDependent'], 'true'))
condition: and(succeeded(), ne(variables['SkipBuild'], 'true'))

- powershell: |
tools/releaseBuild/vstsbuild.ps1 -ReleaseTag $(ReleaseTag) -Name '$(build)'
tools/releaseBuild/vstsbuild.ps1 -ReleaseTag $(ReleaseTagVar) -Name '$(build)'
displayName: 'Build and package'
condition: and(succeeded(), ne(variables['SkipFxDependent'], 'true'))
condition: and(succeeded(), ne(variables['SkipBuild'], 'true'))


- job: UploadJob
displayName: Upload to Azure
dependsOn: BuildJob
- job: upload_${{ parameters.buildName }}
displayName: Upload ${{ parameters.buildName }}
dependsOn: build_${{ parameters.buildName }}
condition: succeeded()
pool: Package ES CodeHub Lab E
variables:
buildName: ${{ parameters.buildName }}
steps:

- powershell: |
./tools/releaseBuild/setReleaseTag.ps1 -ReleaseTag $(ReleaseTag)
tools/releaseBuild/setReleaseTag.ps1 -ReleaseTag $(ReleaseTagVar) -Variable "ReleaseTagVar"
displayName: 'Set ReleaseTag'

- powershell: |
if ($env:build -eq 'fxdependent' -and $env:ReleaseTag -match '6.0.*')
{
$vstsCommandString = "vso[task.setvariable variable=SkipFxDependent]true"
Write-Host -Object $vstsCommandString
}
displayName: 'Check if multiplier is applicable '

- powershell: |
$azureVersion = $env:ReleaseTag.ToLowerInvariant() -replace '\.', '-'
$azureVersion = $env:ReleaseTagVar.ToLowerInvariant() -replace '\.', '-'
$vstsCommandString = "vso[task.setvariable variable=AzureVersion]$azureVersion"
Write-Host "sending " + $vstsCommandString
Write-Host "##$vstsCommandString"
Expand All @@ -81,6 +75,7 @@ jobs:
downloadType: specific
itemPattern: '**/*.deb'
downloadPath: '$(System.ArtifactsDirectory)\finished'
condition: and(eq(variables['buildName'], 'DEB'),succeeded())

- task: DownloadBuildArtifacts@0
displayName: 'Download tar.gz Artifacts copy'
Expand All @@ -95,6 +90,7 @@ jobs:
downloadType: specific
itemPattern: '**/*.rpm'
downloadPath: '$(System.ArtifactsDirectory)\rpm'
condition: and(eq(variables['buildName'], 'RPM'),succeeded())

- task: AzureFileCopy@1
displayName: 'Upload to azure deb and tar.gz'
Expand All @@ -113,3 +109,4 @@ jobs:
Destination: AzureBlob
storage: '$(StorageAccount)'
ContainerName: '$(AzureVersion)-unsigned'
condition: and(eq(variables['buildName'], 'RPM'),succeeded())
44 changes: 44 additions & 0 deletions tools/releaseBuild/azureDevOps/templates/mac.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
parameters:
jobName: 'build_macOS'

jobs:
- job: ${{ parameters.jobName }}
displayName: Build macOS
condition: succeeded()
pool: Hosted macOS Preview
steps:
#- task: <task type name>@<version>
# inputs:
# <task specific inputs>
# displayName: '<display name of task>'
- powershell: |
tools/releaseBuild/setReleaseTag.ps1 -ReleaseTag $(ReleaseTagVar) -Variable "ReleaseTagVar"
displayName: 'Calculate Release Tag'
- powershell: |
# create folder
sudo mkdir /PowerShell

# make the current user the owner
sudo chown $env:USER /PowerShell
displayName: 'Create /PowerShell'
- powershell: |
Write-Host "##vso[task.setvariable variable=PowerShellRoot]/PowerShell"
git clone $env:BUILD_REPOSITORY_LOCALPATH /PowerShell
displayName: Clone PowerShell Repo to /PowerShell
- powershell: |
tools/releaseBuild/macOS/PowerShellPackageVsts.ps1 -location $(PowerShellRoot) -BootStrap
displayName: 'Bootstrap VM'
- powershell: |
Import-Module $(Build.SourcesDirectory)/build.psm1 -Force
New-NugetConfigFile -NugetFeedUrl $(AzDevOpsFeed) -UserName $(AzDevOpsFeedUserName) -ClearTextPAT $(AzDevOpsFeedPAT) -FeedName AzDevOpsFeed -Destination "$(PowerShellRoot)/src/Modules"

if(-not (Test-Path "$(PowerShellRoot)/src/Modules/nuget.config"))
{
throw "nuget.config is not created"
}
displayName: 'Add nuget.config for AzDevOps feed for PSGallery modules '
- powershell: |
$env:AZDEVOPSFEEDPAT = '$(AzDevOpsFeedPAT)'
$(Build.SourcesDirectory)/tools/releaseBuild/macOS/PowerShellPackageVsts.ps1 -ReleaseTag $(ReleaseTagVar) -Destination $(System.ArtifactsDirectory) -ExtraPackage "tar" -location $(PowerShellRoot) -Build
$env:AZDEVOPSFEEDPAT = $null
displayName: 'Build and Package'
17 changes: 4 additions & 13 deletions tools/releaseBuild/build.json
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@
],
"Linux": [
{
"Name": "ubuntu.14.04",
"Name": "ubuntu.14.04-unused",
"RepoDestinationPath": "/PowerShell",
"BuildCommand": "/PowerShellPackage.ps1 -location _RepoDestinationPath_ -destination _DockerVolume_ -ReleaseTag _ReleaseTag_ -AppImage -TarX64 -TarArm",
"BuildDockerOptions": [
Expand All @@ -259,7 +259,7 @@
"BinaryBucket": "release"
},
{
"Name": "ubuntu.14.04-no-appimage",
"Name": "deb",
"RepoDestinationPath": "/PowerShell",
"BuildCommand": "/PowerShellPackage.ps1 -location _RepoDestinationPath_ -destination _DockerVolume_ -ReleaseTag _ReleaseTag_ -TarX64 -TarArm -TarArm64",
"DockerFile": "./tools/releaseBuild/Images/microsoft_powershell_ubuntu14.04/Dockerfile",
Expand All @@ -268,16 +268,7 @@
"BinaryBucket": "release"
},
{
"Name": "ubuntu.16.04",
"RepoDestinationPath": "/PowerShell",
"BuildCommand": "/PowerShellPackage.ps1 -location _RepoDestinationPath_ -destination _DockerVolume_ -ReleaseTag _ReleaseTag_",
"AdditionalContextFiles" :[ "./tools/releaseBuild/Images/GenericLinuxFiles/PowerShellPackage.ps1"],
"DockerFile": "./tools/releaseBuild/Images/microsoft_powershell_ubuntu16.04/Dockerfile",
"DockerImageName": "ps-ubunutu-16-04",
"BinaryBucket": "release"
},
{
"Name": "centos.7",
"Name": "rpm",
"RepoDestinationPath": "/PowerShell",
"BuildCommand": "/PowerShellPackage.ps1 -location _RepoDestinationPath_ -destination _DockerVolume_ -ReleaseTag _ReleaseTag_",
"AdditionalContextFiles" :[ "./tools/releaseBuild/Images/GenericLinuxFiles/PowerShellPackage.ps1"],
Expand All @@ -286,7 +277,7 @@
"BinaryBucket": "release"
},
{
"Name": "alpine.3",
"Name": "alpine",
"RepoDestinationPath": "/PowerShell",
"BuildCommand": "/PowerShellPackage.ps1 -location _RepoDestinationPath_ -destination _DockerVolume_ -ReleaseTag _ReleaseTag_ -Alpine",
"AdditionalContextFiles" :[ "./tools/releaseBuild/Images/GenericLinuxFiles/PowerShellPackage.ps1"],
Expand Down