Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Separate nanoserver 1809 due to breaking change #118

Merged
merged 5 commits into from
Jan 8, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions release/preview/nanoserver/getLatestTag.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,20 @@

param(
[Switch]
$CI
$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

# The versions of nanoserver we care about
$shortTags = @('1709','1803','1809')

if(!$CI.IsPresent)
{
Get-DockerTags -ShortTags $shortTags -Image "mcr.microsoft.com/windows/nanoserver" -FullTagFilter '\d{4}_KB\d{7}' -Mcr
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
Expand Down
6 changes: 1 addition & 5 deletions release/preview/nanoserver/meta.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,7 @@
"osVersion": "Nano Server, version ${fromTag}",
"shortTags": [
{"Tag": "1709"},
{"Tag": "1803"},
{
"Tag": "1809",
"KnownIssue": true
}
{"Tag": "1803"}
],
"tagTemplates": [
"#psversion#-nanoserver-#tag#",
Expand Down
56 changes: 56 additions & 0 deletions release/preview/nanoserver1809/docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# escape=`
# Args used by from statements must be defined here:
ARG fromTag=1709

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How do you make sure fromTag and WindowsServerCoreVersion are based the same os version (eg, ltsc2019)?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They don't need to be. So I don't

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

latest is supposed to be a manifestlist that works on the current platform. So, I used that. But, after they moved to mcr, it's no longer a manifestlist. I deal with the problem of incompatible kernels if I ever hit it.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see. Thanks.

ARG WindowsServerCoreVersion=latest
ARG WindowsServerCoreRepo=mcr.microsoft.com/windows/servercore
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 ${WindowsServerCoreRepo}:$WindowsServerCoreVersion AS installer-env

# Arguments for installing PowerShell, must be defined in the container they are used
ARG PS_VERSION=6.1.0-rc.1

ARG PS_PACKAGE_URL=https://github.com/PowerShell/PowerShell/releases/download/v$PS_VERSION/PowerShell-$PS_VERSION-win-x64.zip

SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]

RUN 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)}
ADD ${PS_PACKAGE_URL} /powershell.zip

RUN Expand-Archive powershell.zip -DestinationPath \PowerShell

# Install PowerShell into NanoServer
FROM ${NanoServerRepo}:${fromTag}

ARG VCS_REF="none"
ARG PS_VERSION=6.1.0-rc.1
ARG IMAGE_NAME=mcr.microsoft.com/powershell

LABEL maintainer="PowerShell Team <powershellteam@hotmail.com>" `
readme.md="https://github.com/PowerShell/PowerShell/blob/master/docker/README.md" `
description="This Dockerfile will install the latest release of PowerShell." `
org.label-schema.usage="https://github.com/PowerShell/PowerShell/tree/master/docker#run-the-docker-image-you-built" `
org.label-schema.url="https://github.com/PowerShell/PowerShell/blob/master/docker/README.md" `
org.label-schema.vcs-url="https://github.com/PowerShell/PowerShell-Docker" `
org.label-schema.name="powershell" `
org.label-schema.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"

# Copy PowerShell Core from the installer container
ENV ProgramFiles C:\Program Files
COPY --from=installer-env ["\\PowerShell\\", "$ProgramFiles\\PowerShell"]

# Persist %PSCORE% ENV variable for user convenience
ENV PSCORE="$ProgramFiles\PowerShell\pwsh.exe"
# Set the path
ENV PATH="$PATH;${ProgramFiles}\PowerShell"

CMD ["pwsh.exe"]
30 changes: 30 additions & 0 deletions release/preview/nanoserver1809/getLatestTag.ps1
Original file line number Diff line number Diff line change
@@ -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
}
12 changes: 12 additions & 0 deletions release/preview/nanoserver1809/meta.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"IsLinux" : false,
"PackageFormat": "PowerShell-${PS_VERSION}-win-x64.zip",
"osVersion": "Nano Server, version ${fromTag}",
"shortTags": [
{"Tag": "1809"}
],
"tagTemplates": [
"#psversion#-nanoserver-#tag#",
"preview-nanoserver-#shorttag#"
]
}
4 changes: 2 additions & 2 deletions release/servicing/nanoserver/docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ ARG NanoServerRepo=mcr.microsoft.com/windows/nanoserver
# As this is a multi-stage build, this stage will eventually be thrown away
FROM ${WindowsServerCoreRepo}:$WindowsServerCoreVersion AS installer-env

# Arguments for installing powershell, must be defined in the container they are used
# Arguments for installing PowerShell, must be defined in the container they are used
ARG PS_VERSION=6.0.4

ARG PS_PACKAGE_URL=https://github.com/PowerShell/PowerShell/releases/download/v$PS_VERSION/PowerShell-$PS_VERSION-win-x64.zip
Expand Down Expand Up @@ -44,7 +44,7 @@ LABEL maintainer="PowerShell Team <powershellteam@hotmail.com>" `
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"

