grisp / rebar3_grisp

Rebar plug-in for GRiSP
https://www.grisp.org
Apache License 2.0
21 stars 10 forks source link

Invalid release name on deploy results in crash #68

Closed eproxus closed 2 years ago

eproxus commented 2 years ago

When deploying and using the wrong package name, the following crash occurs (with a release named foo):

$ rebar3 grisp deploy -n robot -v 0.1.0
===> Compiling foo
* Downloading pre-built OTP package (a80bccc4)
    (file cached)
* Extracting package
    (already extracted)
===> Uncaught error in rebar_core. Run with DIAGNOSTIC=1 to see stacktrace or consult rebar3.crashdump
===> Uncaught error: {badkey,{robot,"0.1.0"}}
===> Stack trace to the error location:
[{maps,get,
       [{robot,"0.1.0"},
        #{{foo,"0.1.0"} =>
              {release_t,foo,"0.1.0",undefined,
                         [{foo,#{included_applications => undefined,
                                 name => foo,type => undefined,
                                 vsn => undefined}}],
                         false,[],[],undefined,[]}}],
       []},
 {rlx_state,get_configured_release,3,
            [{file,"/home/runner/work/rebar3/rebar3/_build/default/lib/relx/src/rlx_state.erl"},
             {line,281}]},
 {relx,build_release_,3,
       [{file,"/home/runner/work/rebar3/rebar3/_build/default/lib/relx/src/relx.erl"},
        {line,168}]},
 {relx,build_release,3,
       [{file,"/home/runner/work/rebar3/rebar3/_build/default/lib/relx/src/relx.erl"},
        {line,83}]},
 {rebar_relx,do,2,
             [{file,"/home/runner/work/rebar3/rebar3/src/rebar_relx.erl"},
              {line,75}]},
 {rebar3_grisp_deploy,release_handler,2,
                      [{file,"/private/tmp/foo/_build/default/plugins/rebar3_grisp/src/rebar3_grisp_deploy.erl"},
                       {line,231}]},
 {grisp_tools_handler,run,3,
                      [{file,"/private/tmp/foo/_build/default/plugins/grisp_tools/src/grisp_tools_handler.erl"},
                       {line,14}]},
 {grisp_tools_util,exec,3,
                   [{file,"/private/tmp/foo/_build/default/plugins/grisp_tools/src/grisp_tools_util.erl"},
                    {line,78}]}]
===> When submitting a bug report, please include the output of `rebar3 report "your command"`

We should return an error when a release could not be found.