Skip to content

Commit 18d682e

Browse files
Merge pull request openshift#8643 from openshift-splat-team/SPLAT-1670
SPLAT-1670: install pwsh from ci mirrored image
2 parents d0badc5 + 3859cea commit 18d682e

File tree

1 file changed

+19
-12
lines changed

1 file changed

+19
-12
lines changed

images/installer/Dockerfile.upi.ci

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ RUN DEFAULT_ARCH="$(go env GOHOSTARCH)" hack/build.sh
2323

2424
FROM registry.ci.openshift.org/ocp/4.17:cli as cli
2525
FROM quay.io/ocp-splat/govc:v0.30.7 as govc
26+
FROM quay.io/ocp-splat/pwsh:v7.3.12 as pwsh
2627
FROM quay.io/multi-arch/yq:3.3.0 as yq3
2728
FROM quay.io/multi-arch/yq:4.30.5 as yq4
2829

@@ -31,23 +32,33 @@ COPY --from=cli /usr/bin/oc /bin/oc
3132
COPY --from=builder /go/src/github.com/openshift/installer/bin/openshift-install /bin/openshift-install
3233
COPY --from=builder /go/src/github.com/openshift/installer/upi /var/lib/openshift-install/upi
3334

35+
# Install VMware plugin for powershell
36+
COPY --from=pwsh /opt/microsoft/powershell /opt/microsoft/powershell
37+
COPY --from=pwsh /root/.local/share/powershell/Modules /root/.local/share/powershell/Modules
38+
COPY --from=pwsh /usr/local/share/powershell/Modules /usr/local/share/powershell/Modules
39+
RUN ln -s /opt/microsoft/powershell/7/pwsh /bin/pwsh
40+
ENV DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=true
41+
42+
# Create settings directory /output/.local/share/VMware/PowerCLI
43+
RUN mkdir -p /output/.local/share/VMware/PowerCLI && chmod -R 777 /output/.local
44+
45+
# Install azure-cli
46+
COPY --from=pwsh /go/src/github.com/openshift/installer/azure-cli /go/src/github.com/openshift/installer/azure-cli
47+
RUN ln -s /go/src/github.com/openshift/installer/azure-cli/bin/az /bin/az
48+
3449
COPY --from=govc /govc /bin/govc
3550

36-
RUN rpm --import https://packages.microsoft.com/keys/microsoft.asc && \
37-
sh -c 'echo -e "[packages-microsoft-com-prod]\nname=packages-microsoft-com-prod\nbaseurl=https://packages.microsoft.com/rhel/9/prod\nenabled=1\ngpgcheck=1\ngpgkey=https://packages.microsoft.com/keys/microsoft.asc" >/etc/yum.repos.d/microsoft-prod.repo' && \
38-
sh -c 'echo -e "[google-cloud-cli]\nname=Google Cloud CLI\nbaseurl=https://packages.cloud.google.com/yum/repos/cloud-sdk-el9-x86_64\nenabled=1\ngpgcheck=1\nrepo_gpgcheck=0\ngpgkey=https://packages.cloud.google.com/yum/doc/rpm-package-key.gpg" > /etc/yum.repos.d/google-cloud-sdk.repo'
51+
RUN sh -c 'echo -e "[google-cloud-cli]\nname=Google Cloud CLI\nbaseurl=https://packages.cloud.google.com/yum/repos/cloud-sdk-el9-x86_64\nenabled=1\ngpgcheck=1\nrepo_gpgcheck=0\ngpgkey=https://packages.cloud.google.com/yum/doc/rpm-package-key.gpg" > /etc/yum.repos.d/google-cloud-sdk.repo'
3952

4053
RUN yum update -y && \
41-
yum install --setopt=tsflags=nodocs -y \
42-
azure-cli-2.49.0-1.el9 \
54+
yum install --setopt=tsflags=nodocs -y \
4355
gettext \
4456
google-cloud-cli-447.0.0-1 \
4557
gzip \
4658
jq \
4759
unzip \
4860
openssh-clients \
49-
openssl \
50-
powershell \
61+
openssl \
5162
python3-pip \
5263
python3-pyyaml \
5364
bind-utils \
@@ -74,7 +85,7 @@ RUN curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2
7485

7586
# Download the latest IBM Cloud release binary
7687
ARG IBMCLI_URI=https://clis.cloud.ibm.com/install/linux
77-
RUN mkdir /output && HOME=/output && \
88+
RUN HOME=/output && \
7889
echo "-4" > $HOME/.curlrc && \
7990
curl -fsSL ${IBMCLI_URI} | sh && \
8091
ibmcloud plugin install vpc-infrastructure -f && \
@@ -92,10 +103,6 @@ RUN mkdir /output && HOME=/output && \
92103
ibmcloud version && \
93104
ibmcloud plugin list
94105

95-
# Install VMware plugin for powershell. Create settings directory /output/.local/share/VMware/PowerCLI
96-
RUN pwsh -Command 'Install-Module VMware.PowerCLI -Force -Scope AllUsers' && \
97-
pwsh -Command 'Install-Module -Name EPS -RequiredVersion 1.0 -Force -Scope AllUsers' && \
98-
mkdir -p /output/.local/share/VMware/PowerCLI && chmod -R 777 /output/.local
99106

100107
RUN mkdir /output/.ssh && chown 1000:1000 "/output/.ssh/" && chmod -R g=u "/output/.ssh/"
101108

0 commit comments

Comments
 (0)