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

Remove add command #670

Draft
wants to merge 56 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
56 commits
Select commit Hold shift + click to select a range
68c1430
remove ADD command
anamnavi May 18, 2022
48542a9
use wget on alpine, install ca-certificates on mariner before curl
anamnavi May 18, 2022
123c11e
use wget for alpine,install ca-certificates to use curl for mariner a…
anamnavi May 18, 2022
4fe6f99
update debian 10
anamnavi May 19, 2022
5e94eaf
install appropriate powershell installer file to docker context for e…
anamnavi May 23, 2022
51b7a9f
merge changes from master, resolve merge conflicts
anamnavi May 31, 2022
4df41d0
update dockerfile code
anamnavi Jun 6, 2022
78fc553
pull master, resolve merge conflicts
anamnavi Jun 6, 2022
6553aca
updte ubuntu20 and ubuntu22 to not use ADD
anamnavi Jun 6, 2022
6145b0c
use PackageFormat instead of hardcoded paths to determine path for po…
anamnavi Jun 8, 2022
36a6461
clean up extra ARG code in mariner image
anamnavi Jun 8, 2022
cb007a5
ubuntu20 update meta.json to specify .deb in PackageFormat
anamnavi Jun 8, 2022
f3e3761
use ENV var instead of ARG var in Ubuntu22
anamnavi Jun 8, 2022
b9f15fc
reduce debian image size by using mount
anamnavi Jun 14, 2022
05edf24
debian 10,11 for 7-2,7-3 should use mount to minimize image size
anamnavi Jun 14, 2022
71800fc
ubuntu20 and ubuntu22 should use mount to reduce image size
anamnavi Jun 14, 2022
32ea65e
mariner2 7-2 should use mount, mariner2 7-3 clean up
anamnavi Jun 14, 2022
7c294da
ubuntu22 and ubuntu20 clean up
anamnavi Jun 14, 2022
585abd8
ps_install_version needs to be an arg
anamnavi Jun 15, 2022
0e889c9
add simple caching logic
anamnavi Jun 20, 2022
2d4f4df
add function and parameter switch to reset docker cache
anamnavi Jun 24, 2022
eae0593
let ResetDockerCache param belong to all parameter sets
anamnavi Jun 28, 2022
915290c
revert changes to unstable images
anamnavi Jul 18, 2022
4cd1bff
merge conflicts to mariner2 images
anamnavi Jul 18, 2022
8bf1dc9
Merge branch 'master' of https://github.com/anamnavi/PowerShell-Docke…
anamnavi Jul 26, 2022
937e78c
replace variable holders in the package name with values when caching
anamnavi Jul 26, 2022
7441011
undo refactoring as channelTag is becomign null
anamnavi Jul 26, 2022
32387f6
fix typo
anamnavi Aug 3, 2022
89ac18d
merge changes from master, resolve merge conflicts
anamnavi Aug 3, 2022
bf726a1
channelTag param should not be mandatory in helper method as can be n…
anamnavi Aug 8, 2022
4154e9d
allmeta.meta.PackageFormat would be empty for test-deps images so mov…
anamnavi Aug 8, 2022
f05c075
see why download of pwsh installer file is failing
anamnavi Aug 8, 2022
908b869
add try catch around downloadFile()
anamnavi Aug 8, 2022
1f0b8d5
simplify catch
anamnavi Aug 8, 2022
fd568a4
remove verbose statement
anamnavi Aug 8, 2022
206a6d2
clean up code comments
anamnavi Aug 8, 2022
e122b2e
fix typos in powershell release file generation
anamnavi Aug 8, 2022
4cd013d
remove typo from powershell installer uri
anamnavi Aug 8, 2022
06bb17c
remove commented out code
anamnavi Aug 8, 2022
b9681df
output more vars in throw
anamnavi Aug 8, 2022
5b91b3f
output more vars in throw
anamnavi Aug 8, 2022
f86e8d0
set powershell installer file url with container name
anamnavi Aug 9, 2022
44a9601
clear channeltag so previous channel tag does not persist and selecti…
anamnavi Aug 9, 2022
2806f44
define powershell package instller url separately
anamnavi Aug 9, 2022
9d91ff8
fix typo that adds extra slash in powershell installer uri
anamnavi Aug 9, 2022
9bc9c34
add channelTag to packageFormat in images meta json file
anamnavi Aug 10, 2022
b6cfad9
only rpm an deb file extension package formats need chaa\nnelTag
anamnavi Aug 10, 2022
0b63a64
v character prepended to version should not be present in package for…
anamnavi Aug 10, 2022
506a8a6
fixunderscoring for rpm
anamnavi Aug 10, 2022
0aa78ff
fix underscoring and 'v' being added to create package url properly
anamnavi Aug 10, 2022
ba35bff
add try catch around downloadFile() call
anamnavi Aug 10, 2022
601e66d
add / in url
anamnavi Aug 10, 2022
3801a6d
clean up code
anamnavi Aug 10, 2022
1bf8057
reset channelTag each time Get-TestParams method is entered to hopefu…
anamnavi Aug 10, 2022
999fd62
change unittests to use current preview and stable versions instead o…
anamnavi Aug 24, 2022
7960dfc
reset channelData when channeltag is set and write warning instead of…
anamnavi Aug 31, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 8 additions & 1 deletion build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -156,8 +156,10 @@ param(
[Parameter(ParameterSetName="GenerateMatrixJson")]
[string]
[ValidateSet('All','Linux','Windows')]
$OsFilter
$OsFilter,

[switch]
anamnavi marked this conversation as resolved.
Show resolved Hide resolved
$ResetPSDockerCache
)

