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

Tiltfile OUTPUT_TO_NULL_COMMAND not recognized on Windows #149

Open
andrew-woosnam opened this issue Dec 12, 2022 · 3 comments
Open

Tiltfile OUTPUT_TO_NULL_COMMAND not recognized on Windows #149

andrew-woosnam opened this issue Dec 12, 2022 · 3 comments

Comments

@andrew-woosnam
Copy link
Contributor

Describe the bug
After cloning the steeltoe-weatherforecast accelerator to a Windows OS, running tilt up fails by default, raising a "path not found" error:

Successfully loaded Tiltfile (3.024ms)
   sample-app â"‚ 
   sample-app â"‚ Initial Build
   sample-app â"‚ STEP 1/1 â€" Deploying
   sample-app â"‚      Running cmd: tanzu apps workload apply -f config/workload.yaml --update-strategy replace --debug --live-update --local-path . --source-image your-registry.io/project/steeltoe-weatherforecast-source --build-env BP_DEBUG_ENABLED=true --namespace default --yes  > /dev/null  && kubectl get workload sample-app --namespace default -o yaml
   sample-app â"‚      The system cannot find the path specified.
   sample-app â"‚ 
   sample-app â"‚ ERROR: Build Failed: apply command exited with status 1

To Reproduce
Steps to reproduce the behavior:

  1. Open the steeltoe-weatherforecast accelerator in Windows
  2. Invoke tilt up from the root project directory

Expected behavior
tilt up command to succeed.

Additional context

  • This error goes away after removing the OUTPUT_TO_NULL_COMMAND from the default Tiltfile's apply_cmd string.
  • > NUL might be a suitable Windows equivalent to > /dev/null
@andrew-woosnam
Copy link
Contributor Author

Update: we should be able to override this env var before invoking tilt up (making it runnable on Windows), but in general I'm guessing NUL might be a friendlier default than /dev/null, assuming a majority of folks using this accelerator will be using Windows?

@vrabbi
Copy link

vrabbi commented Dec 14, 2022

another option is to use apply_cmd_bat as well in the tiltfile
the relevant part could look like:

  apply_cmd="tanzu apps workload apply -f config/workload.yaml --debug --live-update" +
            " --local-path " + LOCAL_PATH +
            " --source-image " + SOURCE_IMAGE +
            " --namespace " + NAMESPACE +
            " --build-env BP_DEBUG_ENABLED=true" +
            " --yes " +
            " > /dev/null " +
            " && kubectl get workload " + NAME + " --namespace " + NAMESPACE + " -o yaml",
  apply_cmd_bat="tanzu apps workload apply -f config/workload.yaml --debug --live-update" +
            " --local-path " + LOCAL_PATH +
            " --source-image " + SOURCE_IMAGE +
            " --namespace " + NAMESPACE +
            " --build-env BP_DEBUG_ENABLED=true" +
            " --yes " +
            " > NUL " +
            " && kubectl get workload " + NAME + " --namespace " + NAMESPACE + " -o yaml",

based on tilt docs:

apply_cmd_bat ( Union [ str , List [ str ]]) – If non-empty and on Windows, takes precedence over apply_cmd . Ignored on other platforms. If a string, executed as a Windows batch command executed with cmd /S /C ; if a list, will be passed to the operating system as program name and args.

This will allow the accelerator Tilt config to work on any OS. while i hardcoded the values, there could be 2 VARS set at the top something like:

OUTPUT_TO_NULL_COMMAND_WIN = ' > NUL '
OUTPUT_TO_NULL_COMMAND = ' > /dev/null '

@TimHess
Copy link
Member

TimHess commented Feb 24, 2023

@trisberg I think this issue can be closed now that tanzu apps has added -oyaml

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants