bitwalker / distillery

Simplify deployments in Elixir with OTP releases!
MIT License
2.97k stars 398 forks source link

Powershell error when executing commands with Windows releases #612

Closed PaoloLaurenti closed 5 years ago

PaoloLaurenti commented 5 years ago

Steps to reproduce

Running any command of the generated .bat file will produce the following Powershell error: Set-Content : A parameter cannot be found that matches parameter name 'InputObject'.

Verbose Logs

``` $ MIX_ENV=prod mix release --env=prod --verbose --no-tar ==> base64url (compile) ===> Compiling mimerl ===> Compiling metrics ===> Compiling unicode_util_compat ===> Compiling idna ==> gettext Compiling 1 file (.erl) Compiling 20 files (.ex) Generated gettext app ==> jose Compiling 89 files (.erl) src/jose_public_key.erl:44: Warning: erlang:get_stacktrace/0: deprecated; use the new try/catch syntax for retrieving the stack backtrace src/jose_public_key.erl:60: Warning: erlang:get_stacktrace/0: deprecated; use the new try/catch syntax for retrieving the stack backtrace src/jose_public_key.erl:84: Warning: erlang:get_stacktrace/0: deprecated; use the new try/catch syntax for retrieving the stack backtrace src/jose_public_key.erl:107: Warning: erlang:get_stacktrace/0: deprecated; use the new try/catch syntax for retrieving the stack backtrace src/jose_public_key.erl:122: Warning: erlang:get_stacktrace/0: deprecated; use the new try/catch syntax for retrieving the stack backtrace src/jose_public_key.erl:234: Warning: erlang:get_stacktrace/0: deprecated; use the new try/catch syntax for retrieving the stack backtrace Compiling 8 files (.ex) Generated jose app ===> Compiling ranch warning: String.strip/1 is deprecated. Use String.trim/1 instead c:/Users/paolo/dev/work/antgroup/marconi/deps/poison/mix.exs:4 ==> poison Compiling 4 files (.ex) warning: HashDict.size/1 is deprecated. Use maps and the Map module instead lib/poison/encoder.ex:283 warning: Integer.to_char_list/2 is deprecated. Use Integer.to_charlist/2 instead lib/poison/encoder.ex:161 Generated poison app ==> ssl_verify_fun (compile) ==> scrivener Compiling 4 files (.ex) Generated scrivener app ==> combine Compiling 6 files (.ex) Generated combine app ===> Compiling certifi ===> Compiling hackney ==> tzdata Compiling 16 files (.ex) Generated tzdata app ==> timex Compiling 58 files (.ex) warning: "not expr1 in expr2" is deprecated. Instead use "expr1 not in expr2" if you require Elixir v1.5+, or "not(expr1 in expr2)" if you have to support earlier Elixir versions lib/comparable/diff.ex:62 warning: "not expr1 in expr2" is deprecated. Instead use "expr1 not in expr2" if you require Elixir v1.5+, or "not(expr1 in expr2)" if you have to support earlier Elixir versions lib/calendar/julian.ex:81 Generated timex app ==> httpoison Compiling 2 files (.ex) Generated httpoison app ===> Compiling cowlib ===> Compiling cowboy ==> uuid Compiling 1 file (.ex) Generated uuid app ==> mime Compiling 1 file (.ex) warning: String.strip/1 is deprecated. Use String.trim/1 instead lib/mime.ex:28 Generated mime app ==> plug Compiling 1 file (.erl) Compiling 44 files (.ex) warning: calling super for GenServer callback handle_info/2 is deprecated lib/plug/upload.ex:166 warning: System.stacktrace/0 outside of rescue/catch clauses is deprecated. If you want to support only Elixir v1.7+, you must access __STACKTRACE__ inside a rescue/catch. If you want to support earlier Elixir versions, move System.stacktrace/0 inside a rescue/catch lib/plug/conn/wrapper_error.ex:21 warning: System.stacktrace/0 outside of rescue/catch clauses is deprecated. If you want to support only Elixir v1.7+, you must access __STACKTRACE__ inside a rescue/catch. If you want to support earlier Elixir versions, move System.stacktrace/0 inside a rescue/catch lib/plug/conn/wrapper_error.ex:26 warning: System.stacktrace/0 outside of rescue/catch clauses is deprecated. If you want to support only Elixir v1.7+, you must access __STACKTRACE__ inside a rescue/catch. If you want to support earlier Elixir versions, move System.stacktrace/0 inside a rescue/catch lib/plug/error_handler.ex:82 warning: "not expr1 in expr2" is deprecated. Instead use "expr1 not in expr2" if you require Elixir v1.5+, or "not(expr1 in expr2)" if you have to support earlier Elixir versions lib/plug/conn.ex:422 warning: "not expr1 in expr2" is deprecated. Instead use "expr1 not in expr2" if you require Elixir v1.5+, or "not(expr1 in expr2)" if you have to support earlier Elixir versions lib/plug/conn.ex:446 warning: "not expr1 in expr2" is deprecated. Instead use "expr1 not in expr2" if you require Elixir v1.5+, or "not(expr1 in expr2)" if you have to support earlier Elixir versions lib/plug/conn.ex:506 warning: "not expr1 in expr2" is deprecated. Instead use "expr1 not in expr2" if you require Elixir v1.5+, or "not(expr1 in expr2)" if you have to support earlier Elixir versions lib/plug/conn.ex:1033 warning: "not expr1 in expr2" is deprecated. Instead use "expr1 not in expr2" if you require Elixir v1.5+, or "not(expr1 in expr2)" if you have to support earlier Elixir versions lib/plug/conn.ex:1057 warning: "not expr1 in expr2" is deprecated. Instead use "expr1 not in expr2" if you require Elixir v1.5+, or "not(expr1 in expr2)" if you have to support earlier Elixir versions lib/plug/conn.ex:1089 warning: "not expr1 in expr2" is deprecated. Instead use "expr1 not in expr2" if you require Elixir v1.5+, or "not(expr1 in expr2)" if you have to support earlier Elixir versions lib/plug/conn.ex:1111 warning: System.stacktrace/0 outside of rescue/catch clauses is deprecated. If you want to support only Elixir v1.7+, you must access __STACKTRACE__ inside a rescue/catch. If you want to support earlier Elixir versions, move System.stacktrace/0 inside a rescue/catch lib/plug/debugger.ex:115 warning: Enum.partition/2 is deprecated. Use Enum.split_with/2 instead lib/plug/adapters/cowboy.ex:46 Generated plug app ==> corsica Compiling 2 files (.ex) Generated corsica app ==> guardian Compiling 18 files (.ex) Generated guardian app ==> scrivener_headers Compiling 1 file (.ex) Generated scrivener_headers app ==> artificery Compiling 10 files (.ex) Generated artificery app ==> distillery Compiling 33 files (.ex) Generated distillery app ==> edeliver Compiling 32 files (.ex) Generated edeliver app ==> marconi Compiling 45 files (.ex) Generated marconi app ==> Loading configuration.. ==> Assembling release.. ==> Building release marconi:1.7.1 using environment prod ==> Discovered applications: > kernel-6.0 | | from: c:/Program Files/erl10.0.1/lib/kernel-6.0 | applications: none | includes: none |_____ > scrivener_headers-3.1.1 | | from: _build/prod/lib/scrivener_headers | applications: | :kernel | :stdlib | :elixir | includes: none |_____ > uuid-1.1.8 | | from: _build/prod/lib/uuid | applications: | :kernel | :stdlib | :elixir | includes: none |_____ > base64url-0.0.1 | | from: _build/prod/lib/base64url | applications: | :kernel | :stdlib | includes: none |_____ > jose-1.8.4 | | from: _build/prod/lib/jose | applications: | :kernel | :stdlib | :elixir | :crypto | :asn1 | :public_key | :base64url | includes: none |_____ > guardian-1.0.0-beta.1 | | from: _build/prod/lib/guardian | applications: | :kernel | :stdlib | :elixir | :logger | :poison | :jose | :uuid | includes: none |_____ > corsica-1.0.0 | | from: _build/prod/lib/corsica | applications: | :kernel | :stdlib | :elixir | :logger | :cowboy | :plug | includes: none |_____ > mime-1.1.0 | | from: _build/prod/lib/mime | applications: | :kernel | :stdlib | :elixir | includes: none |_____ > plug-1.4.3 | | from: _build/prod/lib/plug | applications: | :kernel | :stdlib | :elixir | :crypto | :logger | :mime | includes: none |_____ > cowlib-1.0.2 | | from: _build/prod/lib/cowlib | applications: | :kernel | :stdlib | :crypto | includes: none |_____ > ranch-1.3.2 | | from: _build/prod/lib/ranch | applications: | :kernel | :stdlib | :ssl | includes: none |_____ > cowboy-1.1.2 | | from: _build/prod/lib/cowboy | applications: | :kernel | :stdlib | :ranch | :cowlib | :crypto | includes: none |_____ > httpoison-0.11.2 | | from: _build/prod/lib/httpoison | applications: | :kernel | :stdlib | :elixir | :hackney | includes: none |_____ > poison-2.2.0 | | from: _build/prod/lib/poison | applications: | :kernel | :stdlib | :elixir | includes: none |_____ > combine-0.10.0 | | from: _build/prod/lib/combine | applications: | :kernel | :stdlib | :elixir | includes: none |_____ > gettext-0.15.0 | | from: _build/prod/lib/gettext | applications: | :kernel | :stdlib | :elixir | :logger | includes: none |_____ > metrics-1.0.1 | | from: _build/prod/lib/metrics | applications: | :kernel | :stdlib | includes: none |_____ > ssl_verify_fun-1.1.1 | | from: _build/prod/lib/ssl_verify_fun | applications: | :kernel | :stdlib | :ssl | includes: none |_____ > certifi-1.2.1 | | from: _build/prod/lib/certifi | applications: | :kernel | :stdlib | includes: none |_____ > mimerl-1.0.2 | | from: _build/prod/lib/mimerl | applications: | :kernel | :stdlib | includes: none |_____ > unicode_util_compat-0.2.0 | | from: _build/prod/lib/unicode_util_compat | applications: | :kernel | :stdlib | includes: none |_____ > idna-5.0.2 | | from: _build/prod/lib/idna | applications: | :kernel | :stdlib | :unicode_util_compat | includes: none |_____ > ssl-9.0 | | from: c:/Program Files/erl10.0.1/lib/ssl-9.0 | applications: | :crypto | :public_key | :kernel | :stdlib | includes: none |_____ > public_key-1.6 | | from: c:/Program Files/erl10.0.1/lib/public_key-1.6 | applications: | :asn1 | :crypto | :kernel | :stdlib | includes: none |_____ > asn1-5.0.6 | | from: c:/Program Files/erl10.0.1/lib/asn1-5.0.6 | applications: | :kernel | :stdlib | includes: none |_____ > crypto-4.3 | | from: c:/Program Files/erl10.0.1/lib/crypto-4.3 | applications: | :kernel | :stdlib | includes: none |_____ > hackney-1.8.6 | | from: _build/prod/lib/hackney | applications: | :kernel | :stdlib | :crypto | :asn1 | :public_key | :ssl | :idna | :mimerl | :certifi | :ssl_verify_fun | :metrics | includes: none |_____ > tzdata-0.5.16 | | from: _build/prod/lib/tzdata | applications: | :kernel | :stdlib | :elixir | :hackney | :logger | includes: none |_____ > timex-3.3.0 | | from: _build/prod/lib/timex | applications: | :kernel | :stdlib | :elixir | :logger | :tzdata | :gettext | :combine | includes: none |_____ > edeliver-1.6.0 | | from: _build/prod/lib/edeliver | applications: | :kernel | :stdlib | :elixir | includes: none |_____ > logger-1.7.2 | | from: c:/ProgramData/chocolatey/lib/Elixir/bin/../lib/logger | applications: | :kernel | :stdlib | :elixir | includes: none |_____ > marconi-1.7.1 | | from: _build/prod/lib/marconi | applications: | :kernel | :stdlib | :elixir | :logger | :edeliver | :timex | :poison | :httpoison | :cowboy | :plug | :corsica | :guardian | :scrivener_headers | :distillery | includes: none |_____ > artificery-0.2.6 | | from: _build/prod/lib/artificery | applications: | :kernel | :stdlib | :elixir | includes: none |_____ > distillery-2.0.12 | | from: _build/prod/lib/distillery | applications: | :kernel | :stdlib | :elixir | :runtime_tools | :artificery | includes: none |_____ > runtime_tools-1.13 | | from: c:/Program Files/erl10.0.1/lib/runtime_tools-1.13 | applications: | :kernel | :stdlib | includes: none |_____ > stdlib-3.5 | | from: c:/Program Files/erl10.0.1/lib/stdlib-3.5 | applications: | :kernel | includes: none |_____ > compiler-7.2.1 | | from: c:/Program Files/erl10.0.1/lib/compiler-7.2.1 | applications: | :kernel | :stdlib | includes: none |_____ > sasl-3.2 | | from: c:/Program Files/erl10.0.1/lib/sasl-3.2 | applications: | :kernel | :stdlib | includes: none |_____ > iex-1.7.2 | | from: c:/ProgramData/chocolatey/lib/Elixir/bin/../lib/iex | applications: | :kernel | :stdlib | :elixir | includes: none |_____ > mix-1.7.2 | | from: c:/ProgramData/chocolatey/lib/Elixir/bin/../lib/mix | applications: | :kernel | :stdlib | :elixir | includes: none |_____ > elixir-1.7.2 | | from: c:/ProgramData/chocolatey/lib/Elixir/bin/../lib/elixir | applications: | :kernel | :stdlib | :compiler | includes: none |_____ ==> Running validation checks.. > Mix.Releases.Checks.Erts * PASS > Mix.Releases.Checks.Cookie * WARN > Mix.Releases.Checks.LoadedOrphanedApps * PASS Attention! You did not provide a cookie for the erlang distribution protocol in rel/config.exs For backwards compatibility, the release name will be used as a cookie, which is potentially a security risk! Please generate a secure cookie and use it with `set cookie: ` in rel/config.exs. This will be an error in a future release. ==> Generated overlay vars: release_name=:marconi release_version="1.7.1" is_upgrade=false upgrade_from=:latest dev_mode=false include_erts=true include_src=false include_system_libs=true erl_opts="" run_erl_env="" erts_vsn="10.0.1" output_dir="_build/prod/rel/marconi" ==> Copying applications to _build/prod/rel/marconi ==> Generating start_erl.data ==> Generating vm.args ==> Generating sys.config from config/config.exs ==> Including ERTS 10.0.1 from c:/Program Files/erl10.0.1/erts-10.0.1 ==> Generating boot scripts ==> Generating RELEASES ==> Applying overlays ==> Applying mkdir overlay dst: releases/1.7.1/hooks ==> Applying mkdir overlay dst: releases/1.7.1/hooks/pre_configure.d ==> Applying mkdir overlay dst: releases/1.7.1/hooks/post_configure.d ==> Applying mkdir overlay dst: releases/1.7.1/hooks/pre_start.d ==> Applying mkdir overlay dst: releases/1.7.1/hooks/post_start.d ==> Applying mkdir overlay dst: releases/1.7.1/hooks/pre_stop.d ==> Applying mkdir overlay dst: releases/1.7.1/hooks/post_stop.d ==> Applying mkdir overlay dst: releases/1.7.1/hooks/pre_upgrade.d ==> Applying mkdir overlay dst: releases/1.7.1/hooks/post_upgrade.d ==> Applying copy overlay src: _build/prod/lib/distillery/priv/libexec dst: releases/1.7.1/libexec ==> Applying mkdir overlay dst: releases/1.7.1/commands Release successfully built! To start the release you have built, you can use one of the following tasks: # start a shell, like 'iex -S mix' > _build/prod/rel/marconi/bin/marconi.bat console # start in the foreground, like 'mix run --no-halt' > _build/prod/rel/marconi/bin/marconi.bat foreground # start in the background, must be stopped with the 'stop' command > _build/prod/rel/marconi/bin/marconi.bat start If you started a release elsewhere, and wish to connect to it: # connects a local shell to the running node > _build/prod/rel/marconi/bin/marconi.bat remote_console # connects directly to the running node's console > _build/prod/rel/marconi/bin/marconi.bat attach For a complete listing of commands and their use: > _build/prod/rel/marconi/bin/marconi.bat help ```