DynamicParam {
Expand Down Expand Up @@ -227,6 +229,11 @@ Begin {

$ENV:DOCKER_BUILDKIT = 1

if ($ResetPSDockerCache)
{
Reset-CacheFolder
}

if ($PSCmdlet.ParameterSetName -notin 'GenerateMatrixJson', 'GenerateTagsYaml', 'DupeCheck', 'GenerateManifestLists' -and $Channel.Count -gt 1)
{
throw "Multiple Channels are not supported in this parameter set"
Expand Down
19 changes: 6 additions & 13 deletions release/7-2/alpine313/docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,11 @@

FROM alpine:3.13 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

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

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

# Create the install folder
RUN mkdir -p ${PS_INSTALL_FOLDER}
Expand All @@ -29,10 +23,9 @@ FROM alpine:3.13
# 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
ENV PS_INSTALL_FOLDER=/opt/microsoft/powershell/$PS_INSTALL_VERSION \
\
# Define Args and EnvS
ENV PS_INSTALL_VERSION=7 \
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 \
Expand Down
19 changes: 6 additions & 13 deletions release/7-2/alpine314/docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,11 @@

FROM alpine:3.14 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

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

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

# Create the install folder
RUN mkdir -p ${PS_INSTALL_FOLDER}
Expand All @@ -29,10 +23,9 @@ FROM alpine:3.14
# 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
ENV PS_INSTALL_FOLDER=/opt/microsoft/powershell/$PS_INSTALL_VERSION \
\
# Define Args and Envs
ENV PS_INSTALL_VERSION=7 \
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 \
Expand Down
52 changes: 11 additions & 41 deletions release/7-2/debian10/docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,52 +1,27 @@
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.

# Docker image file that describes an Debian image with PowerShell installed from Microsoft APT Repo
ARG imageRepo=debian

FROM ${imageRepo}:buster-slim AS installer-env
# Docker image file that describes an Debian 10 image with PowerShell installed from Microsoft APT Repo
FROM debian:buster-slim 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

# 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}
COPY ${PS_INSTALL_PATH} /tmp/powershell.deb

# Unzip the Linux tar.gz
RUN tar zxf /tmp/linux.tar.gz -C ${PS_INSTALL_FOLDER}
FROM debian:buster-slim as final-image

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

ARG PS_VERSION=7.0.0
ARG PS_INSTALL_VERSION=7

# 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
ENV PS_INSTALL_FOLDER=/opt/microsoft/powershell/$PS_INSTALL_VERSION \
\
# Define ENVs for Localization/Globalization
DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=false \
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-10

# Install dependencies and clean up
RUN apt-get update \
RUN --mount=from=installer-env,target=/mnt/pwsh,source=/tmp \
--mount=type=cache,target=/var/lib/apt \
--mount=type=cache,target=/var/cache/apt \
apt-get update \
&& apt-get install --no-install-recommends -y /mnt/pwsh/powershell.deb \
&& apt-get install --no-install-recommends -y \
# less is required for help in powershell
less \
Expand All @@ -71,12 +46,7 @@ RUN apt-get update \
# 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 \
&& locale-gen && update-locale \
# intialize powershell module cache
# and disable telemetry
&& export POWERSHELL_TELEMETRY_OPTOUT=1 \
Expand Down
4 changes: 2 additions & 2 deletions release/7-2/debian10/meta.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"IsLinux" : true,
"UseLinuxVersion" : false,
"PackageFormat": "powershell-${PS_VERSION}-linux-x64.tar.gz",
"PackageFormat": "powershell${channelTag}_${PS_VERSION}-1.deb_amd64.deb",
"osVersion": "Debian 10",
"SkipGssNtlmSspTests": false,
"tagTemplates": [
Expand All @@ -14,7 +14,7 @@
],
"SubImage": "test-deps",
"TestProperties": {
"size": 314
"size": 329
},
"EndOfLife": "2024-06-01",
"DistributionState": "Validated"
Expand Down
52 changes: 12 additions & 40 deletions release/7-2/debian11/docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,55 +1,32 @@
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.

# Docker image file that describes an Debian image with PowerShell installed from Microsoft APT Repo
# Docker image file that describes an Debian 11 image with PowerShell installed from Microsoft APT Repo

FROM debian:bullseye-slim 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
COPY ${PS_INSTALL_PATH} /tmp/powershell.deb

# Download the Linux tar.gz and save it
ADD ${PS_PACKAGE_URL} /tmp/linux.tar.gz
FROM debian:bullseye-slim as final-image

# 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 debian:bullseye-slim

ARG PS_VERSION=6.2.0
ARG PS_INSTALL_VERSION=7

# 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
ENV PS_INSTALL_FOLDER=/opt/microsoft/powershell/$PS_INSTALL_VERSION \
\
# Define ENVs for Localization/Globalization
DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=false \
# 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-11

# Install dependencies and clean up
RUN apt-get update \
RUN --mount=from=installer-env,target=/mnt/pwsh,source=/tmp \
--mount=type=cache,target=/var/lib/apt \
--mount=type=cache,target=/var/cache/apt \
apt-get update \
&& apt-get install --no-install-recommends -y /mnt/pwsh/powershell.deb \
&& apt-get install --no-install-recommends -y \
# less is required for help in powershell
less \
# requied to setup the locale
# required to setup the locale
locales \
# required for SSL
ca-certificates \
Expand All @@ -70,12 +47,7 @@ RUN apt-get update \
# 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 \
&& locale-gen && update-locale \
# intialize powershell module cache
# and disable telemetry
&& export POWERSHELL_TELEMETRY_OPTOUT=1 \
Expand Down
56 changes: 29 additions & 27 deletions release/7-2/mariner2/docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,27 +3,31 @@

FROM mcr.microsoft.com/cbl-mariner/base/core:2.0 AS installer-env

# Define Args for the needed to add the package
ARG PS_VERSION=7.2.5
ARG PS_PACKAGE=powershell-${PS_VERSION}-1.cm1.x86_64.rpm
ARG PS_PACKAGE_URL=https://github.com/PowerShell/PowerShell/releases/download/v${PS_VERSION}/${PS_PACKAGE}
ARG PS_INSTALL_VERSION=7-preview
COPY ${PS_INSTALL_PATH} /tmp/linux.tar.gz

# Download the Linux tar.gz and save it
ADD ${PS_PACKAGE_URL} /tmp/powershell.rpm
# define the folder we will be installing PowerShell to
ENV PS_INSTALL_VERSION=7 \
PS_INSTALL_FOLDER=/opt/microsoft/powershell/${PS_INSTALL_VERSION}

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

# Start a new stage so we lose all the tar.gz layers from the final image
FROM mcr.microsoft.com/cbl-mariner/base/core:2.0 AS powershell
# Install tar a gzip so we can unzip the tar.gz
RUN --mount=type=cache,target=/var/cache/tdnf \
tdnf install -y \
tar \
gzip \
&& tdnf clean all

ARG PS_VERSION=7.2.5
ARG PS_INSTALL_VERSION=7-preview
# 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 in the final image
FROM mcr.microsoft.com/cbl-mariner/base/core:2.0 AS final-image

# Define Args and Env needed to create links
ARG PS_INSTALL_VERSION=7-preview
ENV PS_INSTALL_FOLDER=/opt/microsoft/powershell/$PS_INSTALL_VERSION \
\
ENV PS_INSTALL_VERSION=7 \
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 \
Expand All @@ -49,18 +53,16 @@ RUN --mount=type=cache,target=/var/cache/tdnf \
# upgrade packages
&& tdnf upgrade -y \
# clean cached data
&& tdnf clean all

RUN --mount=type=cache,target=/var/cache/tdnf,rw \
--mount=from=installer-env,target=/mnt/rpm,source=/tmp \
rpm -i /mnt/rpm/powershell.rpm

# Create the pwsh symbolic link that points to powershell
RUN if [ -f "/opt/microsoft/powershell/7-preview/pwsh" ]; then ln -sf /opt/microsoft/powershell/7-preview/pwsh /usr/bin/pwsh; fi

# intialize powershell module cache
# and disable telemetry for this ONE session
RUN export POWERSHELL_TELEMETRY_OPTOUT=1 \
&& tdnf clean all \
# Give all user execute permissions and remove write permissions for others
&& 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 symbolic link that points to powershell
&& ln -s ${PS_INSTALL_FOLDER}/pwsh /usr/bin/pwsh-preview \
# intialize powershell module cache
# and disable telemetry
&& export POWERSHELL_TELEMETRY_OPTOUT=1 \
&& pwsh \
-NoLogo \
-NoProfile \
Expand Down