Skip to content

Commit

Permalink
Experiment getting commit hash
Browse files Browse the repository at this point in the history
  • Loading branch information
Loïc Knuchel committed Nov 18, 2023
1 parent 8968b29 commit c469553
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
4 changes: 4 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,10 @@ ENV DATABASE_URL=${DATABASE_URL}
ENV MIX_ENV="prod"
ENV PHX_SERVER="true"

ARG GIT_COMMIT_HASH=unknown
RUN GIT_COMMIT_HASH=$(git log -1 --pretty=format:%h)
ENV GIT_COMMIT_HASH ${GIT_COMMIT_HASH}

WORKDIR "/app"
RUN chown nobody /app

Expand Down
2 changes: 1 addition & 1 deletion backend/config/config.exs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ config :azimutt,
free_plan_db_access: false,
environment: config_env(),
version: "2.0.#{DateTime.to_unix(DateTime.utc_now())}",
commit_hash: System.cmd("git", ["log", "-1", "--pretty=format:%h"]) |> elem(0) |> String.trim(),
commit_hash: System.get_env("GIT_COMMIT_HASH") || System.cmd("git", ["log", "-1", "--pretty=format:%h"]) |> elem(0) |> String.trim(),
commit_message: System.cmd("git", ["log", "-1", "--pretty=format:%s"]) |> elem(0) |> String.trim(),
commit_date: System.cmd("git", ["log", "-1", "--pretty=format:%aI"]) |> elem(0) |> String.trim(),
commit_author: System.cmd("git", ["log", "-1", "--pretty=format:%an"]) |> elem(0) |> String.trim()
Expand Down
4 changes: 2 additions & 2 deletions backend/lib/azimutt/services/cockpit_srv.ex
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ defmodule Azimutt.Services.CockpitSrv do
unreachable = Azimutt.config(:cockpit_unreachable) || 0

if unreachable > 3 do
set_error_message("Unable to reach licence server, please make sure to allow access or #{contact_us}.")
set_error_message("Unable to reach licence server, please make sure to allow access or #{contact_us()}.")
else
Azimutt.set_config(:cockpit_unreachable, unreachable + 1)
end
Expand All @@ -49,7 +49,7 @@ defmodule Azimutt.Services.CockpitSrv do
set_warning_message(res["warning"])

res["status"] != 200 ->
set_warning_message("Licence server returned <b>status #{res["status"]}</b>, please #{contact_us}.")
set_warning_message("Licence server returned <b>status #{res["status"]}</b>, please #{contact_us()}.")

true ->
clear_message()
Expand Down

0 comments on commit c469553

Please sign in to comment.