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
22 changes: 22 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "PowerShell: Build LTS Ubuntu 16.04",
"type": "PowerShell",
"request": "launch",
"script": "${workspaceFolder}/build.ps1",
"cwd": "${workspaceFolder}",
"args": [
"-build",
"-Channel",
"lts",
"-name",
"ubuntu16.04"
]
}
]
}
9 changes: 8 additions & 1 deletion .vsts-ci/phase.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,14 @@ jobs:
condition: and( succeededOrFailed(), ne(variables['Channel'],''))

- pwsh: |
./build.ps1 -build -name '$(ImageName)' -IncludeKnownIssues -Channel '$(Channel)' -TestLogPostfix '$(ImageName)-$(Channel)' ${{ parameters.ciParameter }} -Repository $(Channel)/powershell
$extraParams = @{}
if($env:ACR_NAME)
{
Write-Host 'Using ACR, will NOT test behavior...'
$extraParams.Add('SkipTest',$true)
}

./build.ps1 -build -name '$(ImageName)' -IncludeKnownIssues -Channel '$(Channel)' -TestLogPostfix '$(ImageName)-$(Channel)' @extraParams ${{ parameters.ciParameter }} -Repository $(Channel)/powershell
displayName: $(ImageName) $(Channel)
condition: and( succeededOrFailed(), ne(variables['Channel'],''))
continueOnError: ${{ variables.continueonerror }}
Expand Down
4 changes: 4 additions & 0 deletions .vsts-ci/releasePhase.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@ jobs:
$releaseTag = '$(previewReleaseTag)'
$version = '$(previewReleaseTag)' -replace '^v', ''
}
'lts' {
$releaseTag = '$(ltsReleaseTag)'
$version = '$(ltsReleaseTag)' -replace '^v', ''
}
default {
throw "Unknown channel '$(Channel)'"
}
Expand Down
11 changes: 9 additions & 2 deletions .vsts-ci/releasebuild.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: s_$(stableReleaseTag)_p_$(previewReleaseTag)$(Rev:_rr)
name: s_$(stableReleaseTag)_p_$(previewReleaseTag)_l_$(ltsReleaseTag)$(Rev:_rr)

resources:
- repo: self
Expand All @@ -14,11 +14,15 @@ stages:
- template: releaseStage.yml
parameters:
channel: preview
- template: releaseStage.yml
parameters:
channel: lts

- stage: GenerateManifests
dependsOn:
- GenerateYaml_stable
- GenerateYaml_preview
- GenerateYaml_lts
jobs:
- job: PreviewManifestPhase
variables:
Expand Down Expand Up @@ -65,6 +69,8 @@ stages:
Write-Host "##vso[task.setvariable variable=StableVersion;]$stableVersion"
$previewVersion = '$(previewReleaseTag)' -replace '^v', ''
Write-Host "##vso[task.setvariable variable=PreviewVersion;]$previewVersion"
$ltsVersion = '$(ltsReleaseTag)' -replace '^v', ''
Write-Host "##vso[task.setvariable variable=LtsVersion;]$ltsVersion"
displayName: 'Set Versions'

- powershell: 'Get-ChildItem env:'
Expand All @@ -74,7 +80,7 @@ stages:
displayName: 'Install Pester'

