Skip to content

Commit 7d29fb8

Browse files
TylerLeonhardtRobert Holt
authored and
Robert Holt
committed
Add release build infrastructure
* Conditionally move PSES * Use correct signature type * Add build script
1 parent 9143a4a commit 7d29fb8

File tree

11 files changed

+247
-161
lines changed

11 files changed

+247
-161
lines changed

tools/releaseBuild/.gitignore

-1
This file was deleted.

tools/releaseBuild/Image/DockerFile

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# escape=`
2+
#0.3.6 (no powershell 6)
3+
FROM microsoft/dotnet-framework:4.7.1
4+
LABEL maintainer='PowerShell Team <[email protected]>'
5+
LABEL description="Build's PowerShell Editor Services"
6+
7+
SHELL ["C:\\windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe", "-command"]
8+
9+
COPY dockerInstall.psm1 containerFiles/dockerInstall.psm1
10+
11+
RUN Import-Module PackageManagement; `
12+
Install-PackageProvider -Name NuGet -MinimumVersion 2.8.5.201 -Force; `
13+
Set-PSRepository -Name PSGallery -InstallationPolicy Trusted | Out-Null; `
14+
Install-Module InvokeBuild -MaximumVersion 5.1.0 -Scope CurrentUser -Force; `
15+
Install-Module platyPS -RequiredVersion 0.9.0 -Scope CurrentUser -Force;
16+
17+
# Install Nodejs
18+
RUN Import-Module ./containerFiles/dockerInstall.psm1; `
19+
Install-ChocolateyPackage -PackageName nodejs-lts -Executable node.exe;
20+
21+
# Copy build script over
22+
COPY build.ps1 containerFiles/build.ps1
23+
24+
# Uncomment to debug locally
25+
# RUN Import-Module ./containerFiles/dockerInstall.psm1; `
26+
# Install-ChocolateyPackage -PackageName git -Executable git.exe; `
27+
# git clone https://github.com/PowerShell/PowerShellEditorServices;
28+
29+
ENTRYPOINT ["C:\\windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe", "-command"]
30+

tools/releaseBuild/Image/build.ps1

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
param ( [string]$target )
2+
if ( ! (test-path ${target} ) ) {
3+
new-item -type directory ${target}
4+
}
5+
else {
6+
if ( test-path -pathtype leaf ${target} ) {
7+
remove-item -force ${target}
8+
new-item -type directory ${target}
9+
}
10+
}
11+
push-location C:/vscode-powershell
12+
Invoke-Build GetExtensionVersion,Clean,Build,Test,Package
13+
Copy-Item -Verbose -Recurse "C:/vscode-powershell/PowerShell-insiders.vsix" "${target}/PowerShell-insiders.vsix"
+114
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
function Install-ChocolateyPackage
2+
{
3+
param(
4+
[Parameter(Mandatory=$true)]
5+
[string]
6+
$PackageName,
7+
8+
[Parameter(Mandatory=$false)]
9+
[string]
10+
$Executable,
11+
12+
[string[]]
13+
$ArgumentList,
14+
15+
[switch]
16+
$Cleanup,
17+
18+
[int]
19+
$ExecutionTimeout = 2700,
20+
21+
[string]
22+
$Version
23+
)
24+
25+
if(-not(Get-Command -name Choco -ErrorAction SilentlyContinue))
26+
{
27+
Write-Verbose "Installing Chocolatey provider..." -Verbose
28+
Invoke-WebRequest https://chocolatey.org/install.ps1 -UseBasicParsing | Invoke-Expression
29+
}
30+
31+
Write-Verbose "Installing $PackageName..." -Verbose
32+
$extraCommand = @()
33+
if($Version)
34+
{
35+
$extraCommand += '--version', $version
36+
}
37+
choco install -y $PackageName --no-progress --execution-timeout=$ExecutionTimeout $ArgumentList $extraCommands
38+
39+
if($executable)
40+
{
41+
Write-Verbose "Verifing $Executable is in path..." -Verbose
42+
$exeSource = $null
43+
$exeSource = Get-ChildItem -path "$env:ProgramFiles\$Executable" -Recurse -ErrorAction SilentlyContinue | Select-Object -First 1 -ExpandProperty FullName
44+
if(!$exeSource)
45+
{
46+
Write-Verbose "Falling back to x86 program files..." -Verbose
47+
$exeSource = Get-ChildItem -path "${env:ProgramFiles(x86)}\$Executable" -Recurse -ErrorAction SilentlyContinue | Select-Object -First 1 -ExpandProperty FullName
48+
}
49+
50+
# Don't search the chocolatey program data until more official locations have been searched
51+
if(!$exeSource)
52+
{
53+
Write-Verbose "Falling back to chocolatey..." -Verbose
54+
$exeSource = Get-ChildItem -path "$env:ProgramData\chocolatey\$Executable" -Recurse -ErrorAction SilentlyContinue | Select-Object -First 1 -ExpandProperty FullName
55+
}
56+
57+
# all obvious locations are exhausted, use brute force and search from the root of the filesystem
58+
if(!$exeSource)
59+
{
60+
Write-Verbose "Falling back to the root of the drive..." -Verbose
61+
$exeSource = Get-ChildItem -path "/$Executable" -Recurse -ErrorAction SilentlyContinue | Select-Object -First 1 -ExpandProperty FullName
62+
}
63+
64+
if(!$exeSource)
65+
{
66+
throw "$Executable not found"
67+
}
68+
69+
$exePath = Split-Path -Path $exeSource
70+
Add-Path -path $exePath
71+
}
72+
73+
if($Cleanup.IsPresent)
74+
{
75+
Remove-Folder -Folder "$env:temp\chocolatey"
76+
}
77+
}
78+
79+
function Add-Path
80+
{
81+
param
82+
(
83+
$path
84+
)
85+
$machinePathString = [System.Environment]::GetEnvironmentVariable('path',[System.EnvironmentVariableTarget]::Machine)
86+
$machinePath = $machinePathString -split ';'
87+
88+
if($machinePath -inotcontains $path)
89+
{
90+
$newPath = "$machinePathString;$path"
91+
Write-Verbose "Adding $path to path..." -Verbose
92+
[System.Environment]::SetEnvironmentVariable('path',$newPath,[System.EnvironmentVariableTarget]::Machine)
93+
Write-Verbose "Added $path to path." -Verbose
94+
$env:Path += ";$newPath"
95+
}
96+
else
97+
{
98+
Write-Verbose "$path already in path." -Verbose
99+
}
100+
}
101+
102+
function Remove-Folder
103+
{
104+
param(
105+
[string]
106+
$Folder
107+
)
108+
109+
Write-Verbose "Cleaning up $Folder..." -Verbose
110+
$filter = Join-Path -Path $Folder -ChildPath *
111+
[int]$measuredCleanupMB = (Get-ChildItem $filter -Recurse | Measure-Object -Property Length -Sum).Sum / 1MB
112+
Remove-Item -recurse -force $filter -ErrorAction SilentlyContinue
113+
Write-Verbose "Cleaned up $measuredCleanupMB MB from $Folder" -Verbose
114+
}