# Copy Powershell Core from the installer containter
# Copy PowerShell Core from the installer container
ENV ProgramFiles C:\Program Files
COPY --from=installer-env ["\\PowerShell\\", "$ProgramFiles\\PowerShell"]

Expand Down
12 changes: 6 additions & 6 deletions release/servicing/nanoserver/getLatestTag.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -6,25 +6,25 @@

param(
[Switch]
$CI
$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

# The versions of nanoserver we care about
$shortTags = @('1709','1803','1809')

if(!$CI.IsPresent)
{
Get-DockerTags -ShortTags $shortTags -Image "mcr.microsoft.com/windows/nanoserver" -FullTagFilter '\d{4}_KB\d{7}'
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
Get-DockerTags -ShortTags $shortTags -Image "mcr.microsoft.com/windows/nanoserver" -FullTagFilter '10\.0\.14393\.\d{4,}$' -SkipShortTagFilter -Mcr
}
7 changes: 2 additions & 5 deletions release/servicing/nanoserver/meta.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
{
"IsLinux" : false,
"PackageFormat": "PowerShell-${PS_VERSION}-win-x64.zip",
"osVersion": "Nano Server, version ${fromTag}",
"shortTags": [
{"Tag": "1709"},
{"Tag": "1803"},
{
"Tag": "1809",
"KnownIssue": true
}
{"Tag": "1803"}
],
"tagTemplates": [
"#psversion#-nanoserver-#tag#"
Expand Down
56 changes: 56 additions & 0 deletions release/servicing/nanoserver1809/docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# escape=`
# Args used by from statements must be defined here:
ARG fromTag=1709
ARG WindowsServerCoreVersion=latest
ARG WindowsServerCoreRepo=mcr.microsoft.com/windows/servercore
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 ${WindowsServerCoreRepo}:$WindowsServerCoreVersion AS installer-env

# Arguments for installing PowerShell, must be defined in the container they are used
ARG PS_VERSION=6.0.4

ARG PS_PACKAGE_URL=https://github.com/PowerShell/PowerShell/releases/download/v$PS_VERSION/PowerShell-$PS_VERSION-win-x64.zip

SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]

RUN 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)}
ADD ${PS_PACKAGE_URL} /powershell.zip

RUN Expand-Archive powershell.zip -DestinationPath \PowerShell

# Install PowerShell into NanoServer
FROM ${NanoServerRepo}:${fromTag}

ARG VCS_REF="none"
ARG PS_VERSION=6.0.4
ARG IMAGE_NAME=mcr.microsoft.com/powershell

