Skip to content

Commit

Permalink
Merge branch 'release/0.9.13'
Browse files Browse the repository at this point in the history
  • Loading branch information
zacksiri committed Nov 11, 2023
2 parents b0084dd + e7ee0bc commit 455c67a
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 3 deletions.
6 changes: 5 additions & 1 deletion lib/uplink/packages/deployment/prepare.ex
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,11 @@ defmodule Uplink.Packages.Deployment.Prepare do
|> Repo.get(deployment_id)
|> Repo.preload([:app])

handle_prepare(deployment, actor)
if deployment.current_state == "live" do
{:ok, :already_live}
else
handle_prepare(deployment, actor)
end
end

defp handle_prepare(
Expand Down
2 changes: 1 addition & 1 deletion mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ defmodule Uplink.MixProject do
def project do
[
app: :uplink,
version: "0.9.12",
version: "0.9.13",
elixir: "~> 1.9",
elixirc_paths: elixirc_paths(Mix.env()),
start_permanent: Mix.env() == :prod,
Expand Down
19 changes: 18 additions & 1 deletion test/uplink/packages/deployment/prepare_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ defmodule Uplink.Packages.Deployment.PrepareTest do

{:ok, _installation} = Packages.create_install(deployment, 1)

{:ok, _transition} =
{:ok, %{resource: deployment}} =
Packages.transition_deployment_with(deployment, actor, "prepare")

{:ok, actor: actor, deployment: deployment, bypass: bypass}
Expand All @@ -90,4 +90,21 @@ defmodule Uplink.Packages.Deployment.PrepareTest do
actor_id: actor.id
})
end

describe "already live" do
setup %{deployment: deployment, actor: actor} do
{:ok, %{resource: deployment}} =
Packages.transition_deployment_with(deployment, actor, "complete")

{:ok, deployment: deployment}
end

test "dont prepare again", %{deployment: deployment, actor: actor} do
assert {:ok, :already_live} =
perform_job(Prepare, %{
deployment_id: deployment.id,
actor_id: actor.id
})
end
end
end

0 comments on commit 455c67a

Please sign in to comment.