mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-23 11:50:44 +00:00
test images: Remove busybox-helper image
We cannot have any RUN commands in the Windows stage when using docker buildx, which is why we were using the busybox-helper image. The purpose of the image was to contain a few things that we would obtain by running a few commands: - symlinks for the busybox binary - run vcredist_x64.exe which would also give us the vcruntime140.dll which is necessary for dig or httpd. There are alternatives to the commands above that can be achieved in a Linux stage as well: - we can create the symlinks in a Linux stage with ln -s. Copying them over to Windows will allow them to work just as well as if they were being copied over from a Windows image. The 'Files\' prefix issue to the symlink target still persists. - we can download the vcruntime140.dll directly, allowing us to skip the vcredist_x64.exe installation.
This commit is contained in:
parent
979c644df2
commit
bdaf849c0f
@ -1,7 +1,7 @@
|
||||
dependencies:
|
||||
# agnhost: bump this one first
|
||||
- name: "agnhost"
|
||||
version: "2.26"
|
||||
version: "2.27"
|
||||
refPaths:
|
||||
- path: test/images/agnhost/VERSION
|
||||
match: \d.\d
|
||||
|
@ -29,7 +29,6 @@ RUN tar -xzvf /coredns.tgz &&\
|
||||
mv iperf-2.0.9-win64 iperf &&\
|
||||
mkdir /uploads
|
||||
|
||||
FROM e2eteam/busybox-helper:1.29.0 as busybox-helper
|
||||
FROM --platform=linux/amd64 $REGISTRY/windows-servercore-cache:1.0-linux-amd64-$OS_VERSION as servercore-helper
|
||||
FROM $BASEIMAGE
|
||||
|
||||
@ -42,7 +41,6 @@ FROM $BASEIMAGE
|
||||
# - curl, nc: used by a lot of e2e tests (inherited from BASEIMAGE)
|
||||
# from iperf image
|
||||
# install necessary packages: iperf
|
||||
COPY --from=busybox-helper /dig /dig
|
||||
COPY --from=servercore-helper /Windows/System32/netapi32.dll /Windows/System32/netapi32.dll
|
||||
COPY --from=prep /coredns.exe /coredns.exe
|
||||
COPY --from=prep /iperf /iperf
|
||||
|
@ -1 +1 @@
|
||||
2.26
|
||||
2.27
|
||||
|
@ -51,7 +51,7 @@ import (
|
||||
func main() {
|
||||
rootCmd := &cobra.Command{
|
||||
Use: "app",
|
||||
Version: "2.26",
|
||||
Version: "2.27",
|
||||
}
|
||||
|
||||
rootCmd.AddCommand(auditproxy.CmdAuditProxy)
|
||||
|
@ -18,21 +18,53 @@ ARG REGISTRY
|
||||
# We're using a Linux image to unpack the archive, then we're copying it over to Windows.
|
||||
FROM --platform=linux/amd64 alpine:3.6 as prep
|
||||
|
||||
RUN mkdir /tmp-dir
|
||||
ENV CURL_VERSION=7.57.0
|
||||
|
||||
# Available busybox functions retrieved by running busybox.exe --list
|
||||
ENV BUSYBOX_EXES="[ [[ ar arch ash awk base64 basename bash bunzip2 bzcat bzip2 cal cat chmod cksum clear cmp comm cp cpio cut date dc dd df diff dirname dos2unix dpkg-deb du echo ed egrep env expand expr factor false fgrep find fold fsync ftpget ftpput getopt grep groups gunzip gzip hd head hexdump id ipcalc kill killall less link ln logname ls lzcat lzma lzop lzopcat man md5sum mkdir mktemp mv nl od paste patch pgrep pidof pipe_progress pkill printenv printf ps pwd rev rm rmdir rpm rpm2cpio sed seq sh sha1sum sha256sum sha3sum sha512sum shred shuf sleep sort split ssl_client stat strings sum tac tail tar tee test timeout touch tr true truncate ttysize uname uncompress unexpand uniq unix2dos unlink unlzma unlzop unxz unzip usleep uudecode uuencode vi watch wc wget which whoami whois xargs xxd xz xzcat yes zcat"
|
||||
|
||||
ADD https://github.com/kubernetes-sigs/windows-testing/raw/master/images/busybox/busybox.exe /busybox-dir/busybox.exe
|
||||
ADD https://skanthak.homepage.t-online.de/download/curl-$CURL_VERSION.cab /curl.cab
|
||||
ADD https://eternallybored.org/misc/netcat/netcat-win32-1.12.zip /netcat.zip
|
||||
ADD https://downloads.isc.org/isc/bind9/9.14.10/BIND9.14.10.x64.zip /bind.zip
|
||||
|
||||
# We need vcruntime140.dll in order to run dig.exe, or httpd.exe
|
||||
ADD https://wikidll.com/download/24194/vcruntime140.zip /vcruntime140.zip
|
||||
|
||||
RUN apk --update add cabextract
|
||||
|
||||
# NOTE(claudiub): We're creating symlinks for each of the busybox binaries and after that we're copying
|
||||
# them over to Windows. Unfortunately, docker buildx has some issues copying over Windows symlinks.
|
||||
# "Files/" is always prepended to the symlink target. The symlinks themselves are relative paths,
|
||||
# so, in order to make use of them, we can simply add a busybox binary to Files\busybox.exe.
|
||||
RUN cd /busybox-dir/ && \
|
||||
for busybox_binary in $BUSYBOX_EXES; do ln -s busybox.exe $busybox_binary.exe; done && \
|
||||
mkdir Files && \
|
||||
cp busybox.exe Files/busybox.exe
|
||||
|
||||
RUN mkdir /curl-full /curl-dir && \
|
||||
cabextract -d /curl-full/ /curl.cab && \
|
||||
cp -r /curl-full/AMD64 /curl-full/CURL.LIC /curl-dir/ && \
|
||||
mkdir /netcat-dir && \
|
||||
unzip /netcat.zip -d /netcat-dir/ && \
|
||||
mkdir /bind-dir /dig-dir &&\
|
||||
unzip /bind.zip -d /bind-dir/ && \
|
||||
cp /bind-dir/dig.exe /bind-dir/nslookup.exe /bind-dir/*.dll /dig-dir/ && \
|
||||
unzip /vcruntime140.zip -d / && \
|
||||
mkdir /tmp-dir
|
||||
|
||||
|
||||
# Windows Stage
|
||||
|
||||
FROM e2eteam/busybox-helper:1.29.0 as busybox-helper
|
||||
FROM e2eteam/powershell-helper:6.2.7 as ps-helper
|
||||
FROM $BASEIMAGE
|
||||
|
||||
COPY --from=prep /tmp-dir /tmp
|
||||
COPY --from=busybox-helper /bin /bin
|
||||
|
||||
# NOTE(claudiub): Unfortunately, docker buildx has some issues copying over Windows symlinks.
|
||||
# "Files/" is always prepended to the symlink target. The symlinks themselves are relative paths,
|
||||
# so, in order to make use of them, we can simply add a busybox binary to C:\bin\Files\busybox.exe.
|
||||
COPY --from=busybox-helper /bin/busybox.exe /bin/Files/
|
||||
COPY --from=busybox-helper /curl /curl
|
||||
COPY --from=busybox-helper /netcat/nc64.exe /bin/nc.exe
|
||||
COPY --from=prep /busybox-dir /bin
|
||||
COPY --from=prep /curl-dir /curl
|
||||
COPY --from=prep /netcat-dir/nc64.exe /bin/nc.exe
|
||||
COPY --from=prep /dig-dir /dig
|
||||
COPY --from=prep /vcruntime140.dll /Windows/System32/
|
||||
|
||||
# include powershell and its Module analysis cache.
|
||||
COPY --from=ps-helper ["/PowerShell", "/Program Files/PowerShell"]
|
||||
@ -46,7 +78,7 @@ ADD hostname /bin/hostname.exe
|
||||
USER ContainerAdministrator
|
||||
|
||||
# NOTE(claudiub): docker buildx sets the PATH env variable to a Linux-like PATH, which is not desirable.
|
||||
ENV PATH="C:\bin;C:\curl;C:\Windows\System32;C:\Windows;C:\Program Files\PowerShell;" \
|
||||
ENV PATH="C:\dig\;C:\bin;C:\curl;C:\Windows\System32;C:\Windows;C:\Program Files\PowerShell;" \
|
||||
ProgramFiles="C:\Program Files" \
|
||||
# set a fixed location for the Module analysis cache
|
||||
LOCALAPPDATA="C:\Users\ContainerAdministrator\AppData\Local" \
|
||||
|
@ -20,11 +20,9 @@ FROM --platform=linux/amd64 alpine:3.6 as prep
|
||||
ADD https://github.com/coredns/coredns/releases/download/v1.5.0/coredns_1.5.0_windows_amd64.tgz /coredns.tgz
|
||||
RUN tar -xzvf /coredns.tgz
|
||||
|
||||
FROM e2eteam/busybox-helper:1.29.0 as busybox-helper
|
||||
FROM $BASEIMAGE
|
||||
|
||||
COPY --from=prep /coredns.exe /coredns.exe
|
||||
COPY --from=busybox-helper /dig /dig
|
||||
|
||||
# NOTE(claudiub): docker buildx sets the PATH env variable to a Linux-like PATH, which is not desirable.
|
||||
ENV PATH="C:\dig\;C:\bin;C:\curl;C:\Windows\System32;C:\Windows;C:\Program Files\PowerShell;"
|
||||
|
@ -1 +1 @@
|
||||
1.3
|
||||
1.4
|
||||
|
@ -17,7 +17,7 @@ REMOTE_DOCKER_URL ?=
|
||||
DOCKER_CERT_PATH ?= "$(HOME)/.docker"
|
||||
export
|
||||
|
||||
ALL_IMAGES = busybox-helper powershell-helper
|
||||
ALL_IMAGES = powershell-helper
|
||||
|
||||
sub-build-%:
|
||||
img_version=$(shell cat $*/VERSION); \
|
||||
|
@ -1,56 +0,0 @@
|
||||
# Copyright 2020 The Kubernetes Authors.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
FROM mcr.microsoft.com/windows/servercore:ltsc2019 as prep
|
||||
|
||||
ENV CURL_VERSION=7.57.0
|
||||
|
||||
ADD https://github.com/kubernetes-sigs/windows-testing/raw/master/images/busybox/busybox.exe /bin/busybox.exe
|
||||
ADD https://skanthak.homepage.t-online.de/download/curl-$CURL_VERSION.cab /curl/curl.cab
|
||||
ADD https://eternallybored.org/misc/netcat/netcat-win32-1.12.zip /netcat/netcat.zip
|
||||
ADD https://downloads.isc.org/isc/bind9/9.14.10/BIND9.14.10.x64.zip /bind.zip
|
||||
|
||||
USER ContainerAdministrator
|
||||
|
||||
# NOTE(claudiub): We have to create relative path symlinks because docker buildx has an issue when copying
|
||||
# over symlinks, it prepends "Files\" to the symlink target. "Files\C:\bin\busybox.exe" would be an
|
||||
# invalid path.
|
||||
RUN cd C:\bin && FOR /f "tokens=*" %i IN ('.\busybox --list') DO mklink .\%i.exe busybox.exe
|
||||
|
||||
RUN cd C:\curl &\
|
||||
expand /R curl.cab /F:* . &\
|
||||
del C:\curl\curl.cab &\
|
||||
cd C:\netcat &\
|
||||
tar.exe -xf netcat.zip &\
|
||||
del netcat.zip &\
|
||||
setx /M PATH "C:\bin;C:\curl\;%PATH%"
|
||||
|
||||
# Download bind and prepare a folder just for dig.
|
||||
RUN powershell -Command "\
|
||||
Expand-Archive -Path C:\bind.zip -DestinationPath C:\bind; \
|
||||
$s = [System.Diagnostics.Process]::Start('C:\bind\vcredist_x64.exe', '/quiet'); \
|
||||
$s.WaitForExit(); \
|
||||
mkdir C:\dig; \
|
||||
cp C:\bind\dig.exe C:\dig\; \
|
||||
cp C:\bind\nslookup.exe C:\dig\; \
|
||||
cp C:\bind\*.dll C:\dig\; \
|
||||
cp C:\Windows\System32\vcruntime140.dll C:\dig\; \
|
||||
rm C:\bind.zip;"
|
||||
|
||||
FROM mcr.microsoft.com/windows/nanoserver:1809
|
||||
|
||||
COPY --from=prep /bin /bin
|
||||
COPY --from=prep /curl/AMD64 /curl/CURL.LIC /curl/
|
||||
COPY --from=prep /dig /dig
|
||||
COPY --from=prep /netcat /netcat
|
@ -1 +0,0 @@
|
||||
1.29.0
|
Loading…
Reference in New Issue
Block a user