phoenixframework / tailwind

An installer for tailwind
MIT License
465 stars 60 forks source link

Builds in WoodpeckerCI fail due to a default HTTPS_PROXY environment variable. #90

Open wkpatrick opened 11 months ago

wkpatrick commented 11 months ago

Problem

Builds run in WoodpeckerCI fail due to it setting HTTPS_PROXY to some value by default that does not match what this library expects.

+ cd .. && MIX_ENV=prod mix assets.deploy

01:10:30.698 [debug] Downloading tailwind from https://github.com/tailwindlabs/tailwindcss/releases/download/v3.2.7/tailwindcss-linux-x64

01:10:30.701 [debug] Using HTTPS_PROXY: 
** (FunctionClauseError) no function clause matching in String.to_charlist/1    

    The following arguments were given to String.to_charlist/1:

        # 1
        nil

    Attempted function clauses (showing 1 out of 1):

        def to_charlist(+string+) when -is_binary(string)-

    (elixir 1.14.4) lib/string.ex:2530: String.to_charlist/1
    (tailwind 0.2.1) lib/tailwind.ex:276: Tailwind.fetch_body!/1
    (tailwind 0.2.1) lib/tailwind.ex:224: Tailwind.install/1
    (tailwind 0.2.1) lib/tailwind.ex:205: Tailwind.install_and_run/2
    (tailwind 0.2.1) lib/mix/tasks/tailwind.ex:57: Mix.Tasks.Tailwind.install_and_run/1
    (mix 1.14.4) lib/mix/task.ex:421: anonymous fn/3 in Mix.Task.run_task/4
    (mix 1.14.4) lib/mix/task.ex:479: Mix.Task.run_alias/6
    (mix 1.14.4) lib/mix/cli.ex:84: Mix.CLI.run_task/2

Solution

Should the library silently (or with a log message, but still continue running) continue without setting a proxy when URI.parse cant parse the environment variable? If so, id be happy to get a PR up this weekend for that.

reavessm commented 5 months ago

I'm noticing the same issue in an OpenShift BuildConfig. Is there a fix/workaround?

EDIT: I was able to get it working by force unsetting the vars inline with the mix assets.deploy command, but I'd rather not have to do that.

Here is the relevant section of my Containerfile:

RUN unset HTTPS_PROXY && unset HTTP_PROXY \
  && mix deps.get --only prod \
  && mix deps.compile \
  && mix assets.deploy \
  && mix compile \
  && mix release