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

Make Detector tests work on Windows #337

Open
natalieparellano opened this issue Jul 16, 2020 · 6 comments
Open

Make Detector tests work on Windows #337

natalieparellano opened this issue Jul 16, 2020 · 6 comments
Labels
help wanted Need some extra hands to the this done. os/windows status/ready type/chore

Comments

@natalieparellano
Copy link
Member

natalieparellano commented Jul 16, 2020

Currently, the acceptance tests don't work on Windows. We should fix that!

Known issues with analyzer acceptance tests (#319):

  • Can't connect to insecure registry. Because --network host does not work on Windows, the analyzer (running in a container) will need to access the test registry via the registry's container IP + port 5000. But, the test registry is an insecure registry, and the docker daemon will not allow this unless it has been explicitly configured to trust the registry at that IP. According to here, we aren't able to configure the docker daemon in a GHA action runner. A self-hosted runner may be necessary.
  • Can't seed docker volume via a stopped container. For the tests that use a cache directory, we need a way to create a docker volume and seed it with the cache directory fixture contents. The current recommendation for how to do this is to use an intermediary container. This approach does not work on Windows. There are two options (copied from Slack):
    1.) docker cp into the stopped container in a non-volume mount path, then start the container with a command to copy from the non-volume path to the volume path
    2) Stream the content into the container with something like a tar -c -f- my-stuff | docker run -v my-vol:c:/vol img tar.exe -x -f- -C c:/vol

Other needed things:

  • Convert paths to Windows paths if running on Windows (e.g., /some/path -> C:\some\path)
  • Convert mount target paths to Windows paths if running on Windows (e.g., /some/target -> C:/some/target)
  • Add the Windows equivalent to acceptance/variables/variables.go:
package variables

const (
	ContainerBaseImage = "mcr.microsoft.com/windows/nanoserver:1809"
	DockerfileName     = "Dockerfile.windows"
	VolumeHelperImage  = "mcr.microsoft.com/windows/nanoserver:1809"
)

var DummyCommand = []string{"cmd", "/c", "dir"}

var DockerSocketMount = []string{
	"--volume", "\\\\.\\pipe\\docker_engine:\\\\.\\pipe\\docker_engine",
	"--user", "ContainerAdministrator",
}
  • Add the Windows equivalent to acceptance/testdata/analyzer/analyze-image/Dockerfile:
FROM mcr.microsoft.com/windows/nanoserver:1809

COPY container /

WORKDIR /layers

ENV CNB_USER_ID=2222

ENV CNB_GROUP_ID=3333
@yaelharel
Copy link
Contributor

I think this issue should cover making all acceptance tests run on Windows.

@jromero
Copy link
Member

jromero commented Feb 9, 2021

#524 may be able to assist with the first bullet point here if the non-daemon case is used.

@ekcasey
Copy link
Member

ekcasey commented Feb 16, 2021

@jromero why not add templates for new APIs in advance of support in all suggested builders? Users can still choose an older API template right?

@jromero
Copy link
Member

jromero commented Feb 16, 2021

@jromero why not add templates for new APIs in advance of support in all suggested builders? Users can still choose an older API template right?

Not sure I understand the question in relation to this issue. In what context should I be thinking about these questions?

@ekcasey
Copy link
Member

ekcasey commented Feb 18, 2021

@jromero I failed at tabs and posted that in the wrong issue I think, apologies

@natalieparellano natalieparellano changed the title Make acceptance tests work on Windows Make Detector, Analyzer, & Restorer tests work on Windows Mar 23, 2021
@natalieparellano natalieparellano changed the title Make Detector, Analyzer, & Restorer tests work on Windows Make Detector tests work on Windows Mar 23, 2021
@natalieparellano
Copy link
Member Author

Updated issue title as we currently have a PR to add Windows support to Analyzer acceptance tests.

@natalieparellano natalieparellano added type/chore and removed type/enhancement New feature or request labels Feb 25, 2022
@natalieparellano natalieparellano added the help wanted Need some extra hands to the this done. label Jul 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Need some extra hands to the this done. os/windows status/ready type/chore
Projects
None yet
Development

No branches or pull requests

5 participants