From fdaef2da13cb52d93c7883354c26365f45648c41 Mon Sep 17 00:00:00 2001 From: Travis Plunk Date: Wed, 19 Feb 2020 18:02:25 -0800 Subject: [PATCH] Merge RC3 Version of LTS work (#377) --- .vscode/launch.json | 22 ++++ .vsts-ci/phase.yml | 9 +- .vsts-ci/releasePhase.yml | 4 + .vsts-ci/releasebuild.yml | 11 +- .vsts-ci/vsts-arm-ci.yml | 1 - build.ps1 | 9 +- release/lts/alpine38/dependabot/Dockerfile | 1 + release/lts/alpine38/docker/Dockerfile | 110 +++++++++++++++++ release/lts/alpine38/getLatestTag.ps1 | 14 +++ release/lts/alpine38/meta.json | 14 +++ .../lts/alpine38/test-deps/docker/Dockerfile | 58 +++++++++ release/lts/alpine38/test-deps/meta.json | 16 +++ .../alpine39}/dependabot/Dockerfile | 2 +- release/lts/alpine39/docker/Dockerfile | 112 ++++++++++++++++++ release/lts/alpine39/getLatestTag.ps1 | 14 +++ release/lts/alpine39/meta.json | 14 +++ .../lts/alpine39/test-deps/docker/Dockerfile | 60 ++++++++++ release/lts/alpine39/test-deps/meta.json | 20 ++++ release/lts/arm32v7/docker/Dockerfile | 95 +++++++++++++++ release/lts/arm32v7/getLatestTag.ps1 | 14 +++ release/lts/arm32v7/meta.json | 16 +++ .../centos7}/docker/Dockerfile | 42 ++++--- .../centos7}/getLatestTag.ps1 | 8 +- release/lts/centos7/meta.json | 13 ++ .../centos7}/test-deps/docker/Dockerfile | 27 ++--- .../centos7}/test-deps/meta.json | 7 +- release/lts/centos8/dependabot/Dockerfile | 6 + release/lts/centos8/docker/Dockerfile | 75 ++++++++++++ release/lts/centos8/getLatestTag.ps1 | 14 +++ release/lts/centos8/meta.json | 13 ++ .../lts/centos8/test-deps/docker/Dockerfile | 39 ++++++ .../centos8}/test-deps/meta.json | 7 +- release/lts/debian10/dependabot/Dockerfile | 6 + .../debian10}/docker/Dockerfile | 89 +++++++------- release/lts/debian10/getLatestTag.ps1 | 14 +++ release/lts/debian10/meta.json | 15 +++ .../lts/debian10/test-deps/docker/Dockerfile | 43 +++++++ release/lts/debian10/test-deps/meta.json | 16 +++ release/lts/debian11/dependabot/Dockerfile | 6 + release/lts/debian11/docker/Dockerfile | 112 ++++++++++++++++++ release/lts/debian11/getLatestTag.ps1 | 14 +++ release/lts/debian11/meta.json | 15 +++ .../lts/debian11/test-deps/docker/Dockerfile | 43 +++++++ release/lts/debian11/test-deps/meta.json | 16 +++ release/lts/debian9/docker/Dockerfile | 78 ++++++++++++ release/lts/debian9/getLatestTag.ps1 | 14 +++ release/lts/debian9/meta.json | 14 +++ .../lts/debian9/test-deps/docker/Dockerfile | 43 +++++++ release/lts/debian9/test-deps/meta.json | 16 +++ release/lts/fedora/dependabot/Dockerfile | 6 + release/lts/fedora/docker/Dockerfile | 110 +++++++++++++++++ .../fedora28 => lts/fedora}/getLatestTag.ps1 | 4 +- release/lts/fedora/meta.json | 14 +++ .../fedora}/test-deps/docker/Dockerfile | 6 +- release/lts/fedora/test-deps/meta.json | 19 +++ release/lts/nanoserver/docker/Dockerfile | 92 ++++++++++++++ release/lts/nanoserver/getLatestTag.ps1 | 30 +++++ release/lts/nanoserver/meta.json | 16 +++ .../lts/nanoserver1809/dependabot/Dockerfile | 6 + release/lts/nanoserver1809/docker/Dockerfile | 105 ++++++++++++++++ release/lts/nanoserver1809/getLatestTag.ps1 | 21 ++++ release/lts/nanoserver1809/meta.json | 16 +++ release/lts/ubuntu16.04/docker/Dockerfile | 75 ++++++++++++ release/lts/ubuntu16.04/getLatestTag.ps1 | 14 +++ release/lts/ubuntu16.04/meta.json | 14 +++ .../ubuntu16.04/test-deps/docker/Dockerfile | 42 +++++++ release/lts/ubuntu16.04/test-deps/meta.json | 16 +++ release/lts/ubuntu18.04/dependabot/Dockerfile | 6 + release/lts/ubuntu18.04/docker/Dockerfile | 75 ++++++++++++ release/lts/ubuntu18.04/getLatestTag.ps1 | 14 +++ release/lts/ubuntu18.04/meta.json | 14 +++ .../ubuntu18.04/test-deps/docker/Dockerfile | 42 +++++++ release/lts/ubuntu18.04/test-deps/meta.json | 16 +++ .../windowsservercore/dependabot/Dockerfile | 6 + .../lts/windowsservercore/docker/Dockerfile | 85 +++++++++++++ .../lts/windowsservercore/getLatestTag.ps1 | 19 +++ release/lts/windowsservercore/meta.json | 12 ++ release/preview/fedora/getLatestTag.ps1 | 2 +- release/preview/fedora/test-deps/meta.json | 2 - release/preview/nanoserver1809/meta.json | 3 +- release/preview/opensuse423/meta.json | 15 --- .../windowsservercore/getLatestTag.ps1 | 2 +- release/stable/fedora28/meta.json | 15 --- release/stable/nanoserver1809/meta.json | 3 +- .../stable/windowsservercore/getLatestTag.ps1 | 2 +- tests/container.tests.ps1 | 61 +++++++--- tools/buildHelper/buildHelper.psm1 | 43 ++++++- vsts-ci.yml | 6 +- 88 files changed, 2314 insertions(+), 156 deletions(-) create mode 100644 .vscode/launch.json create mode 100644 release/lts/alpine38/dependabot/Dockerfile create mode 100644 release/lts/alpine38/docker/Dockerfile create mode 100644 release/lts/alpine38/getLatestTag.ps1 create mode 100644 release/lts/alpine38/meta.json create mode 100644 release/lts/alpine38/test-deps/docker/Dockerfile create mode 100644 release/lts/alpine38/test-deps/meta.json rename release/{preview/opensuse423 => lts/alpine39}/dependabot/Dockerfile (85%) create mode 100644 release/lts/alpine39/docker/Dockerfile create mode 100644 release/lts/alpine39/getLatestTag.ps1 create mode 100644 release/lts/alpine39/meta.json create mode 100644 release/lts/alpine39/test-deps/docker/Dockerfile create mode 100644 release/lts/alpine39/test-deps/meta.json create mode 100644 release/lts/arm32v7/docker/Dockerfile create mode 100644 release/lts/arm32v7/getLatestTag.ps1 create mode 100644 release/lts/arm32v7/meta.json rename release/{stable/fedora28 => lts/centos7}/docker/Dockerfile (73%) rename release/{preview/opensuse423 => lts/centos7}/getLatestTag.ps1 (57%) create mode 100644 release/lts/centos7/meta.json rename release/{preview/opensuse423 => lts/centos7}/test-deps/docker/Dockerfile (68%) rename release/{stable/fedora28 => lts/centos7}/test-deps/meta.json (63%) create mode 100644 release/lts/centos8/dependabot/Dockerfile create mode 100644 release/lts/centos8/docker/Dockerfile create mode 100644 release/lts/centos8/getLatestTag.ps1 create mode 100644 release/lts/centos8/meta.json create mode 100644 release/lts/centos8/test-deps/docker/Dockerfile rename release/{preview/opensuse423 => lts/centos8}/test-deps/meta.json (61%) create mode 100644 release/lts/debian10/dependabot/Dockerfile rename release/{preview/opensuse423 => lts/debian10}/docker/Dockerfile (67%) create mode 100644 release/lts/debian10/getLatestTag.ps1 create mode 100644 release/lts/debian10/meta.json create mode 100644 release/lts/debian10/test-deps/docker/Dockerfile create mode 100644 release/lts/debian10/test-deps/meta.json create mode 100644 release/lts/debian11/dependabot/Dockerfile create mode 100644 release/lts/debian11/docker/Dockerfile create mode 100644 release/lts/debian11/getLatestTag.ps1 create mode 100644 release/lts/debian11/meta.json create mode 100644 release/lts/debian11/test-deps/docker/Dockerfile create mode 100644 release/lts/debian11/test-deps/meta.json create mode 100644 release/lts/debian9/docker/Dockerfile create mode 100644 release/lts/debian9/getLatestTag.ps1 create mode 100644 release/lts/debian9/meta.json create mode 100644 release/lts/debian9/test-deps/docker/Dockerfile create mode 100644 release/lts/debian9/test-deps/meta.json create mode 100644 release/lts/fedora/dependabot/Dockerfile create mode 100644 release/lts/fedora/docker/Dockerfile rename release/{stable/fedora28 => lts/fedora}/getLatestTag.ps1 (91%) create mode 100644 release/lts/fedora/meta.json rename release/{stable/fedora28 => lts/fedora}/test-deps/docker/Dockerfile (94%) create mode 100644 release/lts/fedora/test-deps/meta.json create mode 100755 release/lts/nanoserver/docker/Dockerfile create mode 100644 release/lts/nanoserver/getLatestTag.ps1 create mode 100644 release/lts/nanoserver/meta.json create mode 100644 release/lts/nanoserver1809/dependabot/Dockerfile create mode 100755 release/lts/nanoserver1809/docker/Dockerfile create mode 100644 release/lts/nanoserver1809/getLatestTag.ps1 create mode 100644 release/lts/nanoserver1809/meta.json create mode 100644 release/lts/ubuntu16.04/docker/Dockerfile create mode 100644 release/lts/ubuntu16.04/getLatestTag.ps1 create mode 100644 release/lts/ubuntu16.04/meta.json create mode 100644 release/lts/ubuntu16.04/test-deps/docker/Dockerfile create mode 100644 release/lts/ubuntu16.04/test-deps/meta.json create mode 100644 release/lts/ubuntu18.04/dependabot/Dockerfile create mode 100644 release/lts/ubuntu18.04/docker/Dockerfile create mode 100644 release/lts/ubuntu18.04/getLatestTag.ps1 create mode 100644 release/lts/ubuntu18.04/meta.json create mode 100644 release/lts/ubuntu18.04/test-deps/docker/Dockerfile create mode 100644 release/lts/ubuntu18.04/test-deps/meta.json create mode 100644 release/lts/windowsservercore/dependabot/Dockerfile create mode 100755 release/lts/windowsservercore/docker/Dockerfile create mode 100644 release/lts/windowsservercore/getLatestTag.ps1 create mode 100644 release/lts/windowsservercore/meta.json delete mode 100644 release/preview/opensuse423/meta.json delete mode 100644 release/stable/fedora28/meta.json diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 000000000..c65c0b877 --- /dev/null +++ b/.vscode/launch.json @@ -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" + ] + } + ] +} diff --git a/.vsts-ci/phase.yml b/.vsts-ci/phase.yml index 6fb3c0e5d..fc3004820 100644 --- a/.vsts-ci/phase.yml +++ b/.vsts-ci/phase.yml @@ -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 }} diff --git a/.vsts-ci/releasePhase.yml b/.vsts-ci/releasePhase.yml index 964e7c0d9..86353c23b 100644 --- a/.vsts-ci/releasePhase.yml +++ b/.vsts-ci/releasePhase.yml @@ -41,6 +41,10 @@ jobs: $releaseTag = '$(previewReleaseTag)' $version = '$(previewReleaseTag)' -replace '^v', '' } + 'lts' { + $releaseTag = '$(ltsReleaseTag)' + $version = '$(ltsReleaseTag)' -replace '^v', '' + } default { throw "Unknown channel '$(Channel)'" } diff --git a/.vsts-ci/releasebuild.yml b/.vsts-ci/releasebuild.yml index c588e2e32..b5c8db38c 100644 --- a/.vsts-ci/releasebuild.yml +++ b/.vsts-ci/releasebuild.yml @@ -1,4 +1,4 @@ -name: s_$(stableReleaseTag)_p_$(previewReleaseTag)$(Rev:_rr) +name: s_$(stableReleaseTag)_p_$(previewReleaseTag)_l_$(ltsReleaseTag)$(Rev:_rr) resources: - repo: self @@ -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: @@ -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:' @@ -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]$_" @@ -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 diff --git a/.vsts-ci/vsts-arm-ci.yml b/.vsts-ci/vsts-arm-ci.yml index 8fb2c477e..6fc4a1e44 100644 --- a/.vsts-ci/vsts-arm-ci.yml +++ b/.vsts-ci/vsts-arm-ci.yml @@ -20,4 +20,3 @@ stages: acr: OnlyAcr useacr: true winCiParameter: '' - osFilter: Linux diff --git a/build.ps1 b/build.ps1 index eae8fbc96..e39c63026 100755 --- a/build.ps1 +++ b/build.ps1 @@ -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")] @@ -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+)?)?')] @@ -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 diff --git a/release/lts/alpine38/dependabot/Dockerfile b/release/lts/alpine38/dependabot/Dockerfile new file mode 100644 index 000000000..1c8c3ded3 --- /dev/null +++ b/release/lts/alpine38/dependabot/Dockerfile @@ -0,0 +1 @@ +FROM node:10.15.3-alpine diff --git a/release/lts/alpine38/docker/Dockerfile b/release/lts/alpine38/docker/Dockerfile new file mode 100644 index 000000000..bc69ecfe9 --- /dev/null +++ b/release/lts/alpine38/docker/Dockerfile @@ -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 " \ + 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" ] diff --git a/release/lts/alpine38/getLatestTag.ps1 b/release/lts/alpine38/getLatestTag.ps1 new file mode 100644 index 000000000..bc836c038 --- /dev/null +++ b/release/lts/alpine38/getLatestTag.ps1 @@ -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 diff --git a/release/lts/alpine38/meta.json b/release/lts/alpine38/meta.json new file mode 100644 index 000000000..2b4b5945b --- /dev/null +++ b/release/lts/alpine38/meta.json @@ -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 + } +} diff --git a/release/lts/alpine38/test-deps/docker/Dockerfile b/release/lts/alpine38/test-deps/docker/Dockerfile new file mode 100644 index 000000000..475dbfdea --- /dev/null +++ b/release/lts/alpine38/test-deps/docker/Dockerfile @@ -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 " \ + 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" ] diff --git a/release/lts/alpine38/test-deps/meta.json b/release/lts/alpine38/test-deps/meta.json new file mode 100644 index 000000000..9ac39a65b --- /dev/null +++ b/release/lts/alpine38/test-deps/meta.json @@ -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 + } +} diff --git a/release/preview/opensuse423/dependabot/Dockerfile b/release/lts/alpine39/dependabot/Dockerfile similarity index 85% rename from release/preview/opensuse423/dependabot/Dockerfile rename to release/lts/alpine39/dependabot/Dockerfile index f3be35b6e..cf026e7c3 100644 --- a/release/preview/opensuse423/dependabot/Dockerfile +++ b/release/lts/alpine39/dependabot/Dockerfile @@ -3,4 +3,4 @@ # Dummy docker image to trigger dependabot PRs -FROM opensuse/leap:42.3 +FROM alpine:3.10.0 diff --git a/release/lts/alpine39/docker/Dockerfile b/release/lts/alpine39/docker/Dockerfile new file mode 100644 index 000000000..cdb172917 --- /dev/null +++ b/release/lts/alpine39/docker/Dockerfile @@ -0,0 +1,112 @@ +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. + +# Docker image file that describes an Alpine3.x image with PowerShell installed from .tar.gz file(s) + +# Define arg(s) needed for the From statement +ARG fromTag=3.9 +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} + +ARG fromTag=3.9 + +# 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-${fromTag} + +# 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.1 \ + 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=7.0.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 " \ + 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" ] diff --git a/release/lts/alpine39/getLatestTag.ps1 b/release/lts/alpine39/getLatestTag.ps1 new file mode 100644 index 000000000..bab6f5f80 --- /dev/null +++ b/release/lts/alpine39/getLatestTag.ps1 @@ -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.9','3.10') + +$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\d?$' -OnlyShortTags diff --git a/release/lts/alpine39/meta.json b/release/lts/alpine39/meta.json new file mode 100644 index 000000000..077b8bf7d --- /dev/null +++ b/release/lts/alpine39/meta.json @@ -0,0 +1,14 @@ +{ + "IsLinux" : true, + "UseLinuxVersion": false, + "PackageFormat": "powershell-${PS_VERSION}-linux-alpine-x64.tar.gz", + "osVersion": "Alpine", + "tagTemplates": [ + "lts-alpine-#shorttag#" + ], + "SkipGssNtlmSspTests": true, + "SubImage": "test-deps", + "TestProperties": { + "size": 165 + } +} diff --git a/release/lts/alpine39/test-deps/docker/Dockerfile b/release/lts/alpine39/test-deps/docker/Dockerfile new file mode 100644 index 000000000..94637a9f1 --- /dev/null +++ b/release/lts/alpine39/test-deps/docker/Dockerfile @@ -0,0 +1,60 @@ +# Docker image file that describes an Alpine image with PowerShell and test dependencies + +ARG BaseImage=mcr.microsoft.com/powershell:alpine-3.9 + +FROM node:10.15.3-alpine as node + +# Do nothing, just added to borrow the already built node files. + +FROM ${BaseImage} + +ARG fromTag=3.9 + +ENV NODE_VERSION=10.15.3 \ + YARN_VERSION=1.13.0 \ + NVM_DIR="/root/.nvm" \ + POWERSHELL_DISTRIBUTION_CHANNEL=PSDocker-TestDeps-Alpine-${fromTag} + +# 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 " \ + 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" ] diff --git a/release/lts/alpine39/test-deps/meta.json b/release/lts/alpine39/test-deps/meta.json new file mode 100644 index 000000000..5dec6e953 --- /dev/null +++ b/release/lts/alpine39/test-deps/meta.json @@ -0,0 +1,20 @@ +{ + "IsLinux" : true, + "UseLinuxVersion": false, + "SkipGssNtlmSspTests": true, + "osVersion": "Alpine ${fromTag}", + "tagTemplates": [ + "#tag#" + ], + "OptionalTests": [ + "test-deps", + "test-deps-musl" + ], + "TestProperties": { + "size": 212 + }, + "TagMapping": { + "^.*-alpine-3.9$" : "lts-alpine-3.9", + "^.*-alpine-3.10$" : "lts-alpine-3.10" + } +} diff --git a/release/lts/arm32v7/docker/Dockerfile b/release/lts/arm32v7/docker/Dockerfile new file mode 100644 index 000000000..f60c2b0e7 --- /dev/null +++ b/release/lts/arm32v7/docker/Dockerfile @@ -0,0 +1,95 @@ +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. + +ARG fromTag=bionic +ARG imageRepo=arm32v7/ubuntu + +FROM ${imageRepo}:${fromTag} AS installer-env + +ARG PS_VERSION=6.2.3 +ENV PS_PACKAGE=powershell-${PS_VERSION}-linux-arm32.tar.gz +ENV PS_PACKAGE_URL=https://github.com/PowerShell/PowerShell/releases/download/v${PS_VERSION}/${PS_PACKAGE} +ARG PS_INSTALL_VERSION=7-lts + +# 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} + +ARG PS_PACKAGE_URL_BASE64 + +RUN apt-get update \ + && apt-get install --no-install-recommends ca-certificates wget --yes + +RUN echo 'in task' \ + && if [ -n "${PS_PACKAGE_URL_BASE64}" ]; then \ + echo 'using base64' \ + && export url=$(echo "${PS_PACKAGE_URL_BASE64}" | base64 --decode -);\ + else \ + echo 'using unencoded' \ + && export url="${PS_PACKAGE_URL}"; \ + fi \ + && echo "url: $url" \ + && wget -O /tmp/powershell.tar.gz "$url" \ + && echo 'task done' + +RUN ls -l /tmp/powershell.tar.gz + + # Unzip the Linux tar.gz +RUN tar zxf /tmp/powershell.tar.gz -C ${PS_INSTALL_FOLDER} + +FROM ${imageRepo}:${fromTag} AS final-image + +# Define Args and Env needed to create links +ARG PS_INSTALL_VERSION=7-lts +ARG PS_VERSION=6.2.3 + +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-arm32v7-Ubuntu-18.04 + +# Copy only the files we need from the previous stage +COPY --from=installer-env ["/opt/microsoft/powershell", "/opt/microsoft/powershell"] + + +RUN \ + apt-get update \ + && apt-get install --no-install-recommends ca-certificates libunwind8 libssl1.0 libicu60 less --yes + + # Give all user execute permissions and remove write permissions for others +RUN chmod a+x,o-w ${PS_INSTALL_FOLDER}/pwsh \ + # 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 + +# Define args needed only for the labels +ARG VCS_REF="none" +ARG IMAGE_NAME=mcr.microsoft.com/powershell:arm32v7-ubuntu-bionic + +LABEL maintainer="PowerShell Team " \ + 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.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" + +# Use PowerShell as the default shell +# Use array to avoid Docker prepending /bin/sh -c +CMD [ "pwsh" ] diff --git a/release/lts/arm32v7/getLatestTag.ps1 b/release/lts/arm32v7/getLatestTag.ps1 new file mode 100644 index 000000000..f4574e134 --- /dev/null +++ b/release/lts/arm32v7/getLatestTag.ps1 @@ -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 CentOS image on Docker + +# The versions of CentOS we care about +$shortTags = @('bionic') + +$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 "arm32v7/ubuntu" -FullTagFilter '^bionic-\d{8}$' -AlternativeShortTag '18.04' diff --git a/release/lts/arm32v7/meta.json b/release/lts/arm32v7/meta.json new file mode 100644 index 000000000..04ec4545c --- /dev/null +++ b/release/lts/arm32v7/meta.json @@ -0,0 +1,16 @@ +{ + "IsLinux" : true, + "UseLinuxVersion": false, + "PackageFormat": "powershell-${PS_VERSION}-linux-arm32.tar.gz", + "osVersion": "Ubuntu 18.04 ARM 32v7", + "SkipGssNtlmSspTests": true, + "Base64EncodePackageUrl": true, + "UseAcr": true, + "tagTemplates": [ + "lts-arm32v7-ubuntu-#shorttag#" + ], + "TestProperties": { + "size": 550, + "Arm32": true + } +} diff --git a/release/stable/fedora28/docker/Dockerfile b/release/lts/centos7/docker/Dockerfile similarity index 73% rename from release/stable/fedora28/docker/Dockerfile rename to release/lts/centos7/docker/Dockerfile index 1f7d6c64c..ff1f845ff 100644 --- a/release/stable/fedora28/docker/Dockerfile +++ b/release/lts/centos7/docker/Dockerfile @@ -1,33 +1,39 @@ -# Docker image file that describes Fedora 28 image with PowerShell installed from Microsoft YUM Repo -ARG fromTag=28 -ARG imageRepo=fedora +# Docker image file that describes an CentOS7 image with PowerShell installed from Microsoft YUM Repo +ARG fromTag=7 +ARG imageRepo=centos FROM ${imageRepo}:${fromTag} AS installer-env -ARG PS_VERSION=6.2.0 -ARG PS_PACKAGE=powershell-${PS_VERSION}-1.rhel.7.x86_64.rpm +ARG PS_VERSION=7.0.0 +ARG PACKAGE_VERSION=7.0.0 +ARG PS_PACKAGE=powershell-lts-${PACKAGE_VERSION}-1.rhel.7.x86_64.rpm ARG PS_PACKAGE_URL=https://github.com/PowerShell/PowerShell/releases/download/v${PS_VERSION}/${PS_PACKAGE} +ARG fromTag=7 +ARG imageRepo=centos + # Define ENVs for Localization/Globalization ENV 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 + PSModuleAnalysisCachePath=/var/cache/microsoft/powershell/PSModuleAnalysisCache/ModuleAnalysisCache \ + POWERSHELL_DISTRIBUTION_CHANNEL=PSDocker-CentOS-${fromTag} # Install dependencies and clean up RUN curl -sSL ${PS_PACKAGE_URL} -o /tmp/powershell.rpm \ - && dnf install -y /tmp/powershell.rpm \ - && dnf install -y \ - # less is needed for help - less \ - # Needed to run localdef - glibc-locale-source \ - # Invoke-WebRequest doesn't work correctly without this - compat-openssl10 \ - gssntlmssp \ - && dnf upgrade-minimal -y --security \ - && dnf clean all \ + && yum install -y /tmp/powershell.rpm \ + # Required for gssntlmssp + && yum install -y epel-release \ + # Update now that we have epel-release + && yum update -y \ + # Install libraries for NTLM support + && yum install -y \ + gssntlmssp \ + # less is required for help in powershell + less \ + && yum upgrade-minimal -y --security \ + && yum clean all \ && localedef --charmap=UTF-8 --inputfile=en_US $LANG \ # remove powershell package && rm /tmp/powershell.rpm \ @@ -45,7 +51,7 @@ RUN curl -sSL ${PS_PACKAGE_URL} -o /tmp/powershell.rpm \ # Define args needed only for the labels ARG VCS_REF="none" -ARG IMAGE_NAME=mcr.microsoft.com/powershell:fedora28 +ARG IMAGE_NAME=mcr.microsoft.com/powershell:centos-7 LABEL maintainer="PowerShell Team " \ readme.md="https://github.com/PowerShell/PowerShell/blob/master/docker/README.md" \ diff --git a/release/preview/opensuse423/getLatestTag.ps1 b/release/lts/centos7/getLatestTag.ps1 similarity index 57% rename from release/preview/opensuse423/getLatestTag.ps1 rename to release/lts/centos7/getLatestTag.ps1 index 9d3cfb58f..daaac1cc9 100644 --- a/release/preview/opensuse423/getLatestTag.ps1 +++ b/release/lts/centos7/getLatestTag.ps1 @@ -1,14 +1,14 @@ # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. -# return objects representing the tags we need to base the opensuse image on Docker +# return objects representing the tags we need to base the CentOS image on Docker -# The versions of opensuse we care about -$shortTags = @('42.3') +# The versions of CentOS we care about +$shortTags = @('7') $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 "opensuse/leap" -FullTagFilter '^42\.3$' -OnlyShortTags +Get-DockerTags -ShortTags $shortTags -Image "centos" -FullTagFilter '^7$' -OnlyShortTags diff --git a/release/lts/centos7/meta.json b/release/lts/centos7/meta.json new file mode 100644 index 000000000..cac25f71f --- /dev/null +++ b/release/lts/centos7/meta.json @@ -0,0 +1,13 @@ +{ + "IsLinux" : true, + "UseLinuxVersion": false, + "PackageFormat": "powershell-lts-${PS_VERSION}-1.rhel.7.x86_64.rpm", + "osVersion": "CentOS 7", + "tagTemplates": [ + "lts-centos-#shorttag#" + ], + "SubImage": "test-deps", + "TestProperties": { + "size": 550 + } +} diff --git a/release/preview/opensuse423/test-deps/docker/Dockerfile b/release/lts/centos7/test-deps/docker/Dockerfile similarity index 68% rename from release/preview/opensuse423/test-deps/docker/Dockerfile rename to release/lts/centos7/test-deps/docker/Dockerfile index 8e71e61d6..5b9e2fc53 100644 --- a/release/preview/opensuse423/test-deps/docker/Dockerfile +++ b/release/lts/centos7/test-deps/docker/Dockerfile @@ -1,28 +1,21 @@ -# Docker image file that describes an OpenSuse 42.3image with PowerShell installed and Test Dependecies -ARG BaseImage=mcr.microsoft.com/powershell:opensuse-42.3 +# Docker image file that describes an CentOS7 image with PowerShell installed from Microsoft YUM Repo +ARG BaseImage=mcr.microsoft.com/powershell:centos-7 FROM ${BaseImage} -ARG fromTag=42.3 - # Install dependencies and clean up -RUN zypper --non-interactive update --skip-interactive \ - && zypper --non-interactive install \ - sudo \ - tar \ - curl \ - wget \ - hostname \ - # clean package manager cache - && zypper clean -a \ - # remove package manager log file - && rm -f /var/log/zypp/history /var/log/zypper.log +RUN yum install -y \ + sudo \ + wget \ + openssl \ + && yum clean all \ + && rm -rf /var/cache/yum -ENV POWERSHELL_DISTRIBUTION_CHANNEL=PSDocker-TestDeps-OpenSUSE-${fromTag} +ENV POWERSHELL_DISTRIBUTION_CHANNEL=PSDocker-TestDeps-CentOS-7 # Define args needed only for the labels ARG VCS_REF="none" -ARG IMAGE_NAME=mcr.microsoft.com/powershell/test-deps:centos7 +ARG IMAGE_NAME=mcr.microsoft.com/powershell/test-deps:centos-7 ARG PS_VERSION=6.2.3 LABEL maintainer="PowerShell Team " \ diff --git a/release/stable/fedora28/test-deps/meta.json b/release/lts/centos7/test-deps/meta.json similarity index 63% rename from release/stable/fedora28/test-deps/meta.json rename to release/lts/centos7/test-deps/meta.json index 11e335e85..67a1db271 100644 --- a/release/stable/fedora28/test-deps/meta.json +++ b/release/lts/centos7/test-deps/meta.json @@ -1,16 +1,15 @@ { "IsLinux" : true, "UseLinuxVersion": false, - "osVersion": "Fedora 28", - "SkipGssNtlmSspTests": false, + "osVersion": "CentOS 7", "tagTemplates": [ - "fedora-#shorttag#" + "lts-centos-#shorttag#" ], "SubRepository": "test-deps", "OptionalTests": [ "test-deps" ], "TestProperties": { - "size": 602 + "size": 575 } } diff --git a/release/lts/centos8/dependabot/Dockerfile b/release/lts/centos8/dependabot/Dockerfile new file mode 100644 index 000000000..5bd787a7a --- /dev/null +++ b/release/lts/centos8/dependabot/Dockerfile @@ -0,0 +1,6 @@ +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. + +# Dummy docker image to trigger dependabot PRs + +FROM centos:8 diff --git a/release/lts/centos8/docker/Dockerfile b/release/lts/centos8/docker/Dockerfile new file mode 100644 index 000000000..314e476b1 --- /dev/null +++ b/release/lts/centos8/docker/Dockerfile @@ -0,0 +1,75 @@ +# Docker image file that describes an CentOS7 image with PowerShell installed from Microsoft YUM Repo +ARG fromTag=8 +ARG imageRepo=centos + +FROM ${imageRepo}:${fromTag} AS installer-env + +ARG PS_VERSION=7.0.0 +ARG PACKAGE_VERSION=7.0.0 +ARG PS_PACKAGE=powershell-lts-${PACKAGE_VERSION}-1.rhel.7.x86_64.rpm +ARG PS_PACKAGE_URL=https://github.com/PowerShell/PowerShell/releases/download/v${PS_VERSION}/${PS_PACKAGE} + +ARG fromTag=7 +ARG imageRepo=centos + +# Define ENVs for Localization/Globalization +ENV 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-CentOS-${fromTag} + +# Install dependencies and clean up +RUN curl -sSL ${PS_PACKAGE_URL} -o /tmp/powershell.rpm \ + && yum install -y /tmp/powershell.rpm \ + # Required for gssntlmssp + && yum install -y epel-release \ + # Update now that we have epel-release + && yum update -y \ + # Install libraries for NTLM support + && yum install -y \ + gssntlmssp \ + # less is required for help in powershell + less \ + # clear is part of ncurses which is used by clear + ncurses \ + && yum upgrade-minimal -y --security \ + && yum clean all \ + # remove powershell package + && rm /tmp/powershell.rpm \ + # 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 VCS_REF="none" +ARG IMAGE_NAME=mcr.microsoft.com/powershell:centos-7 + +LABEL maintainer="PowerShell Team " \ + 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.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" + +# Use PowerShell as the default shell +# Use array to avoid Docker prepending /bin/sh -c +CMD [ "pwsh" ] diff --git a/release/lts/centos8/getLatestTag.ps1 b/release/lts/centos8/getLatestTag.ps1 new file mode 100644 index 000000000..9f6c243eb --- /dev/null +++ b/release/lts/centos8/getLatestTag.ps1 @@ -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 CentOS image on Docker + +# The versions of CentOS we care about +$shortTags = @('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 "centos" -FullTagFilter '^8$' -OnlyShortTags diff --git a/release/lts/centos8/meta.json b/release/lts/centos8/meta.json new file mode 100644 index 000000000..5b7ad3499 --- /dev/null +++ b/release/lts/centos8/meta.json @@ -0,0 +1,13 @@ +{ + "IsLinux" : true, + "UseLinuxVersion": false, + "PackageFormat": "powershell-lts-${PS_VERSION}-1.rhel.7.x86_64.rpm", + "osVersion": "CentOS 8", + "tagTemplates": [ + "lts-centos-#shorttag#" + ], + "SubImage": "test-deps", + "TestProperties": { + "size": 550 + } +} diff --git a/release/lts/centos8/test-deps/docker/Dockerfile b/release/lts/centos8/test-deps/docker/Dockerfile new file mode 100644 index 000000000..5b9e2fc53 --- /dev/null +++ b/release/lts/centos8/test-deps/docker/Dockerfile @@ -0,0 +1,39 @@ +# Docker image file that describes an CentOS7 image with PowerShell installed from Microsoft YUM Repo +ARG BaseImage=mcr.microsoft.com/powershell:centos-7 + +FROM ${BaseImage} + +# Install dependencies and clean up +RUN yum install -y \ + sudo \ + wget \ + openssl \ + && yum clean all \ + && rm -rf /var/cache/yum + +ENV POWERSHELL_DISTRIBUTION_CHANNEL=PSDocker-TestDeps-CentOS-7 + +# Define args needed only for the labels +ARG VCS_REF="none" +ARG IMAGE_NAME=mcr.microsoft.com/powershell/test-deps:centos-7 +ARG PS_VERSION=6.2.3 + +LABEL maintainer="PowerShell Team " \ + 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" + +# Use PowerShell as the default shell +# Use array to avoid Docker prepending /bin/sh -c +CMD [ "pwsh" ] diff --git a/release/preview/opensuse423/test-deps/meta.json b/release/lts/centos8/test-deps/meta.json similarity index 61% rename from release/preview/opensuse423/test-deps/meta.json rename to release/lts/centos8/test-deps/meta.json index a42c27582..823ef03c1 100644 --- a/release/preview/opensuse423/test-deps/meta.json +++ b/release/lts/centos8/test-deps/meta.json @@ -1,16 +1,15 @@ { "IsLinux" : true, "UseLinuxVersion": false, - "osVersion": "OpenSuse 42.3", - "SkipGssNtlmSspTests": true, + "osVersion": "CentOS 8", "tagTemplates": [ - "preview-opensuse-#shorttag#" + "lts-centos-#shorttag#" ], "SubRepository": "test-deps", "OptionalTests": [ "test-deps" ], "TestProperties": { - "size": 536 + "size": 575 } } diff --git a/release/lts/debian10/dependabot/Dockerfile b/release/lts/debian10/dependabot/Dockerfile new file mode 100644 index 000000000..934a2d9c0 --- /dev/null +++ b/release/lts/debian10/dependabot/Dockerfile @@ -0,0 +1,6 @@ +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. + +# Dummy docker image to trigger dependabot PRs + +FROM debian:10 diff --git a/release/preview/opensuse423/docker/Dockerfile b/release/lts/debian10/docker/Dockerfile similarity index 67% rename from release/preview/opensuse423/docker/Dockerfile rename to release/lts/debian10/docker/Dockerfile index 287c8d157..2480a256b 100644 --- a/release/preview/opensuse423/docker/Dockerfile +++ b/release/lts/debian10/docker/Dockerfile @@ -1,19 +1,17 @@ -# Docker image file that describes an OpenSuse 42.3 image with PowerShell installed from tar.gz -# Implemented in two stages, one that downloads and uncompresses the tar.gz -# The next stage simply copies the files from the first stage, -# effectively removing the tar.gz and packages that are not needed from the final image. - -# Define arg(s) needed for the From statement -ARG fromTag=42.3 -ARG imageRepo=opensuse/leap +# Docker image file that describes an Debian image with PowerShell installed from Microsoft APT Repo +ARG fromTag=buster-slim +ARG imageRepo=debian FROM ${imageRepo}:${fromTag} AS installer-env # Define Args for the needed to add the package -ARG PS_VERSION=7.0.0-rc.1 +ARG PS_VERSION=6.2.3 ARG PS_PACKAGE=powershell-${PS_VERSION}-linux-x64.tar.gz ARG PS_PACKAGE_URL=https://github.com/PowerShell/PowerShell/releases/download/v${PS_VERSION}/${PS_PACKAGE} -ARG PS_INSTALL_VERSION=7-preview +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 @@ -21,29 +19,20 @@ ENV PS_INSTALL_FOLDER=/opt/microsoft/powershell/$PS_INSTALL_VERSION # Create the install folder RUN mkdir -p ${PS_INSTALL_FOLDER} -# Install dependencies -RUN zypper --non-interactive update --skip-interactive - -RUN zypper --non-interactive install \ - tar - -# Download the Linux tar.gz and save it -ADD ${PS_PACKAGE_URL} /tmp/linux.tar.gz - # Unzip the Linux tar.gz -RUN tar zxf /tmp/linux.tar.gz -C ${PS_INSTALL_FOLDER} -v +RUN tar zxf /tmp/linux.tar.gz -C ${PS_INSTALL_FOLDER} -# ------ Second stage ------ # Start a new stage so we lose all the tar.gz layers from the final image FROM ${imageRepo}:${fromTag} -ARG fromTag=42.3 +ARG PS_VERSION=7.0.0 +ARG PS_INSTALL_VERSION=7-lts # 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-preview +ARG PS_INSTALL_VERSION=7-lts ENV PS_INSTALL_FOLDER=/opt/microsoft/powershell/$PS_INSTALL_VERSION \ \ # Define ENVs for Localization/Globalization @@ -52,26 +41,40 @@ ENV PS_INSTALL_FOLDER=/opt/microsoft/powershell/$PS_INSTALL_VERSION \ 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-OpenSUSE-${fromTag} + POWERSHELL_DISTRIBUTION_CHANNEL=PSDocker-Debian-10 -# Install dependencies -RUN zypper --non-interactive update --skip-interactive \ - && zypper --non-interactive install \ - glibc-locale \ - glibc-i18ndata \ - libicu \ - openssl \ +# Install dependencies and clean up +RUN apt-get update \ + && apt-get install -y \ + # less is required for help in powershell less \ - && localedef --charmap=UTF-8 --inputfile=en_US $LANG \ + # requied to setup the locale + locales \ + # required for SSL + ca-certificates \ + gss-ntlmssp \ + libicu63 \ + libssl1.1 \ + libc6 \ + libgcc1 \ + libgssapi-krb5-2 \ + liblttng-ust0 \ + libstdc++6 \ + zlib1g \ + && apt-get dist-upgrade -y \ + && apt-get clean \ + && rm -rf /var/lib/apt/lists/* \ + # enable en_US.UTF-8 locale + && sed -i 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/g' /etc/locale.gen \ + # generate locale + && locale-gen && update-locale + + # Give all user execute permissions and remove write permissions for others +RUN chmod a+x,o-w ${PS_INSTALL_FOLDER}/pwsh \ # Create the pwsh symbolic link that points to powershell && ln -s ${PS_INSTALL_FOLDER}/pwsh /usr/bin/pwsh \ - && ln -sf ${PS_INSTALL_FOLDER}/pwsh /usr/bin/pwsh-preview \ - # Give all user execute permissions and remove write permissions for others - && chmod a+x,o-w ${PS_INSTALL_FOLDER}/pwsh \ - # clean package manager cache - && zypper clean -a \ - # remove package manager log file - && rm -f /var/log/zypp/history /var/log/zypper.log \ + # Create the pwsh-lts symbolic link that points to powershell + && ln -s ${PS_INSTALL_FOLDER}/pwsh /usr/bin/pwsh-lts \ # intialize powershell module cache && pwsh \ -NoLogo \ @@ -85,11 +88,9 @@ RUN zypper --non-interactive update --skip-interactive \ }" # Define args needed only for the labels -ARG PS_VERSION=6.2.0-preview.3 -ARG IMAGE_NAME=mcr.microsoft.com/powershell:opensuse-42.3 ARG VCS_REF="none" +ARG IMAGE_NAME=mcr.microsoft.com/powershell:debian-10 -# Add label last as it's just metadata and uses a lot of parameters LABEL maintainer="PowerShell Team " \ readme.md="https://github.com/PowerShell/PowerShell/blob/master/docker/README.md" \ description="This Dockerfile will install the latest release of PowerShell." \ @@ -98,12 +99,14 @@ LABEL maintainer="PowerShell Team " \ 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.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" +# Use PowerShell as the default shell +# Use array to avoid Docker prepending /bin/sh -c CMD [ "pwsh" ] diff --git a/release/lts/debian10/getLatestTag.ps1 b/release/lts/debian10/getLatestTag.ps1 new file mode 100644 index 000000000..f262fed60 --- /dev/null +++ b/release/lts/debian10/getLatestTag.ps1 @@ -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 debian image on Docker + +# The versions of debian we care about +$shortTags = @('buster-slim') + +$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 "debian" -FullTagFilter 'buster-\d{8}[\.\d{1}]?-slim' -AlternativeShortTag '10' -SkipShortTagFilter diff --git a/release/lts/debian10/meta.json b/release/lts/debian10/meta.json new file mode 100644 index 000000000..7efa5faf4 --- /dev/null +++ b/release/lts/debian10/meta.json @@ -0,0 +1,15 @@ +{ + "IsLinux" : true, + "UseLinuxVersion" : false, + "PackageFormat": "powershell-${PS_VERSION}-linux-x64.tar.gz", + "osVersion": "Debian 10", + "SkipGssNtlmSspTests": false, + "tagTemplates": [ + "lts-debian-#shorttag#" + ], + "SubImage": "test-deps", + "TestProperties": { + "size": 314 + } +} + diff --git a/release/lts/debian10/test-deps/docker/Dockerfile b/release/lts/debian10/test-deps/docker/Dockerfile new file mode 100644 index 000000000..35918f757 --- /dev/null +++ b/release/lts/debian10/test-deps/docker/Dockerfile @@ -0,0 +1,43 @@ +# Docker image file that describes an Debian image with PowerShell and test dependencies +ARG BaseImage=mcr.microsoft.com/powershell:debian-10 + +FROM ${BaseImage} + +# Install dependencies and clean up +RUN apt-get update \ + && apt-get install -y \ + sudo \ + curl \ + wget \ + iputils-ping \ + iputils-tracepath \ + procps \ + && apt-get clean \ + && rm -rf /var/lib/apt/lists/* + +ENV POWERSHELL_DISTRIBUTION_CHANNEL=PSDocker-TestDeps-Debian-10 + +# Define args needed only for the labels +ARG VCS_REF="none" +ARG IMAGE_NAME=mcr.microsoft.com/powershell/test-deps:debian-9 +ARG PS_VERSION=6.2.3 + +LABEL maintainer="PowerShell Team " \ + 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" + +# Use PowerShell as the default shell +# Use array to avoid Docker prepending /bin/sh -c +CMD [ "pwsh" ] diff --git a/release/lts/debian10/test-deps/meta.json b/release/lts/debian10/test-deps/meta.json new file mode 100644 index 000000000..48822372d --- /dev/null +++ b/release/lts/debian10/test-deps/meta.json @@ -0,0 +1,16 @@ +{ + "IsLinux" : true, + "UseLinuxVersion": false, + "osVersion": "Debian 10", + "tagTemplates": [ + "lts-debian-#shorttag#" + ], + "SubRepository": "test-deps", + "OptionalTests": [ + "test-deps", + "test-deps-debian" + ], + "TestProperties": { + "size": 316 + } +} diff --git a/release/lts/debian11/dependabot/Dockerfile b/release/lts/debian11/dependabot/Dockerfile new file mode 100644 index 000000000..8a60bc3b0 --- /dev/null +++ b/release/lts/debian11/dependabot/Dockerfile @@ -0,0 +1,6 @@ +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. + +# Dummy docker image to trigger dependabot PRs + +FROM debian:11 diff --git a/release/lts/debian11/docker/Dockerfile b/release/lts/debian11/docker/Dockerfile new file mode 100644 index 000000000..21dcfb135 --- /dev/null +++ b/release/lts/debian11/docker/Dockerfile @@ -0,0 +1,112 @@ +# Docker image file that describes an Debian image with PowerShell installed from Microsoft APT Repo +ARG fromTag=bullseye-slim +ARG imageRepo=debian + +FROM ${imageRepo}:${fromTag} AS installer-env + +# Define Args for the needed to add the package +ARG PS_VERSION=6.2.3 +ARG PS_PACKAGE=powershell-${PS_VERSION}-linux-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} + +# Start a new stage so we lose all the tar.gz layers from the final image +FROM ${imageRepo}:${fromTag} + +ARG PS_VERSION=7.0.0 +ARG PS_INSTALL_VERSION=7-lts + +# 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-Debian-11 + +# Install dependencies and clean up +RUN apt-get update \ + && apt-get install -y \ + # less is required for help in powershell + less \ + # requied to setup the locale + locales \ + # required for SSL + ca-certificates \ + gss-ntlmssp \ + libicu63 \ + libssl1.1 \ + libc6 \ + libgcc1 \ + libgssapi-krb5-2 \ + liblttng-ust0 \ + libstdc++6 \ + zlib1g \ + && apt-get dist-upgrade -y \ + && apt-get clean \ + && rm -rf /var/lib/apt/lists/* \ + # enable en_US.UTF-8 locale + && sed -i 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/g' /etc/locale.gen \ + # generate locale + && locale-gen && update-locale + + # Give all user execute permissions and remove write permissions for others +RUN chmod a+x,o-w ${PS_INSTALL_FOLDER}/pwsh \ + # 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 \ + # 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 VCS_REF="none" +ARG IMAGE_NAME=mcr.microsoft.com/powershell:debian-11 + +LABEL maintainer="PowerShell Team " \ + 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.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" + +# Use PowerShell as the default shell +# Use array to avoid Docker prepending /bin/sh -c +CMD [ "pwsh" ] diff --git a/release/lts/debian11/getLatestTag.ps1 b/release/lts/debian11/getLatestTag.ps1 new file mode 100644 index 000000000..f19797bb9 --- /dev/null +++ b/release/lts/debian11/getLatestTag.ps1 @@ -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 debian image on Docker + +# The versions of debian we care about +$shortTags = @('bullseye-slim') + +$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 "debian" -FullTagFilter 'bullseye-\d{8}[\.\d{1}]?-slim' -AlternativeShortTag '11' -SkipShortTagFilter diff --git a/release/lts/debian11/meta.json b/release/lts/debian11/meta.json new file mode 100644 index 000000000..f0b024143 --- /dev/null +++ b/release/lts/debian11/meta.json @@ -0,0 +1,15 @@ +{ + "IsLinux" : true, + "UseLinuxVersion" : false, + "PackageFormat": "powershell-${PS_VERSION}-linux-x64.tar.gz", + "osVersion": "Debian 11 (Testing)", + "SkipGssNtlmSspTests": false, + "tagTemplates": [ + "lts-debian-#shorttag#" + ], + "SubImage": "test-deps", + "TestProperties": { + "size": 314 + } +} + diff --git a/release/lts/debian11/test-deps/docker/Dockerfile b/release/lts/debian11/test-deps/docker/Dockerfile new file mode 100644 index 000000000..af918cf6e --- /dev/null +++ b/release/lts/debian11/test-deps/docker/Dockerfile @@ -0,0 +1,43 @@ +# Docker image file that describes an Debian image with PowerShell and test dependencies +ARG BaseImage=mcr.microsoft.com/powershell:debian-11 + +FROM ${BaseImage} + +# Install dependencies and clean up +RUN apt-get update \ + && apt-get install -y \ + sudo \ + curl \ + wget \ + iputils-ping \ + iputils-tracepath \ + procps \ + && apt-get clean \ + && rm -rf /var/lib/apt/lists/* + +ENV POWERSHELL_DISTRIBUTION_CHANNEL=PSDocker-TestDeps-Debian-11 + +# Define args needed only for the labels +ARG VCS_REF="none" +ARG IMAGE_NAME=mcr.microsoft.com/powershell/test-deps:debian-11 +ARG PS_VERSION=6.2.3 + +LABEL maintainer="PowerShell Team " \ + 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" + +# Use PowerShell as the default shell +# Use array to avoid Docker prepending /bin/sh -c +CMD [ "pwsh" ] diff --git a/release/lts/debian11/test-deps/meta.json b/release/lts/debian11/test-deps/meta.json new file mode 100644 index 000000000..05b99bc75 --- /dev/null +++ b/release/lts/debian11/test-deps/meta.json @@ -0,0 +1,16 @@ +{ + "IsLinux" : true, + "UseLinuxVersion": false, + "osVersion": "Debian 11 (Testing)", + "tagTemplates": [ + "lts-debian-#shorttag#" + ], + "SubRepository": "test-deps", + "OptionalTests": [ + "test-deps", + "test-deps-debian" + ], + "TestProperties": { + "size": 316 + } +} diff --git a/release/lts/debian9/docker/Dockerfile b/release/lts/debian9/docker/Dockerfile new file mode 100644 index 000000000..0dbaf77f9 --- /dev/null +++ b/release/lts/debian9/docker/Dockerfile @@ -0,0 +1,78 @@ +# Docker image file that describes an Debian 9 image with PowerShell installed from Microsoft APT Repo +ARG fromTag=stretch-slim +ARG imageRepo=debian + +FROM ${imageRepo}:${fromTag} AS installer-env + +ARG PS_VERSION=7.0.0 +ARG PS_PACKAGE=powershell-lts_${PS_VERSION}-1.debian.9_amd64.deb +ARG PS_PACKAGE_URL=https://github.com/PowerShell/PowerShell/releases/download/v${PS_VERSION}/${PS_PACKAGE} + +# Define ENVs for Localization/Globalization +ENV 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-Debian-9 + +# Install dependencies and clean up +RUN apt-get update \ + && apt-get install -y \ + # curl is required to grab the Linux package + curl \ + # less is required for help in powershell + less \ + # requied to setup the locale + locales \ + # required for SSL + ca-certificates \ + gss-ntlmssp \ + # Download the Linux package and save it + && echo ${PS_PACKAGE_URL} \ + && curl -sSL ${PS_PACKAGE_URL} -o /tmp/powershell.deb \ + && apt-get install -y /tmp/powershell.deb \ + && apt-get dist-upgrade -y \ + && apt-get clean \ + && rm -rf /var/lib/apt/lists/* \ + # enable en_US.UTF-8 locale + && sed -i 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/g' /etc/locale.gen \ + # generate locale + && locale-gen && update-locale \ + # remove powershell package + && rm /tmp/powershell.deb \ + # 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 VCS_REF="none" +ARG IMAGE_NAME=mcr.microsoft.com/powershell:debian-9 + +LABEL maintainer="PowerShell Team " \ + 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.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" + +# Use PowerShell as the default shell +# Use array to avoid Docker prepending /bin/sh -c +CMD [ "pwsh" ] diff --git a/release/lts/debian9/getLatestTag.ps1 b/release/lts/debian9/getLatestTag.ps1 new file mode 100644 index 000000000..4ceee128f --- /dev/null +++ b/release/lts/debian9/getLatestTag.ps1 @@ -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 debian image on Docker + +# The versions of debian we care about +$shortTags = @('stretch-slim') + +$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 "debian" -FullTagFilter 'stretch-\d{8}[\.\d{1}]?-slim' -AlternativeShortTag '9' -SkipShortTagFilter diff --git a/release/lts/debian9/meta.json b/release/lts/debian9/meta.json new file mode 100644 index 000000000..b57a2014b --- /dev/null +++ b/release/lts/debian9/meta.json @@ -0,0 +1,14 @@ +{ + "IsLinux" : true, + "UseLinuxVersion" : false, + "PackageFormat": "powershell-lts_${PS_VERSION}-1.debian.9_amd64.deb", + "osVersion": "Debian 9", + "SkipGssNtlmSspTests": false, + "tagTemplates": [ + "lts-debian-#shorttag#" + ], + "SubImage": "test-deps", + "TestProperties": { + "size": 314 + } +} diff --git a/release/lts/debian9/test-deps/docker/Dockerfile b/release/lts/debian9/test-deps/docker/Dockerfile new file mode 100644 index 000000000..0abc4fc86 --- /dev/null +++ b/release/lts/debian9/test-deps/docker/Dockerfile @@ -0,0 +1,43 @@ +# Docker image file that describes an Debian 9image with PowerShell and test dependencies +ARG BaseImage=mcr.microsoft.com/powershell:debian-9 + +FROM ${BaseImage} + +# Install dependencies and clean up +RUN apt-get update \ + && apt-get install -y \ + sudo \ + curl \ + wget \ + iputils-ping \ + iputils-tracepath \ + procps \ + && apt-get clean \ + && rm -rf /var/lib/apt/lists/* + +ENV POWERSHELL_DISTRIBUTION_CHANNEL=PSDocker-TestDeps-Debian-9 + +# Define args needed only for the labels +ARG VCS_REF="none" +ARG IMAGE_NAME=mcr.microsoft.com/powershell/test-deps:debian-9 +ARG PS_VERSION=6.2.3 + +LABEL maintainer="PowerShell Team " \ + 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" + +# Use PowerShell as the default shell +# Use array to avoid Docker prepending /bin/sh -c +CMD [ "pwsh" ] diff --git a/release/lts/debian9/test-deps/meta.json b/release/lts/debian9/test-deps/meta.json new file mode 100644 index 000000000..3e5edb741 --- /dev/null +++ b/release/lts/debian9/test-deps/meta.json @@ -0,0 +1,16 @@ +{ + "IsLinux" : true, + "UseLinuxVersion": false, + "osVersion": "Debian 9", + "tagTemplates": [ + "lts-debian-#shorttag#" + ], + "SubRepository": "test-deps", + "OptionalTests": [ + "test-deps", + "test-deps-debian" + ], + "TestProperties": { + "size": 316 + } +} diff --git a/release/lts/fedora/dependabot/Dockerfile b/release/lts/fedora/dependabot/Dockerfile new file mode 100644 index 000000000..2b4d6bd3e --- /dev/null +++ b/release/lts/fedora/dependabot/Dockerfile @@ -0,0 +1,6 @@ +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. + +# Dummy docker image to trigger dependabot PRs + +FROM fedora:30 diff --git a/release/lts/fedora/docker/Dockerfile b/release/lts/fedora/docker/Dockerfile new file mode 100644 index 000000000..0c4d7c716 --- /dev/null +++ b/release/lts/fedora/docker/Dockerfile @@ -0,0 +1,110 @@ +# Docker image file that describes Fedora 28 image with PowerShell installed from Microsoft YUM Repo +ARG fromTag=28 +ARG imageRepo=fedora + +FROM ${imageRepo}:${fromTag} AS installer-env + +ARG PS_VERSION=7.0.0 +ARG PACKAGE_VERSION=7.0.0 +ARG PS_PACKAGE=powershell-lts-${PACKAGE_VERSION}-1.rhel.7.x86_64.rpm +ARG PS_PACKAGE_URL=https://github.com/PowerShell/PowerShell/releases/download/v${PS_VERSION}/${PS_PACKAGE} + +ARG fromTag=28 + +# Define ENVs for Localization/Globalization +ENV 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-Fedora-${fromTag} + +# Install dependencies and clean up +RUN curl -sSL ${PS_PACKAGE_URL} -o /tmp/powershell.rpm \ + && dnf install -y /tmp/powershell.rpm \ + # remove powershell package + && rm /tmp/powershell.rpm \ + && echo "starting misc packages" \ + && dnf install -y \ + # less is needed for help + less \ + # Needed to run localdef + glibc-locale-source \ + # Invoke-WebRequest doesn't work correctly without this + compat-openssl10 \ + ca-certificates \ + gssntlmssp \ + && echo "end - misc packages" \ + && echo "starting FEDORA-2019-27e7b92407" \ + # For whatever reason FEDORA-2019-27e7b92407 has to be patched manually + # to do this, upgrade libmodulemd1, if it is installed + && pwsh \ + -NoLogo \ + -NoProfile \ + -Command " \ + try { \$packageList = dnf list installed libmodulemd1} \ + catch {}; \ + \$module = (\$packageList | Select-String -SimpleMatch libmodulemd1); \ + if(\$module) { \ + Write-Host '******* Patching *********'; \ + dnf upgrade -y libmodulemd1 \ + }" \ + && echo "end - FEDORA-2019-27e7b92407" \ + # This installs most security advisories + && echo "starting upgrade minimal" \ + && dnf upgrade-minimal -y --security \ + && echo "end - upgrade minimal" \ + # query and install any remaining security advisories + && pwsh \ + -NoLogo \ + -NoProfile \ + -Command " \ + Write-Host '******* Getting security advisory list *********'; \ + (dnf updateinfo list -q --security) | \ + Foreach-Object { \ + \$advisory=(\$_ -split ' ')[0]; \ + Write-Host '******* Patching *********'; \ + Write-Host \$advisory; \ + Write-Host '************************'; \ + dnf upgrade -y --advisory=\$advisory \ + }" \ + && echo "verifying all security advisories are installed..." \ + && dnf updateinfo list -q --security \ + && echo "end - verifying all security advisories are installed..." \ + && dnf clean all \ + && localedef --charmap=UTF-8 --inputfile=en_US $LANG \ + # 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 VCS_REF="none" +ARG IMAGE_NAME=mcr.microsoft.com/powershell:fedora28 + +LABEL maintainer="PowerShell Team " \ + 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.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" + +# Use PowerShell as the default shell +# Use array to avoid Docker prepending /bin/sh -c +CMD [ "pwsh" ] diff --git a/release/stable/fedora28/getLatestTag.ps1 b/release/lts/fedora/getLatestTag.ps1 similarity index 91% rename from release/stable/fedora28/getLatestTag.ps1 rename to release/lts/fedora/getLatestTag.ps1 index 5e8290dce..c9ad27d2d 100644 --- a/release/stable/fedora28/getLatestTag.ps1 +++ b/release/lts/fedora/getLatestTag.ps1 @@ -4,11 +4,11 @@ # return objects representing the tags we need to base the fedora image on # The versions of fedora we care about -$shortTags = @('28') +$shortTags = @('30') $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 "fedora" -FullTagFilter '^28$' -OnlyShortTags +Get-DockerTags -ShortTags $shortTags -Image "fedora" -FullTagFilter '^\d{2}$' -OnlyShortTags diff --git a/release/lts/fedora/meta.json b/release/lts/fedora/meta.json new file mode 100644 index 000000000..2daa43419 --- /dev/null +++ b/release/lts/fedora/meta.json @@ -0,0 +1,14 @@ +{ + "IsLinux" : true, + "UseLinuxVersion": false, + "PackageFormat": "powershell-lts-${PS_VERSION}-1.rhel.7.x86_64.rpm", + "osVersion": "Fedora", + "SkipGssNtlmSspTests": false, + "tagTemplates": [ + "lts-fedora-#shorttag#" + ], + "SubImage": "test-deps", + "TestProperties": { + "size": 632 + } +} diff --git a/release/stable/fedora28/test-deps/docker/Dockerfile b/release/lts/fedora/test-deps/docker/Dockerfile similarity index 94% rename from release/stable/fedora28/test-deps/docker/Dockerfile rename to release/lts/fedora/test-deps/docker/Dockerfile index d5a9153ec..e0004d29a 100644 --- a/release/stable/fedora28/test-deps/docker/Dockerfile +++ b/release/lts/fedora/test-deps/docker/Dockerfile @@ -3,6 +3,8 @@ ARG BaseImage=mcr.microsoft.com/powershell:fedora-28 FROM ${BaseImage} +ARG fromTag=28 + # Install dependencies and clean up RUN dnf install -y \ sudo \ @@ -13,10 +15,12 @@ RUN dnf install -y \ procps-ng \ && dnf clean all +ENV POWERSHELL_DISTRIBUTION_CHANNEL=PSDocker-TestDeps-Fedora-${fromTag} + # Define args needed only for the labels ARG VCS_REF="none" ARG IMAGE_NAME=mcr.microsoft.com/powershell/test-deps:fedora-28 -ARG PS_VERSION=6.2.0 +ARG PS_VERSION=6.2.3 LABEL maintainer="PowerShell Team " \ readme.md="https://github.com/PowerShell/PowerShell/blob/master/docker/README.md" \ diff --git a/release/lts/fedora/test-deps/meta.json b/release/lts/fedora/test-deps/meta.json new file mode 100644 index 000000000..3a070f03e --- /dev/null +++ b/release/lts/fedora/test-deps/meta.json @@ -0,0 +1,19 @@ +{ + "IsLinux" : true, + "UseLinuxVersion": false, + "osVersion": "Fedora ${fromTag}", + "SkipGssNtlmSspTests": false, + "tagTemplates": [ + "#tag#" + ], + "SubRepository": "test-deps", + "OptionalTests": [ + "test-deps" + ], + "TestProperties": { + "size": 632 + }, + "TagMapping": { + "^.*-fedora-30$" : "lts-fedora-30" + } +} diff --git a/release/lts/nanoserver/docker/Dockerfile b/release/lts/nanoserver/docker/Dockerfile new file mode 100755 index 000000000..7feb50cfe --- /dev/null +++ b/release/lts/nanoserver/docker/Dockerfile @@ -0,0 +1,92 @@ +# escape=` +# Args used by from statements must be defined here: +ARG fromTag=1709 +ARG InstallerVersion=nanoserver +ARG InstallerRepo=mcr.microsoft.com/powershell +ARG NanoServerRepo=mcr.microsoft.com/windows/nanoserver + +# Use server core as an installer container to extract PowerShell, +# As this is a multi-stage build, this stage will eventually be thrown away +FROM ${InstallerRepo}:$InstallerVersion AS installer-env + +# Arguments for installing PowerShell, must be defined in the container they are used +ARG PS_VERSION=7.0.0-rc.1 + +ARG PS_PACKAGE_URL=https://github.com/PowerShell/PowerShell/releases/download/v$PS_VERSION/PowerShell-$PS_VERSION-win-x64.zip + +SHELL ["pwsh", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"] + +ARG PS_PACKAGE_URL_BASE64 + +RUN Write-host "Verifying valid Version..."; ` + if (!($env:PS_VERSION -match '^\d+\.\d+\.\d+(-\w+(\.\d+)?)?$' )) { ` + throw ('PS_Version ({0}) must match the regex "^\d+\.\d+\.\d+(-\w+(\.\d+)?)?$"' -f $env:PS_VERSION) ` + } ` + $ProgressPreference = 'SilentlyContinue'; ` + if($env:PS_PACKAGE_URL_BASE64){ ` + Write-host "decoding: $env:PS_PACKAGE_URL_BASE64" ;` + $url = [System.Text.Encoding]::Unicode.GetString([System.Convert]::FromBase64String($env:PS_PACKAGE_URL_BASE64)) ` + } else { ` + Write-host "using url: $env:PS_PACKAGE_URL" ;` + $url = $env:PS_PACKAGE_URL ` + } ` + Write-host "downloading: $url"; ` + [Net.ServicePointManager]::SecurityProtocol = [Net.ServicePointManager]::SecurityProtocol -bor [Net.SecurityProtocolType]::Tls12; ` + New-Item -ItemType Directory /installer > $null ; ` + Invoke-WebRequest -Uri $url -outfile /installer/powershell.zip -verbose; ` + Expand-Archive /installer/powershell.zip -DestinationPath \PowerShell + +# Install PowerShell into NanoServer +FROM ${NanoServerRepo}:${fromTag} + +ARG fromTag=1709 + +ARG VCS_REF="none" +ARG PS_VERSION=6.1.0-rc.1 +ARG IMAGE_NAME=mcr.microsoft.com/powershell + +# Copy PowerShell Core from the installer container +ENV ProgramFiles="C:\Program Files" ` + # set a fixed location for the Module analysis cache + LOCALAPPDATA="C:\Users\ContainerAdministrator\AppData\Local" ` + PSModuleAnalysisCachePath="$LOCALAPPDATA\Microsoft\Windows\PowerShell\docker\ModuleAnalysisCache" ` + # Persist %PSCORE% ENV variable for user convenience + PSCORE="$ProgramFiles\PowerShell\pwsh.exe" ` + POWERSHELL_DISTRIBUTION_CHANNEL="PSDocker-NanoServer-${fromTag}" + +COPY --from=installer-env ["\\PowerShell\\", "$ProgramFiles\\PowerShell"] + +# Set the path +RUN setx PATH "%PATH%;%ProgramFiles%\PowerShell;" + +# intialize powershell module cache +RUN pwsh ` + -NoLogo ` + -NoProfile ` + -Command " ` + $stopTime = (get-date).AddMinutes(15); ` + $ErrorActionPreference = 'Stop' ; ` + $ProgressPreference = 'SilentlyContinue' ; ` + while(!(Test-Path -Path $env:PSModuleAnalysisCachePath)) { ` + Write-Host "'Waiting for $env:PSModuleAnalysisCachePath'" ; ` + if((get-date) -gt $stopTime) { throw 'timout expired'} ` + Start-Sleep -Seconds 6 ; ` + }" + +LABEL maintainer="PowerShell Team " ` + 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.vcs-ref=${VCS_REF} ` + org.label-schema.vendor="PowerShell" ` + 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.exe"] diff --git a/release/lts/nanoserver/getLatestTag.ps1 b/release/lts/nanoserver/getLatestTag.ps1 new file mode 100644 index 000000000..7b8017d27 --- /dev/null +++ b/release/lts/nanoserver/getLatestTag.ps1 @@ -0,0 +1,30 @@ +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. + +# return objects representing the tags we need to base the nanoserver image on + + +param( + [Switch] + $CI, + # The versions of nanoserver we care about + [string[]] + $ShortTags +) + +$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 + +if(!$CI.IsPresent) +{ + Get-DockerTags -ShortTags $shortTags -Image "mcr.microsoft.com/windows/nanoserver" -FullTagFilter '\d{4}_KB\d{7}(_amd64)?$' -Mcr +} +else { + # This is not supported for nanoserver so don't build in production but try building it as a CI test for the Dockerfile + $shortTags = @('latest') + + # The \d{4,} part of the regex is because the API is returning tags which are 3 digits and older than the 4 digit tags + Get-DockerTags -ShortTags $shortTags -Image "mcr.microsoft.com/windows/nanoserver" -FullTagFilter '10\.0\.14393\.\d{4,}$' -SkipShortTagFilter -Mcr +} diff --git a/release/lts/nanoserver/meta.json b/release/lts/nanoserver/meta.json new file mode 100644 index 000000000..2eee0d0f9 --- /dev/null +++ b/release/lts/nanoserver/meta.json @@ -0,0 +1,16 @@ +{ + "IsLinux" : false, + "PackageFormat": "PowerShell-${PS_VERSION}-win-x64.zip", + "osVersion": "Nano Server, version ${fromTag}", + "shortTags": [ + {"Tag": "1803"} + ], + "tagTemplates": [ + "lts-nanoserver-#shorttag#" + ], + "Base64EncodePackageUrl": true, + "UseAcr": true, + "TestProperties": { + "size": 1 + } +} diff --git a/release/lts/nanoserver1809/dependabot/Dockerfile b/release/lts/nanoserver1809/dependabot/Dockerfile new file mode 100644 index 000000000..f5c61be5e --- /dev/null +++ b/release/lts/nanoserver1809/dependabot/Dockerfile @@ -0,0 +1,6 @@ +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. + +# Dummy docker image to trigger dependabot PRs + +FROM mcr.microsoft.com/windows/nanoserver:1903 diff --git a/release/lts/nanoserver1809/docker/Dockerfile b/release/lts/nanoserver1809/docker/Dockerfile new file mode 100755 index 000000000..c92e961e0 --- /dev/null +++ b/release/lts/nanoserver1809/docker/Dockerfile @@ -0,0 +1,105 @@ +# escape=` +# Args used by from statements must be defined here: +ARG fromTag=1709 +ARG InstallerVersion=nanoserver +ARG InstallerRepo=mcr.microsoft.com/powershell +ARG NanoServerRepo=mcr.microsoft.com/windows/nanoserver + +# Use server core as an installer container to extract PowerShell, +# As this is a multi-stage build, this stage will eventually be thrown away +FROM ${InstallerRepo}:$InstallerVersion AS installer-env + +# Arguments for installing PowerShell, must be defined in the container they are used +ARG PS_VERSION=7.0.0-rc.1 + +ARG PS_PACKAGE_URL=https://github.com/PowerShell/PowerShell/releases/download/v$PS_VERSION/PowerShell-$PS_VERSION-win-x64.zip + +SHELL ["pwsh", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"] + +ARG PS_PACKAGE_URL_BASE64 + +RUN Write-host "Verifying valid Version..."; ` + if (!($env:PS_VERSION -match '^\d+\.\d+\.\d+(-\w+(\.\d+)?)?$' )) { ` + throw ('PS_Version ({0}) must match the regex "^\d+\.\d+\.\d+(-\w+(\.\d+)?)?$"' -f $env:PS_VERSION) ` + } ` + $ProgressPreference = 'SilentlyContinue'; ` + if($env:PS_PACKAGE_URL_BASE64){ ` + Write-host "decoding: $env:PS_PACKAGE_URL_BASE64" ;` + $url = [System.Text.Encoding]::Unicode.GetString([System.Convert]::FromBase64String($env:PS_PACKAGE_URL_BASE64)) ` + } else { ` + Write-host "using url: $env:PS_PACKAGE_URL" ;` + $url = $env:PS_PACKAGE_URL ` + } ` + Write-host "downloading: $url"; ` + [Net.ServicePointManager]::SecurityProtocol = [Net.ServicePointManager]::SecurityProtocol -bor [Net.SecurityProtocolType]::Tls12; ` + New-Item -ItemType Directory /installer > $null ; ` + Invoke-WebRequest -Uri $url -outfile /installer/powershell.zip -verbose; ` + Expand-Archive /installer/powershell.zip -DestinationPath \PowerShell + +# Install PowerShell into NanoServer +FROM ${NanoServerRepo}:${fromTag} + +ARG fromTag=1709 + +ARG VCS_REF="none" +ARG PS_VERSION=6.2.0-rc.1 +ARG IMAGE_NAME=mcr.microsoft.com/powershell + +# Copy PowerShell Core from the installer container +ENV ProgramFiles="C:\Program Files" ` + # set a fixed location for the Module analysis cache + LOCALAPPDATA="C:\Users\ContainerAdministrator\AppData\Local" ` + PSModuleAnalysisCachePath="$LOCALAPPDATA\Microsoft\Windows\PowerShell\docker\ModuleAnalysisCache" ` + # Persist %PSCORE% ENV variable for user convenience + PSCORE="$ProgramFiles\PowerShell\pwsh.exe" ` + # Set the default windows path so we can use it + WindowsPATH="C:\Windows\system32;C:\Windows" ` + POWERSHELL_DISTRIBUTION_CHANNEL="PSDocker-NanoServer-${fromTag}" + +### Begin workaround ### +# Note that changing user on nanoserver is not recommended +# See, https://docs.microsoft.com/en-us/virtualization/windowscontainers/manage-containers/container-base-images#base-image-differences +# But we are working around a bug introduced in the nanoserver image introduced in 1809 +# Without this, PowerShell Direct will fail +# this command sholud be like this: https://github.com/PowerShell/PowerShell-Docker/blob/f81009c42c96af46aef81eb1515efae0ef29ad5f/release/preview/nanoserver/docker/Dockerfile#L76 +USER ContainerAdministrator + +# This is basically the correct code except for the /M +RUN setx PATH "%PATH%;%ProgramFiles%\PowerShell;" /M + +USER ContainerUser +### End workaround ### + +COPY --from=installer-env ["\\PowerShell\\", "$ProgramFiles\\PowerShell"] + +# intialize powershell module cache +RUN pwsh ` + -NoLogo ` + -NoProfile ` + -Command " ` + $stopTime = (get-date).AddMinutes(15); ` + $ErrorActionPreference = 'Stop' ; ` + $ProgressPreference = 'SilentlyContinue' ; ` + while(!(Test-Path -Path $env:PSModuleAnalysisCachePath)) { ` + Write-Host "'Waiting for $env:PSModuleAnalysisCachePath'" ; ` + if((get-date) -gt $stopTime) { throw 'timout expired'} ` + Start-Sleep -Seconds 6 ; ` + }" + +LABEL maintainer="PowerShell Team " ` + 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.vcs-ref=${VCS_REF} ` + org.label-schema.vendor="PowerShell" ` + 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.exe"] diff --git a/release/lts/nanoserver1809/getLatestTag.ps1 b/release/lts/nanoserver1809/getLatestTag.ps1 new file mode 100644 index 000000000..2c7ce394f --- /dev/null +++ b/release/lts/nanoserver1809/getLatestTag.ps1 @@ -0,0 +1,21 @@ +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. + +# return objects representing the tags we need to base the nanoserver image on + + +param( + [Switch] + $CI, + # The versions of nanoserver we care about + [string[]] + $ShortTags +) + +$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 "mcr.microsoft.com/windows/nanoserver" -FullTagFilter '\d{4}[-_]KB\d{7}([\-_]amd64)?$' -Mcr + diff --git a/release/lts/nanoserver1809/meta.json b/release/lts/nanoserver1809/meta.json new file mode 100644 index 000000000..eda76e6a8 --- /dev/null +++ b/release/lts/nanoserver1809/meta.json @@ -0,0 +1,16 @@ +{ + "IsLinux" : false, + "PackageFormat": "PowerShell-${PS_VERSION}-win-x64.zip", + "osVersion": "Nano Server, version ${fromTag}", + "shortTags": [ + {"Tag": "1809"}, + {"Tag": "1903"} + ], + "tagTemplates": [ + "lts-nanoserver-#shorttag#" + ], + "Base64EncodePackageUrl": true, + "TestProperties": { + "size": 1 + } +} diff --git a/release/lts/ubuntu16.04/docker/Dockerfile b/release/lts/ubuntu16.04/docker/Dockerfile new file mode 100644 index 000000000..7e7a14933 --- /dev/null +++ b/release/lts/ubuntu16.04/docker/Dockerfile @@ -0,0 +1,75 @@ +# Docker image file that describes an Ubuntu16.04 image with PowerShell installed from Microsoft APT Repo +ARG fromTag=16.04 +ARG imageRepo=ubuntu + +FROM ${imageRepo}:${fromTag} AS installer-env + +ARG PS_VERSION=7.0.0-rc.1 +ARG PS_PACKAGE=powershell-lts_${PS_VERSION}-1.ubuntu.16.04_amd64.deb +ARG PS_PACKAGE_URL=https://github.com/PowerShell/PowerShell/releases/download/v${PS_VERSION}/${PS_PACKAGE} + +# Define ENVs for Localization/Globalization +ENV 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-Ubuntu-16.04 + +# Install dependencies and clean up +RUN apt-get update \ + && apt-get install -y \ + # curl is required to grab the Linux package + curl \ + # less is required for help in powershell + less \ + # requied to setup the locale + locales \ + # required for SSL + ca-certificates \ + gss-ntlmssp \ + # Download the Linux package and save it + && echo ${PS_PACKAGE_URL} \ + && curl -sSL ${PS_PACKAGE_URL} -o /tmp/powershell.deb \ + && apt-get install -y /tmp/powershell.deb \ + && apt-get dist-upgrade -y \ + && apt-get clean \ + && rm -rf /var/lib/apt/lists/* \ + && locale-gen $LANG && update-locale \ + # remove powershell package + && rm /tmp/powershell.deb \ + # 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 VCS_REF="none" +ARG IMAGE_NAME=mcr.microsoft.com/powershell:ubuntu16.04 + +LABEL maintainer="PowerShell Team " \ + 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.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" + +# Use PowerShell as the default shell +# Use array to avoid Docker prepending /bin/sh -c +CMD [ "pwsh" ] diff --git a/release/lts/ubuntu16.04/getLatestTag.ps1 b/release/lts/ubuntu16.04/getLatestTag.ps1 new file mode 100644 index 000000000..6ef600d39 --- /dev/null +++ b/release/lts/ubuntu16.04/getLatestTag.ps1 @@ -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 xenial image on + +# The versions of xenial we care about +$shortTags = @('xenial') + +$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 "ubuntu" -FullTagFilter 'xenial-\d{8}[\.\d{1}]?' -AlternativeShortTag '16.04' diff --git a/release/lts/ubuntu16.04/meta.json b/release/lts/ubuntu16.04/meta.json new file mode 100644 index 000000000..3b9123fa4 --- /dev/null +++ b/release/lts/ubuntu16.04/meta.json @@ -0,0 +1,14 @@ +{ + "IsLinux" : true, + "UseLinuxVersion": false, + "PackageFormat": "powershell-lts_${PS_VERSION}-1.ubuntu.16.04_amd64.deb", + "osVersion": "Ubuntu 16.04", + "SkipGssNtlmSspTests": false, + "tagTemplates": [ + "lts-ubuntu-#shorttag#" + ], + "TestProperties": { + "size": 395 + }, + "SubImage": "test-deps" +} diff --git a/release/lts/ubuntu16.04/test-deps/docker/Dockerfile b/release/lts/ubuntu16.04/test-deps/docker/Dockerfile new file mode 100644 index 000000000..cd956e14d --- /dev/null +++ b/release/lts/ubuntu16.04/test-deps/docker/Dockerfile @@ -0,0 +1,42 @@ +# Docker image file that describes an Ubuntu image with PowerShell and test dependencies +ARG BaseImage=mcr.microsoft.com/powershell:ubuntu-16.04 + +FROM ${BaseImage} + +# Install dependencies and clean up +RUN apt-get update \ + && apt-get install -y \ + sudo \ + curl \ + wget \ + iputils-ping \ + iputils-tracepath \ + && apt-get clean \ + && rm -rf /var/lib/apt/lists/* + +ENV POWERSHELL_DISTRIBUTION_CHANNEL=PSDocker-TestDeps-Ubuntu-16.04 + +# Define args needed only for the labels +ARG VCS_REF="none" +ARG IMAGE_NAME=mcr.microsoft.com/powershell/test-deps:ubuntu-16.04 +ARG PS_VERSION=6.2.3 + +LABEL maintainer="PowerShell Team " \ + 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" + +# Use PowerShell as the default shell +# Use array to avoid Docker prepending /bin/sh -c +CMD [ "pwsh" ] diff --git a/release/lts/ubuntu16.04/test-deps/meta.json b/release/lts/ubuntu16.04/test-deps/meta.json new file mode 100644 index 000000000..8bd139c7d --- /dev/null +++ b/release/lts/ubuntu16.04/test-deps/meta.json @@ -0,0 +1,16 @@ +{ + "IsLinux" : true, + "UseLinuxVersion": false, + "osVersion": "Ubuntu 16.04", + "tagTemplates": [ + "lts-ubuntu-#shorttag#" + ], + "SubRepository": "test-deps", + "OptionalTests": [ + "test-deps", + "test-deps-debian" + ], + "TestProperties": { + "size": 399 + } +} diff --git a/release/lts/ubuntu18.04/dependabot/Dockerfile b/release/lts/ubuntu18.04/dependabot/Dockerfile new file mode 100644 index 000000000..2f686eca8 --- /dev/null +++ b/release/lts/ubuntu18.04/dependabot/Dockerfile @@ -0,0 +1,6 @@ +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. + +# Dummy docker image to trigger dependabot PRs + +FROM ubuntu:18.04 diff --git a/release/lts/ubuntu18.04/docker/Dockerfile b/release/lts/ubuntu18.04/docker/Dockerfile new file mode 100644 index 000000000..f4c23e308 --- /dev/null +++ b/release/lts/ubuntu18.04/docker/Dockerfile @@ -0,0 +1,75 @@ +# Docker image file that describes an Ubuntu18.04 image with PowerShell installed from Microsoft APT Repo +ARG fromTag=18.04 +ARG imageRepo=ubuntu + +FROM ${imageRepo}:${fromTag} AS installer-env + +ARG PS_VERSION=7.0.0-rc.1 +ARG PS_PACKAGE=powershell-lts_${PS_VERSION}-1.ubuntu.18.04_amd64.deb +ARG PS_PACKAGE_URL=https://github.com/PowerShell/PowerShell/releases/download/v${PS_VERSION}/${PS_PACKAGE} + +# Define ENVs for Localization/Globalization +ENV 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-Ubuntu-18.04 + +# Install dependencies and clean up +RUN apt-get update \ + && apt-get install -y \ + # curl is required to grab the Linux package + curl \ + # less is required for help in powershell + less \ + # requied to setup the locale + locales \ + # required for SSL + ca-certificates \ + gss-ntlmssp \ + # Download the Linux package and save it + && echo ${PS_PACKAGE_URL} \ + && curl -sSL ${PS_PACKAGE_URL} -o /tmp/powershell.deb \ + && apt-get install -y /tmp/powershell.deb \ + && apt-get dist-upgrade -y \ + && apt-get clean \ + && rm -rf /var/lib/apt/lists/* \ + && locale-gen $LANG && update-locale \ + # remove powershell package + && rm /tmp/powershell.deb \ + # 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 VCS_REF="none" +ARG IMAGE_NAME=mcr.microsoft.com/powershell:ubuntu18.04 + +LABEL maintainer="PowerShell Team " \ + 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.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" + +# Use PowerShell as the default shell +# Use array to avoid Docker prepending /bin/sh -c +CMD [ "pwsh" ] diff --git a/release/lts/ubuntu18.04/getLatestTag.ps1 b/release/lts/ubuntu18.04/getLatestTag.ps1 new file mode 100644 index 000000000..40aa9aaf9 --- /dev/null +++ b/release/lts/ubuntu18.04/getLatestTag.ps1 @@ -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 beaver image on + +# The versions of beaver we care about +$shortTags = @('bionic') + +$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 "ubuntu" -FullTagFilter 'bionic-\d{8}[\.\d{1}]?' -AlternativeShortTag '18.04' diff --git a/release/lts/ubuntu18.04/meta.json b/release/lts/ubuntu18.04/meta.json new file mode 100644 index 000000000..247c127a5 --- /dev/null +++ b/release/lts/ubuntu18.04/meta.json @@ -0,0 +1,14 @@ +{ + "IsLinux" : true, + "UseLinuxVersion": false, + "PackageFormat": "powershell-lts_${PS_VERSION}-1.ubuntu.18.04_amd64.deb", + "osVersion": "Ubuntu 18.04", + "SkipGssNtlmSspTests": false, + "tagTemplates": [ + "lts-ubuntu-#shorttag#" + ], + "TestProperties": { + "size": 355 + }, + "SubImage": "test-deps" +} diff --git a/release/lts/ubuntu18.04/test-deps/docker/Dockerfile b/release/lts/ubuntu18.04/test-deps/docker/Dockerfile new file mode 100644 index 000000000..629df4a11 --- /dev/null +++ b/release/lts/ubuntu18.04/test-deps/docker/Dockerfile @@ -0,0 +1,42 @@ +# Docker image file that describes an Ubuntu image with PowerShell and test dependencies +ARG BaseImage=mcr.microsoft.com/powershell:ubuntu-18.04 + +FROM ${BaseImage} + +# Install dependencies and clean up +RUN apt-get update \ + && apt-get install -y \ + sudo \ + curl \ + wget \ + iputils-ping \ + iputils-tracepath \ + && apt-get clean \ + && rm -rf /var/lib/apt/lists/* + +ENV POWERSHELL_DISTRIBUTION_CHANNEL=PSDocker-TestDeps-Ubuntu-18.04 + +# Define args needed only for the labels +ARG VCS_REF="none" +ARG IMAGE_NAME=mcr.microsoft.com/powershell/test-deps:ubuntu-18.04 +ARG PS_VERSION=6.2.3 + +LABEL maintainer="PowerShell Team " \ + 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" + +# Use PowerShell as the default shell +# Use array to avoid Docker prepending /bin/sh -c +CMD [ "pwsh" ] diff --git a/release/lts/ubuntu18.04/test-deps/meta.json b/release/lts/ubuntu18.04/test-deps/meta.json new file mode 100644 index 000000000..3e42dc92f --- /dev/null +++ b/release/lts/ubuntu18.04/test-deps/meta.json @@ -0,0 +1,16 @@ +{ + "IsLinux" : true, + "UseLinuxVersion": false, + "osVersion": "Ubuntu 18.04", + "tagTemplates": [ + "lts-ubuntu-#shorttag#" + ], + "SubRepository": "test-deps", + "OptionalTests": [ + "test-deps", + "test-deps-debian" + ], + "TestProperties": { + "size": 358 + } +} diff --git a/release/lts/windowsservercore/dependabot/Dockerfile b/release/lts/windowsservercore/dependabot/Dockerfile new file mode 100644 index 000000000..8521751a2 --- /dev/null +++ b/release/lts/windowsservercore/dependabot/Dockerfile @@ -0,0 +1,6 @@ +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. + +# Dummy docker image to trigger dependabot PRs + +FROM mcr.microsoft.com/windows/servercore:1903 diff --git a/release/lts/windowsservercore/docker/Dockerfile b/release/lts/windowsservercore/docker/Dockerfile new file mode 100755 index 000000000..748f31242 --- /dev/null +++ b/release/lts/windowsservercore/docker/Dockerfile @@ -0,0 +1,85 @@ +# escape=` +ARG fromTag=latest +ARG WindowsServerCoreRepo=mcr.microsoft.com/windows/servercore + +# Use server core as an installer container to extract PowerShell, +# As this is a multi-stage build, this stage will eventually be thrown away +FROM ${WindowsServerCoreRepo}:${fromTag} AS installer-env + +ARG PS_VERSION=7.0.0 +ARG PS_PACKAGE_URL=https://github.com/PowerShell/PowerShell/releases/download/v${PS_VERSION}/PowerShell-${PS_VERSION}-win-x64.zip + +SHELL ["C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe", "-command"] + +ARG PS_PACKAGE_URL_BASE64 + +RUN Write-host "Verifying valid Version..."; ` + if (!($env:PS_VERSION -match '^\d+\.\d+\.\d+(-\w+(\.\d+)?)?$' )) { ` + throw ('PS_Version ({0}) must match the regex "^\d+\.\d+\.\d+(-\w+(\.\d+)?)?$"' -f $env:PS_VERSION) ` + } ` + $ProgressPreference = 'SilentlyContinue'; ` + if($env:PS_PACKAGE_URL_BASE64){ ` + Write-host "decoding: $env:PS_PACKAGE_URL_BASE64" ;` + $url = [System.Text.Encoding]::Unicode.GetString([System.Convert]::FromBase64String($env:PS_PACKAGE_URL_BASE64)) ` + } else { ` + Write-host "using url: $env:PS_PACKAGE_URL" ;` + $url = $env:PS_PACKAGE_URL ` + } ` + Write-host "downloading: $url"; ` + [Net.ServicePointManager]::SecurityProtocol = [Net.ServicePointManager]::SecurityProtocol -bor [Net.SecurityProtocolType]::Tls12; ` + Invoke-WebRequest -Uri $url -outfile /powershell.zip -verbose; ` + Expand-Archive powershell.zip -DestinationPath \PowerShell + +# Install PowerShell into WindowsServerCore +FROM ${WindowsServerCoreRepo}:${fromTag} + +# Copy PowerShell Core from the installer container +ENV ProgramFiles="C:\Program Files" ` + # set a fixed location for the Module analysis cache + LOCALAPPDATA="C:\Users\ContainerAdministrator\AppData\Local" ` + PSModuleAnalysisCachePath="$LOCALAPPDATA\Microsoft\Windows\PowerShell\docker\ModuleAnalysisCache" ` + # Persist %PSCORE% ENV variable for user convenience + PSCORE="$ProgramFiles\PowerShell\pwsh.exe" ` + POWERSHELL_DISTRIBUTION_CHANNEL="PSDocker-WindowsServerCore-${fromTag}" + +# Copy PowerShell Core from the installer container +COPY --from=installer-env ["\\PowerShell\\", "$ProgramFiles\\PowerShell\\latest"] + +# Set the path +RUN setx /M PATH "%ProgramFiles%\PowerShell\latest;%PATH%;" + +# intialize powershell module cache +RUN pwsh ` + -NoLogo ` + -NoProfile ` + -Command " ` + $stopTime = (get-date).AddMinutes(15); ` + $ErrorActionPreference = 'Stop' ; ` + $ProgressPreference = 'SilentlyContinue' ; ` + while(!(Test-Path -Path $env:PSModuleAnalysisCachePath)) { ` + Write-Host "'Waiting for $env:PSModuleAnalysisCachePath'" ; ` + if((get-date) -gt $stopTime) { throw 'timout expired'} ` + Start-Sleep -Seconds 6 ; ` + }" + +CMD ["pwsh.exe"] + +ARG IMAGE_NAME=mcr.microsoft.com/powershell:windowsservercore +ARG VCS_REF="none" +ARG PS_VERSION=7.0.0 + +LABEL maintainer="PowerShell Team " ` + 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" diff --git a/release/lts/windowsservercore/getLatestTag.ps1 b/release/lts/windowsservercore/getLatestTag.ps1 new file mode 100644 index 000000000..cf9142c8c --- /dev/null +++ b/release/lts/windowsservercore/getLatestTag.ps1 @@ -0,0 +1,19 @@ +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. + +# return objects representing the tags we need to base the nanoserver image on + +param( + [Switch] + $CI +) + +$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 -Force + +# The versions of nanoserver we care about +$shortTags = @('1803','1809','1903') + +Get-DockerTags -ShortTags $shortTags -Image "mcr.microsoft.com/windows/servercore" -FullTagFilter '\d{4}[-_]KB\d{7}' -Mcr diff --git a/release/lts/windowsservercore/meta.json b/release/lts/windowsservercore/meta.json new file mode 100644 index 000000000..d92c16abe --- /dev/null +++ b/release/lts/windowsservercore/meta.json @@ -0,0 +1,12 @@ +{ + "IsLinux": false, + "PackageFormat": "PowerShell-${PS_VERSION}-win-x64.zip", + "osVersion": "Windows Server Core, version ${fromTag}", + "Base64EncodePackageUrl": true, + "tagTemplates": [ + "lts-windowsservercore-#shorttag#" + ], + "TestProperties": { + "size": 1 + } +} diff --git a/release/preview/fedora/getLatestTag.ps1 b/release/preview/fedora/getLatestTag.ps1 index 43a61d207..c9ad27d2d 100644 --- a/release/preview/fedora/getLatestTag.ps1 +++ b/release/preview/fedora/getLatestTag.ps1 @@ -4,7 +4,7 @@ # return objects representing the tags we need to base the fedora image on # The versions of fedora we care about -$shortTags = @('28','29','30') +$shortTags = @('30') $parent = Join-Path -Path $PSScriptRoot -ChildPath '..' $repoRoot = Join-Path -path (Join-Path -Path $parent -ChildPath '..') -ChildPath '..' diff --git a/release/preview/fedora/test-deps/meta.json b/release/preview/fedora/test-deps/meta.json index 5d7da871c..ae99ee413 100644 --- a/release/preview/fedora/test-deps/meta.json +++ b/release/preview/fedora/test-deps/meta.json @@ -14,8 +14,6 @@ "size": 632 }, "TagMapping": { - "^.*-fedora-28$" : "preview-fedora-28", - "^.*-fedora-29$" : "preview-fedora-29", "^.*-fedora-30$" : "preview-fedora-30" } } diff --git a/release/preview/nanoserver1809/meta.json b/release/preview/nanoserver1809/meta.json index 8396b1ce0..a72b8d17a 100644 --- a/release/preview/nanoserver1809/meta.json +++ b/release/preview/nanoserver1809/meta.json @@ -4,7 +4,8 @@ "osVersion": "Nano Server, version ${fromTag}", "shortTags": [ {"Tag": "1809"}, - {"Tag": "1903"} + {"Tag": "1903"}, + {"Tag": "1909"} ], "tagTemplates": [ "#psversion#-nanoserver-#tag#", diff --git a/release/preview/opensuse423/meta.json b/release/preview/opensuse423/meta.json deleted file mode 100644 index 1de7ee4f7..000000000 --- a/release/preview/opensuse423/meta.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "IsLinux" : true, - "UseLinuxVersion": false, - "PackageFormat": "powershell-${PS_VERSION}-linux-x64.tar.gz", - "osVersion": "OpenSuse 42.3", - "SkipGssNtlmSspTests": true, - "tagTemplates": [ - "#psversion#-opensuse-#tag#", - "preview-opensuse-#shorttag#" - ], - "SubImage": "test-deps", - "TestProperties": { - "size": 524 - } -} diff --git a/release/preview/windowsservercore/getLatestTag.ps1 b/release/preview/windowsservercore/getLatestTag.ps1 index cf9142c8c..149532755 100644 --- a/release/preview/windowsservercore/getLatestTag.ps1 +++ b/release/preview/windowsservercore/getLatestTag.ps1 @@ -14,6 +14,6 @@ $modulePath = Join-Path -Path $repoRoot -ChildPath 'tools\getDockerTags' Import-Module $modulePath -Force # The versions of nanoserver we care about -$shortTags = @('1803','1809','1903') +$shortTags = @('1803','1809','1903','1909') Get-DockerTags -ShortTags $shortTags -Image "mcr.microsoft.com/windows/servercore" -FullTagFilter '\d{4}[-_]KB\d{7}' -Mcr diff --git a/release/stable/fedora28/meta.json b/release/stable/fedora28/meta.json deleted file mode 100644 index e7cec1369..000000000 --- a/release/stable/fedora28/meta.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "IsLinux" : true, - "UseLinuxVersion": false, - "PackageFormat": "powershell${previewTag}-${PS_VERSION}-1.rhel.7.x86_64.rpm", - "osVersion": "Fedora 28", - "SkipGssNtlmSspTests": false, - "tagTemplates": [ - "#psversion#-fedora-#tag#", - "fedora-#shorttag#" - ], - "SubImage": "test-deps", - "TestProperties": { - "size": 586 - } -} diff --git a/release/stable/nanoserver1809/meta.json b/release/stable/nanoserver1809/meta.json index 52fb86d9a..0dd88ece6 100644 --- a/release/stable/nanoserver1809/meta.json +++ b/release/stable/nanoserver1809/meta.json @@ -4,7 +4,8 @@ "osVersion": "Nano Server, version ${fromTag}", "shortTags": [ {"Tag": "1809"}, - {"Tag": "1903"} + {"Tag": "1903"}, + {"Tag": "1909"} ], "tagTemplates": [ "#psversion#-nanoserver-#tag#", diff --git a/release/stable/windowsservercore/getLatestTag.ps1 b/release/stable/windowsservercore/getLatestTag.ps1 index cf9142c8c..149532755 100644 --- a/release/stable/windowsservercore/getLatestTag.ps1 +++ b/release/stable/windowsservercore/getLatestTag.ps1 @@ -14,6 +14,6 @@ $modulePath = Join-Path -Path $repoRoot -ChildPath 'tools\getDockerTags' Import-Module $modulePath -Force # The versions of nanoserver we care about -$shortTags = @('1803','1809','1903') +$shortTags = @('1803','1809','1903','1909') Get-DockerTags -ShortTags $shortTags -Image "mcr.microsoft.com/windows/servercore" -FullTagFilter '\d{4}[-_]KB\d{7}' -Mcr diff --git a/tests/container.tests.ps1 b/tests/container.tests.ps1 index 690a5267a..4137389dd 100644 --- a/tests/container.tests.ps1 +++ b/tests/container.tests.ps1 @@ -412,17 +412,32 @@ Describe "Linux Containers" -Tags 'Behavior', 'Linux' { BeforeAll { $permissionsTestCases = @( $script:linuxContainerRunTests | ForEach-Object { + $path = '/opt/microsoft/powershell/6/pwsh' + switch -RegEx ($_.Channel) + { + 'stable' { + $path = '/opt/microsoft/powershell/6/pwsh' + } + 'lts' { + $path = '/opt/microsoft/powershell/7-lts/pwsh' + } + 'preview' { + $path = '/opt/microsoft/powershell/7-preview/pwsh' + } + } + $Arm32 = [bool] $_.TestProperties.Arm32 @{ Name = $_.Name Channel = $_.Channel Arm32 = $Arm32 + Path = $path } } ) } - it "pwsh should have execute permissions for all in -" -TestCases $permissionsTestCases -Skip:$script:skipLinuxRun { + it "pwsh should be at in -" -TestCases $permissionsTestCases -Skip:$script:skipLinuxRun { param( [Parameter(Mandatory=$true)] [string] @@ -431,19 +446,41 @@ Describe "Linux Containers" -Tags 'Behavior', 'Linux' { $Channel, [Bool] - $Arm32 + $Arm32, + + [string] + $Path ) if($Arm32) { - Set-ItResult -Pending -Because "Arm32 is falky on QEMU" + Set-ItResult -Pending -Because "Arm32 is flaky on QEMU" } - $path = '/opt/microsoft/powershell/6/pwsh' + $paths = @(Get-DockerCommandSource -Name $name -Command 'pwsh') + $paths.count | Should -BeGreaterOrEqual 1 + $pwshPath = $paths | Where-Object { $_ -like '*microsoft*' } + $pwshPath | Should -Be $Path + } + + it "pwsh should have execute permissions for all in -" -TestCases $permissionsTestCases -Skip:$script:skipLinuxRun { + param( + [Parameter(Mandatory=$true)] + [string] + $name, + [string] + $Channel, + + [Bool] + $Arm32, + + [string] + $Path + ) - if($Channel -eq 'preview') + if($Arm32) { - $path = '/opt/microsoft/powershell/7-preview/pwsh' + Set-ItResult -Pending -Because "Arm32 is falky on QEMU" } $permissions = Get-DockerImagePwshPermissions -Name $name -Path $path @@ -459,7 +496,10 @@ Describe "Linux Containers" -Tags 'Behavior', 'Linux' { $Channel, [Bool] - $Arm32 + $Arm32, + + [string] + $Path ) if($Arm32) @@ -467,13 +507,6 @@ Describe "Linux Containers" -Tags 'Behavior', 'Linux' { Set-ItResult -Pending -Because "Arm32 is falky on QEMU" } - $path = '/opt/microsoft/powershell/6/pwsh' - - if($Channel -eq 'preview') - { - $path = '/opt/microsoft/powershell/7-preview/pwsh' - } - $permissions = Get-DockerImagePwshPermissions -Name $name -Path $path $permissions | Should -Match '^[\-rwx]{4}[\-rwx]{3}[\-rx]{3}$' -Because 'Others should not be able to write' } diff --git a/tools/buildHelper/buildHelper.psm1 b/tools/buildHelper/buildHelper.psm1 index 82af77967..eb07f28b1 100644 --- a/tools/buildHelper/buildHelper.psm1 +++ b/tools/buildHelper/buildHelper.psm1 @@ -16,17 +16,24 @@ function Get-PowerShellVersion [Parameter(Mandatory, ParameterSetName='Servicing', HelpMessage="Gets the servicing version. Without this it gets the current stable version.")] [switch] $Servicing, + [Parameter(Mandatory, ParameterSetName="ExplicitVersionLts", HelpMessage="Gets the preview version. Without this it gets the current stable version.")] + [Parameter(Mandatory, ParameterSetName='Lts', HelpMessage="Gets the lts version. Without this it gets the current stable version.")] + [switch] $Lts, + [Parameter(ParameterSetName="LookupVersion",HelpMessage="Gets the linux package (docker tags use the standard format) format of the version. This only applies to preview versions, but is always safe to use for linux packages.")] [Parameter(ParameterSetName="ExplicitVersion",HelpMessage="Gets the linux package (docker tags use the standard format) format of the version. This only applies to preview versions, but is always safe to use for linux packages.")] [Parameter(ParameterSetName="ExplicitVersionPreview",HelpMessage="Gets the linux package (docker tags use the standard format) format of the version. This only applies to preview versions, but is always safe to use for linux packages.")] [Parameter(ParameterSetName="ExplicitVersionServicing",HelpMessage="Gets the linux package (docker tags use the standard format) format of the version. This only applies to preview versions, but is always safe to use for linux packages.")] + [Parameter(ParameterSetName="ExplicitVersionLts", HelpMessage="Gets the linux package (docker tags use the standard format) format of the version. This only applies to preview versions, but is always safe to use for linux packages.")] [Parameter(ParameterSetName='Servicing', HelpMessage="Gets the linux package (docker tags use the standard format) format of the version. This only applies to preview versions, but is always safe to use for linux packages.")] [Parameter(ParameterSetName='Preview', HelpMessage="Gets the linux package (docker tags use the standard format) format of the version. This only applies to preview versions, but is always safe to use for linux packages.")] + [Parameter(ParameterSetName='Lts', HelpMessage="Gets the linux package (docker tags use the standard format) format of the version. This only applies to preview versions, but is always safe to use for linux packages.")] [switch] $Linux, [Parameter(Mandatory,ParameterSetName="ExplicitVersion", HelpMessage="Don't lookup version, just transform this standardized version based on the other parameters.")] [Parameter(Mandatory,ParameterSetName="ExplicitVersionServicing", HelpMessage="Don't lookup version, just transform this standardized version based on the other parameters.")] [Parameter(Mandatory,ParameterSetName="ExplicitVersionPreview", HelpMessage="Don't lookup version, just transform this standardized version based on the other parameters.")] + [Parameter(Mandatory, ParameterSetName="ExplicitVersionLts", HelpMessage="Don't lookup version, just transform this standardized version based on the other parameters.")] [ValidatePattern('(\d+\.){2}\d(-\w+(\.\d+)?)?')] [string] $Version @@ -41,6 +48,15 @@ function Get-PowerShellVersion elseif ($Servicing.IsPresent) { $metaData.ServicingReleaseTag } + elseif ($Lts.IsPresent) { + $ltsReleaseTag = $metaData.LtsReleaseTag + if (-not $ltsReleaseTag) { + $metaData.PreviewReleaseTag + } + else { + $ltsReleaseTag + } + } else { $metaData.StableReleaseTag } @@ -63,7 +79,7 @@ function Get-ImageList { param( [Parameter(HelpMessage="Filters returned list to stable or preview images. Default to all images.")] - [ValidateSet('stable','preview','servicing','all','community-stable')] + [ValidateSet('stable','preview','servicing','all','community-stable','lts')] [string[]] $Channel='all' ) @@ -71,6 +87,7 @@ function Get-ImageList # Get the names of the builds. $releasePath = Join-Path -Path $PSScriptRoot -ChildPath '..\..\release' $stablePath = Join-Path -Path $releasePath -ChildPath 'stable' + $ltsPath = Join-Path -Path $releasePath -ChildPath 'lts' $previewPath = Join-Path -Path $releasePath -ChildPath 'preview' $servicingPath = Join-Path -Path $releasePath -ChildPath 'servicing' $communityStablePath = Join-Path -Path $releasePath -ChildPath 'community-stable' @@ -85,6 +102,11 @@ function Get-ImageList Get-ChildItem -Path $servicingPath -Directory | Select-Object -ExpandProperty Name | Write-Output } + if ($Channel -in 'lts', 'all') + { + Get-ChildItem -Path $ltsPath -Directory | Select-Object -ExpandProperty Name | Write-Output + } + if ($Channel -in 'preview', 'all') { Get-ChildItem -Path $previewPath -Directory | Select-Object -ExpandProperty Name | Where-Object { $dockerFileNames -notcontains $_ } | Write-Output @@ -276,10 +298,13 @@ function Get-Versions $PreviewVersion, [string] - $StableVersion + $StableVersion, + + [string] + $LtsVersion ) - Write-Verbose "Getting Version for $Channel - servicing: $ServicingVersion; Preview: $PreviewVersion; stable: $stableVersion" + Write-Verbose "Getting Version for $Channel - servicing: $ServicingVersion; Preview: $PreviewVersion; stable: $stableVersion; stable: $ltsVersion" $versionExtraParams = @{} @@ -293,6 +318,14 @@ function Get-Versions $windowsVersion = Get-PowerShellVersion -Servicing @versionExtraParams $linuxVersion = Get-PowerShellVersion -Linux -Servicing @versionExtraParams } + 'lts$' { + if($LtsVersion){ + $versionExtraParams['Version'] = $LtsVersion + } + + $windowsVersion = Get-PowerShellVersion -Lts @versionExtraParams + $linuxVersion = Get-PowerShellVersion -Lts -Linux @versionExtraParams + } 'preview$' { if($PreviewVersion){ $versionExtraParams['Version'] = $PreviewVersion @@ -606,7 +639,7 @@ function Get-TestParams $packageUrl = [System.UriBuilder]::new($sasData.sasBase) $previewTag = '' - if($actualChannel -like '*preview*') + if($psversion -like '*-*') { $previewTag = '-preview' } @@ -632,7 +665,7 @@ function Get-TestParams $packageUrl = [System.UriBuilder]::new('https://github.com/PowerShell/PowerShell/releases/download/') $previewTag = '' - if($actualChannel -like '*preview*') + if($psversion -like '*-*') { $previewTag = '-preview' } diff --git a/vsts-ci.yml b/vsts-ci.yml index 988ef49a6..af4406072 100644 --- a/vsts-ci.yml +++ b/vsts-ci.yml @@ -14,6 +14,9 @@ stages: - template: .vsts-ci/stage.yml parameters: channel: preview + - template: .vsts-ci/stage.yml + parameters: + channel: lts - template: .vsts-ci/stage.yml parameters: channel: community-stable @@ -31,7 +34,7 @@ stages: - pwsh: Write-Host "##vso[build.updatebuildnumber]$env:BUILD_SOURCEBRANCHNAME-$env:BUILD_SOURCEVERSION-$((get-date).ToString("yyyyMMddhhss"))" displayName: Set Build Name for Non-PR condition: ne(variables['Build.Reason'], 'PullRequest') - - pwsh: ./build.ps1 -CheckForDuplicateTags -Channel stable, preview, servicing + - pwsh: ./build.ps1 -CheckForDuplicateTags -Channel stable, preview, servicing, lts displayName: Check for Duplicate Tags condition: succeededOrFailed() @@ -48,6 +51,7 @@ stages: displayName: 'Scan for secrets' inputs: debugMode: false + toolMajorVersion: V2 - task: securedevelopmentteam.vss-secure-development-tools.build-task-publishsecurityanalysislogs.PublishSecurityAnalysisLogs@2 displayName: 'Publish Secret Scan Logs to Build Artifacts'