tools/releaseBuild/README.md

-14
This file was deleted.

tools/releaseBuild/build.json

+11-15
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,15 @@
11
{
2-
"Windows": [
3-
{
4-
"Name": "win",
2+
"Windows": {
3+
"Name": "win7-x64",
54
"RepoDestinationPath": "C:\\vscode-powershell",
6-
"BuildCommand": "C:\\build.ps1 -location _RepoDestinationPath_ -destination _DockerVolume_",
7-
"BuildDockerOptions": [
8-
"-m",
9-
"3968m"
10-
],
11-
"DockerFile": ".\\tools\\releaseBuild\\images\\microsoft_windowsservercore\\DockerFile",
12-
"AdditionalContextFiles" :[ ".\\tools\\releaseBuild\\images\\microsoft_windowsservercore\\build.ps1"],
13-
"DockerImageName": "psvsc-winsrvcore",
14-
"BinaryBucket": "release"
5+
"BuildCommand": "C:\\containerFiles\\build.ps1 -target _DockerVolume_",
6+
"DockerFile": ".\\tools\\releaseBuild\\Image\\DockerFile",
7+
"DockerImageName": "vscodepowershell",
8+
"BinaryBucket": "release",
9+
"PublishAsFolder": true,
10+
"AdditionalContextFiles" : [
11+
".\\tools\\releaseBuild\\Image\\build.ps1",
12+
".\\tools\\releaseBuild\\Image\\dockerInstall.psm1"
13+
]
1514
}
16-
],
17-
"Linux": [
18-
]
1915
}

tools/releaseBuild/images/microsoft_windowsservercore/Build.ps1

-66
This file was deleted.

tools/releaseBuild/images/microsoft_windowsservercore/DockerFile

-18
This file was deleted.

tools/releaseBuild/signing.xml

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<?xml version="1.0" encoding="utf-8" ?>
2+
<SignConfigXML>
3+
<job platform="" configuration="" dest="__OUTPATHROOT__\signed" jobname="vscode powershell" approvers="vigarg;gstolt">
4+
<file src="__INPATHROOT__\release\out\PowerShell-insiders.vsix" signType="100040160"
5+
dest="__OUTPATHROOT__\PowerShell-insiders.vsix" />
6+
</job>
7+
</SignConfigXML>

0 commit comments

Comments
 (0)