Description of issue

# Import all plugins from `rel/plugins`
# They can then be used by adding `plugin MyPlugin` to
# either an environment, or release definition, where
# `MyPlugin` is the name of the plugin module.
Path.join(["rel", "plugins", "*.exs"])
|> Path.wildcard()
|> Enum.map(&Code.eval_file(&1))

use Mix.Releases.Config,
    # This sets the default release built by `mix release`
    default_release: :default,
    # This sets the default environment used by `mix release`
    default_environment: Mix.env()

# For a full list of config options for both releases
# and environments, visit https://hexdocs.pm/distillery/configuration.html

# You may define one or more environments in this file,
# an environment's settings will override those of a release
# when building in that environment, this combination of release
# and environment configuration is called a profile

environment :dev do
  # If you are running Phoenix, you should make sure that
  # server: true is set and the code reloader is disabled,
  # even in dev mode.
  # It is recommended that you build with MIX_ENV=prod and pass
  # the --env flag to Distillery explicitly if you want to use
  # dev mode.
  set dev_mode: true
  set include_erts: true
  set cookie: <MY_COOKIE>
end

environment :prod do
  set include_erts: true
  set include_src: false
  plugin Releases.Plugin.LinkConfig
end

# You may define one or more releases in this file.
# If you have not set a default release, or selected one
# when running `mix release`, the first release in the file
# will be used by default

release :marconi do
  set version: current_version(:marconi)
  set applications: [
    :runtime_tools
  ]
end