Skip to content

Commit e8c2c57

Browse files
authoredMar 15, 2023
Update mariner preview dotnet runtime install (#741)
1 parent 801c319 commit e8c2c57

File tree

3 files changed

+48
-15
lines changed

3 files changed

+48
-15
lines changed
 

‎.vsts-ci/phase.yml

+13-3
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,19 @@ parameters:
2323
jobs:
2424
- job: ${{ parameters.jobName }}
2525
dependsOn: ${{ parameters.dependsOn }}
26+
2627
strategy:
2728
matrix: $[ ${{ parameters.matrix }} ]
2829
maxParallel: ${{ parameters.maxParallel }}
2930

3031
variables:
31-
ContinueOnError: ${{ parameters.continueonerror }}
32-
scanType: Register
33-
pool: ${{ parameters.pool }}
32+
- group: Cache-ACR
33+
- name: ContinueOnError
34+
value: ${{ parameters.continueonerror }}
35+
- name: scanType
36+
value: Register
37+
- name: pool
38+
value: ${{ parameters.pool }}
3439

3540
pool:
3641
${{ if eq(parameters['pool'],'')}}:
@@ -72,6 +77,11 @@ jobs:
7277
Install-module Pester -Scope CurrentUser -Force -MaximumVersion 4.99
7378
displayName: Install Pester
7479
condition: and( succeededOrFailed(), ne(variables['Channel'],''))
80+
81+
- pwsh: |
82+
docker login psdockercache.azurecr.io -u $(dockerCacheUserName) -p $(dockerCacheKey)
83+
displayName: 'docker cache login'
84+
condition: and( succeededOrFailed(), ne(variables['Channel'],''))
7585
7686
- pwsh: |
7787
$extraParams = @{}

‎release/7-4/mariner2/docker/Dockerfile

+34-11
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,14 @@
11
# Copyright (c) Microsoft Corporation.
22
# Licensed under the MIT License.
33

4-
FROM mcr.microsoft.com/cbl-mariner/base/core:2.0 AS installer-env
4+
FROM mcr.microsoft.com/cbl-mariner/base/core:2.0 AS setup-tdnf-repa
5+
6+
RUN --mount=type=cache,target=/var/cache/tdnf \
7+
tdnf install -y mariner-repos-microsoft-preview \
8+
&& tdnf makecache
9+
10+
# Move to
11+
FROM setup-tdnf-repa AS installer-env
512

613
# Define Args for the needed to add the package
714
ARG PS_VERSION=7.3.0-preview.8
@@ -13,10 +20,24 @@ ARG PS_INSTALL_VERSION=7-preview
1320
# Download the Linux tar.gz and save it
1421
ADD ${PS_PACKAGE_URL} /tmp/powershell.rpm
1522

23+
RUN --mount=type=cache,target=/var/cache/tdnf \
24+
tdnf install -y \
25+
wget \
26+
awk \
27+
tar \
28+
ca-certificates
29+
30+
RUN --mount=type=cache,target=/var/cache/tdnf \
31+
--mount=type=cache,target=/installTmp \
32+
cd /installTmp \
33+
&& wget https://dot.net/v1/dotnet-install.sh -O dotnet-install.sh \
34+
&& chmod +x ./dotnet-install.sh \
35+
&& ./dotnet-install.sh -Channel 8.0 -Quality preview -Runtime dotnet -InstallDir /usr/share/dotnet
36+
1637
RUN echo ${PS_PACKAGE_URL}
1738

1839
# Start a new stage so we lose all the tar.gz layers from the final image
19-
FROM mcr.microsoft.com/cbl-mariner/base/core:2.0 AS powershell
40+
FROM setup-tdnf-repa AS powershell
2041

2142
ARG PS_VERSION=7.3.0-preview.8
2243
ARG PS_INSTALL_VERSION=7-preview
@@ -33,28 +54,30 @@ ENV PS_INSTALL_FOLDER=/opt/microsoft/powershell/$PS_INSTALL_VERSION \
3354
PSModuleAnalysisCachePath=/var/cache/microsoft/powershell/PSModuleAnalysisCache/ModuleAnalysisCache \
3455
POWERSHELL_DISTRIBUTION_CHANNEL=PSDocker-Mariner-2.0
3556

36-
# Install dependencies and clean up
3757
RUN --mount=type=cache,target=/var/cache/tdnf \
38-
tdnf install -y mariner-repos-microsoft-preview \
39-
&& tdnf makecache \
4058
# install dependencies
41-
&& tdnf install -y \
59+
tdnf install -y \
4260
# required for localization
4361
icu \
4462
# required for help in PowerShell
4563
less \
4664
# required for SSH
4765
openssh-clients \
48-
ca-certificates \
49-
dotnet-runtime-7.0 \
50-
# upgrade packages
51-
&& tdnf upgrade -y \
66+
ca-certificates
67+
68+
# Install dependencies and clean up
69+
RUN --mount=type=cache,target=/var/cache/tdnf \
70+
tdnf upgrade -y \
5271
# clean cached data
5372
&& tdnf clean all
5473

74+
COPY --from=installer-env /usr/share/dotnet /usr/share/dotnet
75+
76+
RUN ln -s /usr/share/dotnet/dotnet /usr/bin/dotnet
77+
5578
RUN --mount=type=cache,target=/var/cache/tdnf,rw \
5679
--mount=from=installer-env,target=/mnt/rpm,source=/tmp \
57-
rpm -i /mnt/rpm/powershell.rpm
80+
rpm -i --nodeps /mnt/rpm/powershell.rpm
5881

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

‎unittests/generateMatrixJson.tests.ps1

+1-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ Describe "build.ps1 -GenerateMatrixJson" {
4343
$json = $vstsVariable.Value
4444
{ $script:matrix += $json | ConvertFrom-Json -AsHashtable } | should -not -Throw
4545
}
46-
$script:matrix.count | Should -Be 3
46+
$script:matrix.count | Should -Be 4
4747
}
4848
It "Should have multiple images" {
4949
foreach($platforMatrix in $Script:matrix) {

0 commit comments

Comments
 (0)
Please sign in to comment.