Closed brandond closed 2 years ago
@phillipsj the second commit here seems to get me the proper behavior on Windows.
Output on Linux:
brandond@dev01:/var/lib/repos/go/src/github.com/rancher/wharfie$ ./wharfie --debug rancher/k3s:v1.22.2-k3s2 /etc:./k3s/etc
INFO[0000] Extract mapping /etc => /var/lib/repos/go/src/github.com/rancher/wharfie/k3s/etc
INFO[0000] Pulling image index.docker.io/rancher/k3s:v1.22.2-k3s2
INFO[0001] Extracting file etc/nsswitch.conf to /var/lib/repos/go/src/github.com/rancher/wharfie/k3s/etc/nsswitch.conf
INFO[0001] Extracting file etc/os-release to /var/lib/repos/go/src/github.com/rancher/wharfie/k3s/etc/os-release
DEBU[0001] Skipping file tmp/
DEBU[0001] Skipping file bin/
Output on Windows:
C:\Users\brandond\repos\github.com\rancher\wharfie>wharfie.exe --debug --os=linux rancher/k3s:v1.22.2-k3s2 /etc:C:\temp\k3s\etc
time="2021-11-03T12:11:49-07:00" level=info msg="Extract mapping /etc => C:\\temp\\k3s\\etc"
time="2021-11-03T12:11:49-07:00" level=info msg="Pulling image index.docker.io/rancher/k3s:v1.22.2-k3s2"
time="2021-11-03T12:11:50-07:00" level=info msg="Extracting file etc/nsswitch.conf to C:\\temp\\k3s\\etc\\nsswitch.conf"
time="2021-11-03T12:11:50-07:00" level=info msg="Extracting file etc/os-release to C:\\temp\\k3s\\etc\\os-release"
time="2021-11-03T12:11:50-07:00" level=debug msg="Skipping file tmp/"
time="2021-11-03T12:11:50-07:00" level=debug msg="Skipping file bin/"
@brandond can you please pull a Windows image on Windows to make sure that it works, your test is only doing Linux.
@brandond can you please pull a Windows image on Windows to make sure that it works, your test is only doing Linux.
@brandond please do pull the Windows image as @phillipsj suggests
@phillipsj can you provide a sample Windows image?
A tarfile is a tarfile so I can't imagine it'll make a difference but I'm glad to show an example.
That was the exact use case that was failing.
docker pull rancher/system-agent-installer-rke2:v1.22.3-rc2-rke2r1
This one also works: v1.21.6-rke2r1
The path to extract is: /Files/bin
When in doubt, add tests! Then fix them. Apologies for not having these in the first place. CI doesn't test Windows but I'm building and testing there locally.
@phillipsj output on windows:
C:\Users\brandond\repos\github.com\rancher\wharfie>wharfie.exe --debug rancher/system-agent-installer-rke2:v1.22.3-rc2-rke2r1 /Files/bin:C:\temp\bin\
time="2021-11-03T16:47:48-07:00" level=info msg="Extract mapping /Files/bin => C:\\temp\\bin"
time="2021-11-03T16:47:48-07:00" level=info msg="Pulling image index.docker.io/rancher/system-agent-installer-rke2:v1.22.3-rc2-rke2r1"
time="2021-11-03T16:47:49-07:00" level=debug msg="Skipping file Files"
time="2021-11-03T16:47:49-07:00" level=debug msg="Skipping file Hives"
time="2021-11-03T16:47:49-07:00" level=debug msg="Skipping file Hives/DefaultUser_Delta"
time="2021-11-03T16:47:49-07:00" level=debug msg="Skipping file Hives/Sam_Delta"
time="2021-11-03T16:47:49-07:00" level=debug msg="Skipping file Hives/Security_Delta"
time="2021-11-03T16:47:49-07:00" level=debug msg="Skipping file Hives/Software_Delta"
time="2021-11-03T16:47:49-07:00" level=debug msg="Skipping file Hives/System_Delta"
time="2021-11-03T16:47:50-07:00" level=info msg="Creating directory C:\\temp\\bin"
time="2021-11-03T16:47:50-07:00" level=info msg="Extracting file Files/bin/installer.ps1 to C:\\temp\\bin\\installer.ps1"
time="2021-11-03T16:47:50-07:00" level=info msg="Extracting file Files/bin/rke2.windows-amd64.tar.gz to C:\\temp\\bin\\rke2.windows-amd64.tar.gz"
time="2021-11-03T16:47:52-07:00" level=info msg="Extracting file Files/bin/sha256sum-amd64.txt to C:\\temp\\bin\\sha256sum-amd64.txt"
time="2021-11-03T16:47:52-07:00" level=info msg="Extracting file Files/bin/run.ps1 to C:\\temp\\bin\\run.ps1"
time="2021-11-03T16:47:53-07:00" level=debug msg="Skipping file Files/License.txt"
time="2021-11-03T16:47:53-07:00" level=debug msg="Skipping file Files/ProgramData"
@brandond Can I ask why this was merged when #4 was already in?
Signed-off-by: Brad Davidson brad.davidson@rancher.com