Skip to content

Commit fdaef2d

Browse files
authored
Merge RC3 Version of LTS work (PowerShell#377)
1 parent 549c3ab commit fdaef2d

88 files changed

Lines changed: 2314 additions & 156 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.vscode/launch.json

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
{
2+
// Use IntelliSense to learn about possible attributes.
3+
// Hover to view descriptions of existing attributes.
4+
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
5+
"version": "0.2.0",
6+
"configurations": [
7+
{
8+
"name": "PowerShell: Build LTS Ubuntu 16.04",
9+
"type": "PowerShell",
10+
"request": "launch",
11+
"script": "${workspaceFolder}/build.ps1",
12+
"cwd": "${workspaceFolder}",
13+
"args": [
14+
"-build",
15+
"-Channel",
16+
"lts",
17+
"-name",
18+
"ubuntu16.04"
19+
]
20+
}
21+
]
22+
}

.vsts-ci/phase.yml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,14 @@ jobs:
4444
condition: and( succeededOrFailed(), ne(variables['Channel'],''))
4545
4646
- pwsh: |
47-
./build.ps1 -build -name '$(ImageName)' -IncludeKnownIssues -Channel '$(Channel)' -TestLogPostfix '$(ImageName)-$(Channel)' ${{ parameters.ciParameter }} -Repository $(Channel)/powershell
47+
$extraParams = @{}
48+
if($env:ACR_NAME)
49+
{
50+
Write-Host 'Using ACR, will NOT test behavior...'
51+
$extraParams.Add('SkipTest',$true)
52+
}
53+
54+
./build.ps1 -build -name '$(ImageName)' -IncludeKnownIssues -Channel '$(Channel)' -TestLogPostfix '$(ImageName)-$(Channel)' @extraParams ${{ parameters.ciParameter }} -Repository $(Channel)/powershell
4855
displayName: $(ImageName) $(Channel)
4956
condition: and( succeededOrFailed(), ne(variables['Channel'],''))
5057
continueOnError: ${{ variables.continueonerror }}

.vsts-ci/releasePhase.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,10 @@ jobs:
4141
$releaseTag = '$(previewReleaseTag)'
4242
$version = '$(previewReleaseTag)' -replace '^v', ''
4343
}
44+
'lts' {
45+
$releaseTag = '$(ltsReleaseTag)'
46+
$version = '$(ltsReleaseTag)' -replace '^v', ''
47+
}
4448
default {
4549
throw "Unknown channel '$(Channel)'"
4650
}

.vsts-ci/releasebuild.yml

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: s_$(stableReleaseTag)_p_$(previewReleaseTag)$(Rev:_rr)
1+
name: s_$(stableReleaseTag)_p_$(previewReleaseTag)_l_$(ltsReleaseTag)$(Rev:_rr)
22

33
resources:
44
- repo: self
@@ -14,11 +14,15 @@ stages:
1414
- template: releaseStage.yml
1515
parameters:
1616
channel: preview
17+
- template: releaseStage.yml
18+
parameters:
19+
channel: lts
1720

1821
- stage: GenerateManifests
1922
dependsOn:
2023
- GenerateYaml_stable
2124
- GenerateYaml_preview
25+
- GenerateYaml_lts
2226
jobs:
2327
- job: PreviewManifestPhase
2428
variables:
@@ -65,6 +69,8 @@ stages:
6569
Write-Host "##vso[task.setvariable variable=StableVersion;]$stableVersion"
6670
$previewVersion = '$(previewReleaseTag)' -replace '^v', ''
6771
Write-Host "##vso[task.setvariable variable=PreviewVersion;]$previewVersion"
72+
$ltsVersion = '$(ltsReleaseTag)' -replace '^v', ''
73+
Write-Host "##vso[task.setvariable variable=LtsVersion;]$ltsVersion"
6874
displayName: 'Set Versions'
6975
7076
- powershell: 'Get-ChildItem env:'
@@ -74,7 +80,7 @@ stages:
7480
displayName: 'Install Pester'
7581

