lifecycle
lifecycle copied to clipboard
Make Detector tests work on Windows
Currently, the acceptance tests don't work on Windows. We should fix that!
Known issues with analyzer acceptance tests (https://github.com/buildpacks/lifecycle/pull/319):
- Can't connect to insecure registry. Because
--network hostdoes 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
I think this issue should cover making all acceptance tests run on Windows.
#524 may be able to assist with the first bullet point here if the non-daemon case is used.
@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 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?
@jromero I failed at tabs and posted that in the wrong issue I think, apologies
Updated issue title as we currently have a PR to add Windows support to Analyzer acceptance tests.