buildpacks / lifecycle

Reference implementation of the Cloud Native Buildpacks lifecycle
https://buildpacks.io
Apache License 2.0
187 stars 107 forks source link

Errors when following `DEVELOPMENT.md` on Windows machine #1237

Open cormacpayne opened 1 year ago

cormacpayne commented 1 year ago

Summary

Hey there, I've been following the DEVELOPMENT.md file to generate some lifecycle binaries locally but am running into some issues on my Windows machine when running the set of make commands provided. I have all of the prerequisites installed and have tried the make commands listed with elevated instances of cmd, PowerShell and Git Bash, but all have run into the same set of issues.

Below are the errors I'm seeing for each make command ran:

make all

### TRUNCATED OUTPUT ###

--- PASS: TestPlatform (0.01s)
    --- PASS: TestPlatform/unit-platform/0.3 (0.00s)
        --- SKIP: TestPlatform/unit-platform/0.3/#NewPlatform/Platform_API_>=_0.6/configures_the_platform (0.00s)
        --- PASS: TestPlatform/unit-platform/0.3/#NewPlatform/Platform_API_<_0.6/configures_the_platform (0.00s)
    --- PASS: TestPlatform/unit-platform/0.4 (0.00s)
        --- SKIP: TestPlatform/unit-platform/0.4/#NewPlatform/Platform_API_>=_0.6/configures_the_platform (0.00s)
        --- PASS: TestPlatform/unit-platform/0.4/#NewPlatform/Platform_API_<_0.6/configures_the_platform (0.00s)
    --- PASS: TestPlatform/unit-platform/0.5 (0.00s)
        --- SKIP: TestPlatform/unit-platform/0.5/#NewPlatform/Platform_API_>=_0.6/configures_the_platform (0.00s)
        --- PASS: TestPlatform/unit-platform/0.5/#NewPlatform/Platform_API_<_0.6/configures_the_platform (0.00s)
    --- PASS: TestPlatform/unit-platform/0.6 (0.00s)
        --- PASS: TestPlatform/unit-platform/0.6/#NewPlatform/Platform_API_>=_0.6/configures_the_platform (0.00s)
        --- SKIP: TestPlatform/unit-platform/0.6/#NewPlatform/Platform_API_<_0.6/configures_the_platform (0.00s)
    --- PASS: TestPlatform/unit-platform/0.7 (0.00s)
        --- PASS: TestPlatform/unit-platform/0.7/#NewPlatform/Platform_API_>=_0.6/configures_the_platform (0.00s)
        --- SKIP: TestPlatform/unit-platform/0.7/#NewPlatform/Platform_API_<_0.6/configures_the_platform (0.00s)
    --- PASS: TestPlatform/unit-platform/0.8 (0.00s)
        --- PASS: TestPlatform/unit-platform/0.8/#NewPlatform/Platform_API_>=_0.6/configures_the_platform (0.00s)
        --- SKIP: TestPlatform/unit-platform/0.8/#NewPlatform/Platform_API_<_0.6/configures_the_platform (0.00s)
    --- PASS: TestPlatform/unit-platform/0.9 (0.00s)
        --- PASS: TestPlatform/unit-platform/0.9/#NewPlatform/Platform_API_>=_0.6/configures_the_platform (0.00s)
        --- SKIP: TestPlatform/unit-platform/0.9/#NewPlatform/Platform_API_<_0.6/configures_the_platform (0.00s)
    --- PASS: TestPlatform/unit-platform/0.10 (0.00s)
        --- PASS: TestPlatform/unit-platform/0.10/#NewPlatform/Platform_API_>=_0.6/configures_the_platform (0.00s)
        --- SKIP: TestPlatform/unit-platform/0.10/#NewPlatform/Platform_API_<_0.6/configures_the_platform (0.00s)
    --- PASS: TestPlatform/unit-platform/0.11 (0.00s)
        --- PASS: TestPlatform/unit-platform/0.11/#NewPlatform/Platform_API_>=_0.6/configures_the_platform (0.00s)
        --- SKIP: TestPlatform/unit-platform/0.11/#NewPlatform/Platform_API_<_0.6/configures_the_platform (0.00s)
    --- PASS: TestPlatform/unit-platform/0.12 (0.00s)
        --- PASS: TestPlatform/unit-platform/0.12/#NewPlatform/Platform_API_>=_0.6/configures_the_platform (0.00s)
        --- SKIP: TestPlatform/unit-platform/0.12/#NewPlatform/Platform_API_<_0.6/configures_the_platform (0.00s)
PASS
ok      github.com/buildpacks/lifecycle/platform/launch 2.025s
FAIL
make: *** [Makefile:289: unit] Error 1
make build

C:\lifecycle>make build
"> Building lifecycle/lifecycle for linux/amd64..."
mkdir -p C:\lifecycle\out/linux-amd64/lifecycle
The syntax of the command is incorrect.
make: *** [Makefile:73: C:\lifecycle\out/linux-amd64/lifecycle/lifecycle] Error 1
make package

C:\lifecycle>make package
"> Installing syft..."
curl -sSfL https://raw.githubusercontent.com/anchore/syft/main/install.sh | sh -s -- -b /usr/local/bin
\033[0;31m\033[1m[error]\033[0m unable to find tag='' \033[0m
\033[0;31m\033[1m[error]\033[0m do not specify a version or select a valid version from https://github.com/anchore/syft/releases \033[0m
make: *** [Makefile:244: install-syft] Error 1

Proposal

Any additional guidance on how these make commands should be executed on a Windows machine would be great :smile:


Context

N/A

natalieparellano commented 1 year ago

Oof, sorry about that @cormacpayne - I guess we never run that make target on Windows in CI so we haven't caught this. You can try installing syft with Chocolatey and then commenting out the install-syft target. Eventually we'll need to add some branching logic similar to here to perform the correct installation for the OS.

cormacpayne commented 12 months ago

@natalieparellano Hey Natalie, sorry for the delayed response, and thanks for the reply as always -- I was able to get this to work locally by using WSL, but also found the behavior was more consistent (and easier to manage) by forking the repository and modifying the build.yml GitHub Action workflow. I'm in a good development state now, so however you'd like to prioritize this item is OK with me.

As a quick follow-up question so to not open an entirely different issue (possibly for the pack repo): if I use the build.yml workflow to publish a lifecycle image to my personal container registry, is there a way to create a builder that's built on top of that lifecycle image? The flow I've been trying based on my understanding is to push my lifecycle image foobar.azurecr.io/lifecycle:1.2.3, use pack config lifecycle-image foobar.azurecr.io/lifecycle to set the repository, and then set lifecycle.version to 1.2.3 in the builder.toml file. Even after this, it seems like pack builder create will still use lifecycle GitHub releases if the lifecycle.version property is set and ignore what was set by pack config lifecycle-image.

natalieparellano commented 11 months ago

@cormacpayne I'm sorry that say that pack doesn't support creating builders from lifecycle images. I myself have wanted this feature for a long time. But you can run make build-<os>-<arch> package-<os>-<arch> and the resulting tarball can be specified in your builder config like so:

[lifecycle]
uri = "<path to tarball>"

I hope this helps!

cormacpayne commented 11 months ago

@natalieparellano OK that's what I figured, but just wanted to double-check -- thanks for the clarification!