- powershell: |
$yaml = ./build.ps1 -GenerateTagsYaml -Channel stable, preview -StableVersion $(StableVersion) -PreviewVersion $(PreviewVersion)
$yaml = ./build.ps1 -GenerateTagsYaml -Channel stable, preview -StableVersion $(StableVersion) -PreviewVersion $(PreviewVersion) -LtsVersion $(LtsVersion)
$yaml | Out-File -Encoding ascii -Path ./tagsmetadata.yaml
Get-ChildItem -Path ./tagsmetadata.yaml | Select-Object -ExpandProperty FullName | ForEach-Object {
Write-Host "##vso[artifact.upload containerfolder=artifacts;artifactname=artifacts]$_"
Expand All @@ -86,6 +92,7 @@ stages:
@{
'previewReleaseTag' = '$(previewReleaseTag)'
'stableReleaseTag' = '$(stableReleaseTag)'
'ltsReleaseTag' = '$(ltsReleaseTag)'
}|convertto-json | out-file -FilePath $path -Encoding ascii
Write-Host "##vso[artifact.upload containerfolder=releaseTags;artifactname=releaseTags]$path"
displayName: Save release Tags
Expand Down
1 change: 0 additions & 1 deletion .vsts-ci/vsts-arm-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,3 @@ stages:
acr: OnlyAcr
useacr: true
winCiParameter: ''
osFilter: Linux
9 changes: 8 additions & 1 deletion build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ param(
[string]
$TagFilter,

[ValidateSet('stable','preview','servicing','community-stable','community-preview','community-servicing')]
[ValidateSet('stable','preview','servicing','community-stable','community-preview','community-servicing','lts')]
[Parameter(Mandatory, ParameterSetName="TestByName")]
[Parameter(Mandatory, ParameterSetName="TestAll")]
[Parameter(ParameterSetName="localBuildByName")]
Expand Down Expand Up @@ -118,6 +118,12 @@ param(
[string]
$StableVersion,

[Parameter(ParameterSetName="GenerateMatrixJson")]
[Parameter(ParameterSetName="GenerateTagsYaml")]
[ValidatePattern('(\d+\.){2}\d(-\w+(\.\d+)?)?')]
[string]
$LtsVersion,

[Parameter(ParameterSetName="GenerateMatrixJson")]
[Parameter(ParameterSetName="GenerateTagsYaml")]
[ValidatePattern('(\d+\.){2}\d(-\w+(\.\d+)?)?')]
Expand Down Expand Up @@ -236,6 +242,7 @@ End {
ServicingVersion = if($Version) {$Version} else {$ServicingVersion}
PreviewVersion = if($Version) {$Version} else {$PreviewVersion}
StableVersion = if($Version) {$Version} else {$StableVersion}
LtsVersion = if($Version) {$Version} else {$LtsVersion}
}

# Get Versions
Expand Down
1 change: 1 addition & 0 deletions release/lts/alpine38/dependabot/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
FROM node:10.15.3-alpine
110 changes: 110 additions & 0 deletions release/lts/alpine38/docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.

# Docker image file that describes an Alpine3.8 image with PowerShell installed from .tar.gz file(s)

# Define arg(s) needed for the From statement
ARG fromTag=3.8
ARG imageRepo=alpine

FROM ${imageRepo}:${fromTag} AS installer-env

# Define Args for the needed to add the package
ARG PS_VERSION=7.0.0
ARG PS_PACKAGE=powershell-${PS_VERSION}-linux-alpine-x64.tar.gz
ARG PS_PACKAGE_URL=https://github.com/PowerShell/PowerShell/releases/download/v${PS_VERSION}/${PS_PACKAGE}
ARG PS_INSTALL_VERSION=7-lts

# Download the Linux tar.gz and save it
ADD ${PS_PACKAGE_URL} /tmp/linux.tar.gz

# define the folder we will be installing PowerShell to
ENV PS_INSTALL_FOLDER=/opt/microsoft/powershell/$PS_INSTALL_VERSION

# Create the install folder
RUN mkdir -p ${PS_INSTALL_FOLDER}

# Unzip the Linux tar.gz
RUN tar zxf /tmp/linux.tar.gz -C ${PS_INSTALL_FOLDER} -v

# Start a new stage so we lose all the tar.gz layers from the final image
FROM ${imageRepo}:${fromTag}

# Copy only the files we need from the previous stage
COPY --from=installer-env ["/opt/microsoft/powershell", "/opt/microsoft/powershell"]

# Define Args and Env needed to create links
ARG PS_INSTALL_VERSION=7-lts
ENV PS_INSTALL_FOLDER=/opt/microsoft/powershell/$PS_INSTALL_VERSION \
\
# Define ENVs for Localization/Globalization
DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=false \
LC_ALL=en_US.UTF-8 \
LANG=en_US.UTF-8 \
# set a fixed location for the Module analysis cache
PSModuleAnalysisCachePath=/var/cache/microsoft/powershell/PSModuleAnalysisCache/ModuleAnalysisCache \
POWERSHELL_DISTRIBUTION_CHANNEL=PSDocker-Alpine-3.8

# Install dotnet dependencies and ca-certificates
RUN apk add --no-cache \
ca-certificates \
less \
\
# PSReadline/console dependencies
ncurses-terminfo-base \
\
# .NET Core dependencies
krb5-libs \
libgcc \
libintl \
libssl1.0 \
libstdc++ \
tzdata \
userspace-rcu \
zlib \
icu-libs \
&& apk -X https://dl-cdn.alpinelinux.org/alpine/edge/main add --no-cache \
lttng-ust \
\
# Create the pwsh symbolic link that points to powershell
&& ln -s ${PS_INSTALL_FOLDER}/pwsh /usr/bin/pwsh \
\
# Create the pwsh-lts symbolic link that points to powershell
&& ln -s ${PS_INSTALL_FOLDER}/pwsh /usr/bin/pwsh-lts \
# Give all user execute permissions and remove write permissions for others
&& chmod a+x,o-w ${PS_INSTALL_FOLDER}/pwsh \
# intialize powershell module cache
&& pwsh \
-NoLogo \
-NoProfile \
-Command " \
\$ErrorActionPreference = 'Stop' ; \
\$ProgressPreference = 'SilentlyContinue' ; \
while(!(Test-Path -Path \$env:PSModuleAnalysisCachePath)) { \
Write-Host "'Waiting for $env:PSModuleAnalysisCachePath'" ; \
Start-Sleep -Seconds 6 ; \
}"

# Define args needed only for the labels
ARG PS_VERSION=6.2.0
ARG IMAGE_NAME=mcr.microsoft.com/powershell:alpine-3.8
ARG VCS_REF="none"

# Add label last as it's just metadata and uses a lot of parameters
LABEL maintainer="PowerShell Team <powershellteam@hotmail.com>" \
readme.md="https://github.com/PowerShell/PowerShell/blob/master/docker/README.md" \
description="This Dockerfile will install the latest release of PowerShell." \
org.label-schema.usage="https://github.com/PowerShell/PowerShell/tree/master/docker#run-the-docker-image-you-built" \
org.label-schema.url="https://github.com/PowerShell/PowerShell/blob/master/docker/README.md" \
org.label-schema.vcs-url="https://github.com/PowerShell/PowerShell-Docker" \
org.label-schema.name="powershell" \
org.label-schema.vendor="PowerShell" \
org.label-schema.vcs-ref=${VCS_REF} \
org.label-schema.version=${PS_VERSION} \
org.label-schema.schema-version="1.0" \
org.label-schema.docker.cmd="docker run ${IMAGE_NAME} pwsh -c '$psversiontable'" \
org.label-schema.docker.cmd.devel="docker run ${IMAGE_NAME}" \
org.label-schema.docker.cmd.test="docker run ${IMAGE_NAME} pwsh -c Invoke-Pester" \
org.label-schema.docker.cmd.help="docker run ${IMAGE_NAME} pwsh -c Get-Help"

CMD [ "pwsh" ]
14 changes: 14 additions & 0 deletions release/lts/alpine38/getLatestTag.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.

# return objects representing the tags we need to base the Alpine image on

# The versions of Alpine we care about, for this dockerfile
$shortTags = @('3.8')

$parent = Join-Path -Path $PSScriptRoot -ChildPath '..'
$repoRoot = Join-Path -path (Join-Path -Path $parent -ChildPath '..') -ChildPath '..'
$modulePath = Join-Path -Path $repoRoot -ChildPath 'tools\getDockerTags'
Import-Module $modulePath

Get-DockerTags -ShortTags $shortTags -Image "alpine" -FullTagFilter '^3.\d$' -OnlyShortTags
14 changes: 14 additions & 0 deletions release/lts/alpine38/meta.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"IsLinux" : true,
"UseLinuxVersion": false,
"PackageFormat": "powershell-${PS_VERSION}-linux-alpine-x64.tar.gz",
"osVersion": "Alpine 3.8",
"tagTemplates": [
"lts-alpine-#shorttag#"
],
"SkipGssNtlmSspTests": true,
"SubImage": "test-deps",
"TestProperties": {
"size": 165
}
}
58 changes: 58 additions & 0 deletions release/lts/alpine38/test-deps/docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# Docker image file that describes an Alpine image with PowerShell and test dependencies

ARG BaseImage=mcr.microsoft.com/powershell:alpine-3.8

FROM node:10.15.3-alpine as node

# Do nothing, just added to borrow the already built node files.

FROM ${BaseImage}

ENV NODE_VERSION=10.15.3 \
YARN_VERSION=1.13.0 \
NVM_DIR="/root/.nvm" \
POWERSHELL_DISTRIBUTION_CHANNEL=PSDocker-TestDeps-Alpine-3.8

# workaround for Alpine to run in Azure DevOps
ENV NODE_NO_WARNINGS=1

# Copy node and yarn into image
COPY --from=node /usr/local/bin/node /usr/local/bin/node
COPY --from=node /opt/yarn-v${YARN_VERSION} /opt/yarn-v${YARN_VERSION}

RUN apk add --no-cache --virtual .pipeline-deps readline linux-pam \
&& apk add \
bash \
sudo \
shadow \
openssl \
curl \
&& apk del .pipeline-deps \
&& ln -s /opt/yarn-v$YARN_VERSION/bin/yarn /usr/local/bin/yarn \
&& ln -s /opt/yarn-v$YARN_VERSION/bin/yarnpkg /usr/local/bin/yarnpkg

# Define args needed only for the labels
ARG VCS_REF="none"
ARG IMAGE_NAME=mcr.microsoft.com/powershell/test-deps:alpine-3.8
ARG PS_VERSION=6.2.3

LABEL maintainer="PowerShell Team <powershellteam@hotmail.com>" \
readme.md="https://github.com/PowerShell/PowerShell/blob/master/docker/README.md" \
description="This Dockerfile will install the latest release of PowerShell and tools needed for runing CI/CD container jobs." \
org.label-schema.usage="https://github.com/PowerShell/PowerShell/tree/master/docker#run-the-docker-image-you-built" \
org.label-schema.url="https://github.com/PowerShell/PowerShell/blob/master/docker/README.md" \
org.label-schema.vcs-url="https://github.com/PowerShell/PowerShell-Docker" \
org.label-schema.name="powershell" \
org.label-schema.vendor="PowerShell" \
org.label-schema.version=${PS_VERSION} \
org.label-schema.schema-version="1.0" \
org.label-schema.vcs-ref=${VCS_REF} \
org.label-schema.docker.cmd="docker run ${IMAGE_NAME} pwsh -c '$psversiontable'" \
org.label-schema.docker.cmd.devel="docker run ${IMAGE_NAME}" \
org.label-schema.docker.cmd.test="docker run ${IMAGE_NAME} pwsh -c Invoke-Pester" \
org.label-schema.docker.cmd.help="docker run ${IMAGE_NAME} pwsh -c Get-Help" \
com.azure.dev.pipelines.agent.handler.node.path="/usr/local/bin/node"

# Use PowerShell as the default shell
# Use array to avoid Docker prepending /bin/sh -c
CMD [ "pwsh" ]
16 changes: 16 additions & 0 deletions release/lts/alpine38/test-deps/meta.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"IsLinux" : true,
"UseLinuxVersion": false,
"SkipGssNtlmSspTests": true,
"osVersion": "Alpine 3.8",
"tagTemplates": [
"lts-alpine-#shorttag#"
],
"OptionalTests": [
"test-deps",
"test-deps-musl"
],
"TestProperties": {
"size": 212
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@

# Dummy docker image to trigger dependabot PRs

FROM opensuse/leap:42.3
FROM alpine:3.10.0
Loading