Skip to content

Commit

Permalink
Autodeploy after config update (#114)
Browse files Browse the repository at this point in the history
We currently don't do this automatically and I'm honestly not sure why.  This will be closer to the expected experience when you update configuration in the console.
  • Loading branch information
michaeljguarino authored Nov 2, 2022
1 parent 136034c commit 558ae0f
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion lib/console/deployer.ex
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
defmodule Console.Deployer do
use GenServer
alias Console.Commands.{Plural, Command}
alias Console.Services.Builds
alias Console.Services.{Builds, Users}
alias Console.Schema.Build
alias Console.Plural.Context
require Logger
Expand Down Expand Up @@ -158,10 +158,16 @@ defmodule Console.Deployer do

defp update(storage, repo, content, tool) do
Command.set_build(nil)
bot = Users.get_bot!("console")
with {:ok, _} <- storage.init(),
{:ok, res} <- Console.Services.Plural.update_configuration(repo, content, tool),
{:ok, _} <- storage.revise("updated configuration for #{tool} #{repo}"),
{:ok, _} <- storage.push(),
{:ok, _} <- Builds.create(%{
type: :deploy,
repository: repo,
message: "redeploying after #{tool} update for #{repo}",
}, bot),
_ <- broadcast(),
do: {:ok, res}
end
Expand Down

0 comments on commit 558ae0f

Please sign in to comment.