LABEL maintainer="PowerShell Team <powershellteam@hotmail.com>" `
readme.md="https://github.com/PowerShell/PowerShell/blob/master/docker/README.md" `
description="This Dockerfile will install the latest release of PowerShell." `
org.label-schema.usage="https://github.com/PowerShell/PowerShell/tree/master/docker#run-the-docker-image-you-built" `
org.label-schema.url="https://github.com/PowerShell/PowerShell/blob/master/docker/README.md" `
org.label-schema.vcs-url="https://github.com/PowerShell/PowerShell-Docker" `
org.label-schema.name="powershell" `
org.label-schema.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"

# Copy PowerShell Core from the installer container
ENV ProgramFiles C:\Program Files
COPY --from=installer-env ["\\PowerShell\\", "$ProgramFiles\\PowerShell"]

# Persist %PSCORE% ENV variable for user convenience
ENV PSCORE="$ProgramFiles\PowerShell\pwsh.exe"
# Set the path
ENV PATH="$PATH;${ProgramFiles}\PowerShell"

CMD ["pwsh.exe"]
30 changes: 30 additions & 0 deletions release/servicing/nanoserver1809/getLatestTag.ps1
Original file line number Diff line number Diff line change
@@ -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
}
11 changes: 11 additions & 0 deletions release/servicing/nanoserver1809/meta.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"IsLinux" : false,
"PackageFormat": "PowerShell-${PS_VERSION}-win-x64.zip",
"osVersion": "Nano Server, version ${fromTag}",
"shortTags": [
{"Tag": "1809"}
],
"tagTemplates": [
"#psversion#-nanoserver-#tag#"
]
}
2 changes: 1 addition & 1 deletion release/stable/nanoserver/getLatestTag.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ Import-Module $modulePath

if(!$CI.IsPresent)
{
Get-DockerTags -ShortTags $shortTags -Image "mcr.microsoft.com/windows/nanoserver" -FullTagFilter '\d{4}_KB\d{7}' -Mcr
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
Expand Down
6 changes: 1 addition & 5 deletions release/stable/nanoserver/meta.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,7 @@
"osVersion": "Nano Server, version ${fromTag}",
"shortTags": [
{"Tag": "1709"},
{"Tag": "1803"},
{
"Tag": "1809",
"KnownIssue": true
}
{"Tag": "1803"}
],
"tagTemplates": [
"#psversion#-nanoserver-#tag#",
Expand Down
56 changes: 56 additions & 0 deletions release/stable/nanoserver1809/docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# escape=`
# Args used by from statements must be defined here:
ARG fromTag=1709
ARG WindowsServerCoreVersion=latest
ARG WindowsServerCoreRepo=mcr.microsoft.com/windows/servercore
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 ${WindowsServerCoreRepo}:$WindowsServerCoreVersion AS installer-env

# Arguments for installing PowerShell, must be defined in the container they are used
ARG PS_VERSION=6.1.0

ARG PS_PACKAGE_URL=https://github.com/PowerShell/PowerShell/releases/download/v$PS_VERSION/PowerShell-$PS_VERSION-win-x64.zip

SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]

RUN 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)}
ADD ${PS_PACKAGE_URL} /powershell.zip

RUN Expand-Archive powershell.zip -DestinationPath \PowerShell

# Install PowerShell into NanoServer
FROM ${NanoServerRepo}:${fromTag}

ARG VCS_REF="none"
ARG PS_VERSION=6.1.0
ARG IMAGE_NAME=mcr.microsoft.com/powershell

LABEL maintainer="PowerShell Team <powershellteam@hotmail.com>" `
readme.md="https://github.com/PowerShell/PowerShell/blob/master/docker/README.md" `
description="This Dockerfile will install the latest release of PowerShell." `
org.label-schema.usage="https://github.com/PowerShell/PowerShell/tree/master/docker#run-the-docker-image-you-built" `
org.label-schema.url="https://github.com/PowerShell/PowerShell/blob/master/docker/README.md" `
org.label-schema.vcs-url="https://github.com/PowerShell/PowerShell-Docker" `
org.label-schema.name="powershell" `
org.label-schema.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"

# Copy PowerShell Core from the installer container
ENV ProgramFiles C:\Program Files
COPY --from=installer-env ["\\PowerShell\\", "$ProgramFiles\\PowerShell"]

# Persist %PSCORE% ENV variable for user convenience
ENV PSCORE="$ProgramFiles\PowerShell\pwsh.exe"
# Set the path
ENV PATH="$PATH;${ProgramFiles}\PowerShell"

CMD ["pwsh.exe"]
Loading