diff --git a/release/preview/debian9/dependabot/Dockerfile b/release/preview/debian10/dependabot/Dockerfile similarity index 89% rename from release/preview/debian9/dependabot/Dockerfile rename to release/preview/debian10/dependabot/Dockerfile index 08ac9ba17..934a2d9c0 100644 --- a/release/preview/debian9/dependabot/Dockerfile +++ b/release/preview/debian10/dependabot/Dockerfile @@ -3,4 +3,4 @@ # Dummy docker image to trigger dependabot PRs -FROM debian:9.9 +FROM debian:10 diff --git a/release/preview/debian10/docker/Dockerfile b/release/preview/debian10/docker/Dockerfile new file mode 100644 index 000000000..aecd890b0 --- /dev/null +++ b/release/preview/debian10/docker/Dockerfile @@ -0,0 +1,109 @@ +# 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=6.1.0 +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 + +# 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=6.2.0-preview.3 +ARG PS_INSTALL_VERSION=7-preview + +# 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 +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 + +# 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 \ + # 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-10 + +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/preview/debian10/getLatestTag.ps1 b/release/preview/debian10/getLatestTag.ps1 new file mode 100644 index 000000000..f262fed60 --- /dev/null +++ b/release/preview/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/preview/debian10/meta.json b/release/preview/debian10/meta.json new file mode 100644 index 000000000..dac73cd56 --- /dev/null +++ b/release/preview/debian10/meta.json @@ -0,0 +1,16 @@ +{ + "IsLinux" : true, + "UseLinuxVersion" : false, + "PackageFormat": "powershell-${PS_VERSION}-linux-x64.tar.gz", + "osVersion": "Debian 10", + "SkipGssNtlmSspTests": false, + "tagTemplates": [ + "#psversion#-debian-#tag#", + "preview-debian-#shorttag#" + ], + "SubImage": "test-deps", + "TestProperties": { + "size": 314 + } +} + diff --git a/release/preview/debian10/test-deps/docker/Dockerfile b/release/preview/debian10/test-deps/docker/Dockerfile new file mode 100644 index 000000000..48e428d63 --- /dev/null +++ b/release/preview/debian10/test-deps/docker/Dockerfile @@ -0,0 +1,41 @@ +# Docker image file that describes an Debian image with PowerShell and test dependencies +ARG BaseImage=mcr.microsoft.com/powershell:preview-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/* + +# 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.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 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/debian10/test-deps/meta.json b/release/preview/debian10/test-deps/meta.json new file mode 100644 index 000000000..9324ddfb2 --- /dev/null +++ b/release/preview/debian10/test-deps/meta.json @@ -0,0 +1,16 @@ +{ + "IsLinux" : true, + "UseLinuxVersion": false, + "osVersion": "Debian 10", + "tagTemplates": [ + "preview-debian-#shorttag#" + ], + "SubRepository": "test-deps", + "OptionalTests": [ + "test-deps", + "test-deps-debian" + ], + "TestProperties": { + "size": 316 + } +} diff --git a/vsts-ci.yml b/vsts-ci.yml index 09de7ef12..fab9bea83 100644 --- a/vsts-ci.yml +++ b/vsts-ci.yml @@ -87,6 +87,13 @@ jobs: stable: true preview: true +- template: .vsts-ci/phase.yml + parameters: + name: debian10 + imagename: debian10 + stable: false + preview: true + - template: .vsts-ci/phase.yml parameters: name: kaliRolling