7682
- powershell: |
77-
$yaml = ./build.ps1 -GenerateTagsYaml -Channel stable, preview -StableVersion $(StableVersion) -PreviewVersion $(PreviewVersion)
83+
$yaml = ./build.ps1 -GenerateTagsYaml -Channel stable, preview -StableVersion $(StableVersion) -PreviewVersion $(PreviewVersion) -LtsVersion $(LtsVersion)
7884
$yaml | Out-File -Encoding ascii -Path ./tagsmetadata.yaml
7985
Get-ChildItem -Path ./tagsmetadata.yaml | Select-Object -ExpandProperty FullName | ForEach-Object {
8086
Write-Host "##vso[artifact.upload containerfolder=artifacts;artifactname=artifacts]$_"
@@ -86,6 +92,7 @@ stages:
8692
@{
8793
'previewReleaseTag' = '$(previewReleaseTag)'
8894
'stableReleaseTag' = '$(stableReleaseTag)'
95+
'ltsReleaseTag' = '$(ltsReleaseTag)'
8996
}|convertto-json | out-file -FilePath $path -Encoding ascii
9097
Write-Host "##vso[artifact.upload containerfolder=releaseTags;artifactname=releaseTags]$path"
9198
displayName: Save release Tags

.vsts-ci/vsts-arm-ci.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,3 @@ stages:
2020
acr: OnlyAcr
2121
useacr: true
2222
winCiParameter: ''
23-
osFilter: Linux

build.ps1

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ param(
8383
[string]
8484
$TagFilter,
8585

86-
[ValidateSet('stable','preview','servicing','community-stable','community-preview','community-servicing')]
86+
[ValidateSet('stable','preview','servicing','community-stable','community-preview','community-servicing','lts')]
8787
[Parameter(Mandatory, ParameterSetName="TestByName")]
8888
[Parameter(Mandatory, ParameterSetName="TestAll")]
8989
[Parameter(ParameterSetName="localBuildByName")]
@@ -118,6 +118,12 @@ param(
118118
[string]
119119
$StableVersion,
120120

121+
[Parameter(ParameterSetName="GenerateMatrixJson")]
122+
[Parameter(ParameterSetName="GenerateTagsYaml")]
123+
[ValidatePattern('(\d+\.){2}\d(-\w+(\.\d+)?)?')]
124+
[string]
125+
$LtsVersion,
126+
121127
[Parameter(ParameterSetName="GenerateMatrixJson")]
122128
[Parameter(ParameterSetName="GenerateTagsYaml")]
123129
[ValidatePattern('(\d+\.){2}\d(-\w+(\.\d+)?)?')]
@@ -236,6 +242,7 @@ End {
236242
ServicingVersion = if($Version) {$Version} else {$ServicingVersion}
237243
PreviewVersion = if($Version) {$Version} else {$PreviewVersion}
238244
StableVersion = if($Version) {$Version} else {$StableVersion}
245+
LtsVersion = if($Version) {$Version} else {$LtsVersion}
239246
}
240247

241248
# Get Versions
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
FROM node:10.15.3-alpine
Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
# Copyright (c) Microsoft Corporation. All rights reserved.
2+
# Licensed under the MIT License.
3+
4+
# Docker image file that describes an Alpine3.8 image with PowerShell installed from .tar.gz file(s)
5+
6+
# Define arg(s) needed for the From statement
7+
ARG fromTag=3.8
8+
ARG imageRepo=alpine
9+
10+
FROM ${imageRepo}:${fromTag} AS installer-env
11+
12+
# Define Args for the needed to add the package
13+
ARG PS_VERSION=7.0.0
14+
ARG PS_PACKAGE=powershell-${PS_VERSION}-linux-alpine-x64.tar.gz
15+
ARG PS_PACKAGE_URL=https://github.com/PowerShell/PowerShell/releases/download/v${PS_VERSION}/${PS_PACKAGE}
16+
ARG PS_INSTALL_VERSION=7-lts
17+
18+
# Download the Linux tar.gz and save it
19+
ADD ${PS_PACKAGE_URL} /tmp/linux.tar.gz
20+
21+
# define the folder we will be installing PowerShell to
22+
ENV PS_INSTALL_FOLDER=/opt/microsoft/powershell/$PS_INSTALL_VERSION
23+
24+
# Create the install folder
25+
RUN mkdir -p ${PS_INSTALL_FOLDER}
26+
27+
# Unzip the Linux tar.gz
28+
RUN tar zxf /tmp/linux.tar.gz -C ${PS_INSTALL_FOLDER} -v
29+
30+
# Start a new stage so we lose all the tar.gz layers from the final image
31+
FROM ${imageRepo}:${fromTag}
32+
33+
# Copy only the files we need from the previous stage
34+
COPY --from=installer-env ["/opt/microsoft/powershell", "/opt/microsoft/powershell"]
35+
36+
# Define Args and Env needed to create links
37+
ARG PS_INSTALL_VERSION=7-lts
38+
ENV PS_INSTALL_FOLDER=/opt/microsoft/powershell/$PS_INSTALL_VERSION \
39+
\
40+
# Define ENVs for Localization/Globalization
41+
DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=false \
42+
LC_ALL=en_US.UTF-8 \
43+
LANG=en_US.UTF-8 \
44+
# set a fixed location for the Module analysis cache
45+
PSModuleAnalysisCachePath=/var/cache/microsoft/powershell/PSModuleAnalysisCache/ModuleAnalysisCache \
46+
POWERSHELL_DISTRIBUTION_CHANNEL=PSDocker-Alpine-3.8
47+
48+
# Install dotnet dependencies and ca-certificates
49+
RUN apk add --no-cache \
50+
ca-certificates \
51+
less \
52+
\
53+
# PSReadline/console dependencies
54+
ncurses-terminfo-base \
55+
\
56+
# .NET Core dependencies
57+
krb5-libs \
58+
libgcc \
59+
libintl \
60+
libssl1.0 \
61+
libstdc++ \
62+
tzdata \
63+
userspace-rcu \
64+
zlib \
65+
icu-libs \
66+
&& apk -X https://dl-cdn.alpinelinux.org/alpine/edge/main add --no-cache \
67+
lttng-ust \
68+
\
69+
# Create the pwsh symbolic link that points to powershell
70+
&& ln -s ${PS_INSTALL_FOLDER}/pwsh /usr/bin/pwsh \
71+
\
72+
# Create the pwsh-lts symbolic link that points to powershell
73+
&& ln -s ${PS_INSTALL_FOLDER}/pwsh /usr/bin/pwsh-lts \
74+
# Give all user execute permissions and remove write permissions for others
75+
&& chmod a+x,o-w ${PS_INSTALL_FOLDER}/pwsh \
76+
# intialize powershell module cache
77+
&& pwsh \
78+
-NoLogo \
79+
-NoProfile \
80+
-Command " \
81+
\$ErrorActionPreference = 'Stop' ; \
82+
\$ProgressPreference = 'SilentlyContinue' ; \
83+
while(!(Test-Path -Path \$env:PSModuleAnalysisCachePath)) { \
84+
Write-Host "'Waiting for $env:PSModuleAnalysisCachePath'" ; \
85+
Start-Sleep -Seconds 6 ; \
86+
}"
87+
88+
# Define args needed only for the labels
89+
ARG PS_VERSION=6.2.0
90+
ARG IMAGE_NAME=mcr.microsoft.com/powershell:alpine-3.8
91+
ARG VCS_REF="none"
92+
93+
# Add label last as it's just metadata and uses a lot of parameters
94+
LABEL maintainer="PowerShell Team <powershellteam@hotmail.com>" \
95+
readme.md="https://github.com/PowerShell/PowerShell/blob/master/docker/README.md" \
96+
description="This Dockerfile will install the latest release of PowerShell." \
97+
org.label-schema.usage="https://github.com/PowerShell/PowerShell/tree/master/docker#run-the-docker-image-you-built" \
98+
org.label-schema.url="https://github.com/PowerShell/PowerShell/blob/master/docker/README.md" \
99+
org.label-schema.vcs-url="https://github.com/PowerShell/PowerShell-Docker" \
100+
org.label-schema.name="powershell" \
101+
org.label-schema.vendor="PowerShell" \
102+
org.label-schema.vcs-ref=${VCS_REF} \
103+
org.label-schema.version=${PS_VERSION} \
104+
org.label-schema.schema-version="1.0" \
105+
org.label-schema.docker.cmd="docker run ${IMAGE_NAME} pwsh -c '$psversiontable'" \
106+
org.label-schema.docker.cmd.devel="docker run ${IMAGE_NAME}" \
107+
org.label-schema.docker.cmd.test="docker run ${IMAGE_NAME} pwsh -c Invoke-Pester" \
108+
org.label-schema.docker.cmd.help="docker run ${IMAGE_NAME} pwsh -c Get-Help"
109+
110+
CMD [ "pwsh" ]
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Copyright (c) Microsoft Corporation. All rights reserved.
2+
# Licensed under the MIT License.
3+
4+
# return objects representing the tags we need to base the Alpine image on
5+
6+
# The versions of Alpine we care about, for this dockerfile
7+
$shortTags = @('3.8')
8+
9+
$parent = Join-Path -Path $PSScriptRoot -ChildPath '..'
10+
$repoRoot = Join-Path -path (Join-Path -Path $parent -ChildPath '..') -ChildPath '..'
11+
$modulePath = Join-Path -Path $repoRoot -ChildPath 'tools\getDockerTags'
12+
Import-Module $modulePath
13+
14+
Get-DockerTags -ShortTags $shortTags -Image "alpine" -FullTagFilter '^3.\d$' -OnlyShortTags

release/lts/alpine38/meta.json

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"IsLinux" : true,
3+
"UseLinuxVersion": false,
4+
"PackageFormat": "powershell-${PS_VERSION}-linux-alpine-x64.tar.gz",
5+
"osVersion": "Alpine 3.8",
6+
"tagTemplates": [
7+
"lts-alpine-#shorttag#"
8+
],
9+
"SkipGssNtlmSspTests": true,
10+
"SubImage": "test-deps",
11+
"TestProperties": {
12+
"size": 165
13+
}
14+
}

0 commit comments

Comments
 (0)