Closed sircharleswatson closed 7 years ago
Some additional info...
I believe that this issue can be fixed with the following code:
Enum.sort(env.releases, fn (a, b) ->
case Version.compare(a, b) do
:gt -> false
:lt -> true
:eq -> true
end
end)
This uses Elixir's built-in Version
module to check the versions against each other and sorts them from oldest to newest.
Altogether with the code for mix release, it'd be something like this:
@spec mix_release(gatling_env) :: gatling_env
@doc """
Generate a release of the deploying project with [Distillery](http://github.com/bitwalker/distillery)
"""
def mix_release(env) do
sorted_releases = Enum.sort(env.releases, fn (a, b) ->
case Version.compare(a, b) do
:gt -> false
:lt -> true
:eq -> true
end
end)
last_release = List.last(sorted_releases)
bash("mix", ~w[release --upgrade --upfrom=#{last_release} --warnings-as-errors --env=prod], cd: env.build_dir)
env
end
Obviously that sort method could be split out to its own function.
I've been trying to upgrade my app recently and it kept giving me
no_matching_releup
errors and no matter what i did, it would always automatically use--upfrom=0.0.9
but I just figured out why it's doing that.The culprit is this code:
In particular, the
List.last(env.releases)
part.env.releases
is a list of strings and that means"0.0.9"
ends up at the end of the list rather than newer releases like"0.0.10"
or"0.0.11"
Here's the output from my
env.releases
:Since it keeps using
0.0.9
I can't actually upgrade past that unless I increment other parts of the version number, which I'm not ready to do.