diff --git a/.github/workflows/deploy.yaml b/.github/workflows/deploy.yaml index 4c0441a3d..50b5fa7e9 100644 --- a/.github/workflows/deploy.yaml +++ b/.github/workflows/deploy.yaml @@ -83,6 +83,8 @@ jobs: context: . push: true tags: ${{ vars.PRIVATE_ECR }}/graasp/admin:latest + build-args: | + GIT_SHA=${{ github.sha }} cache-from: type=gha cache-to: type=gha,mode=max diff --git a/Dockerfile b/Dockerfile index d9bd6a800..cc5a87a93 100644 --- a/Dockerfile +++ b/Dockerfile @@ -82,6 +82,8 @@ COPY config/runtime.exs config/ COPY rel rel # package source code using sentry for context in errors RUN mix sentry.package_source_code +# declared late so a new commit only invalidates the release step +ARG GIT_SHA RUN mix release # start a new build stage so that the final image will only contain diff --git a/config/prod.exs b/config/prod.exs index 1124a1c4a..c3e792276 100644 --- a/config/prod.exs +++ b/config/prod.exs @@ -22,7 +22,12 @@ config :sentry, # To enable, simply provide an env var `SENTRY_DSN` # To disable ensure no env var with `SENTRY_DSN` is set # dsn: "https://b4c2635dfa3bb58ad2cded33d1201e57@o244065.ingest.us.sentry.io/4509863475740672", - release: Mix.Project.config()[:version], + # the commit SHA (GIT_SHA build arg) distinguishes builds made between two version bumps + release: + (case System.get_env("GIT_SHA") do + sha when sha in [nil, ""] -> Mix.Project.config()[:version] + sha -> "#{Mix.Project.config()[:version]}+#{String.slice(sha, 0, 7)}" + end), enable_source_code_context: true, root_source_code_paths: [File.cwd!()], # sample 20% of transactions diff --git a/mix.lock b/mix.lock index b34907076..be3a3e1da 100644 --- a/mix.lock +++ b/mix.lock @@ -8,7 +8,6 @@ "certifi": {:hex, :certifi, "2.15.0", "0e6e882fcdaaa0a5a9f2b3db55b1394dba07e8d6d9bcad08318fb604c6839712", [:rebar3], [], "hexpm", "b147ed22ce71d72eafdad94f055165c1c182f61a2ff49df28bcc71d1d5b94a60"}, "chatterbox": {:hex, :ts_chatterbox, "0.15.1", "5cac4d15dd7ad61fc3c4415ce4826fc563d4643dee897a558ec4ea0b1c835c9c", [:rebar3], [{:hpack, "~> 0.3.0", [hex: :hpack_erl, repo: "hexpm", optional: false]}], "hexpm", "4f75b91451338bc0da5f52f3480fa6ef6e3a2aeecfc33686d6b3d0a0948f31aa"}, "cldr_utils": {:hex, :cldr_utils, "2.29.7", "2189bc0117efe91c684558e79174b45eb43135595b7d1fe9b57f53917be195c1", [:mix], [{:castore, "~> 0.1 or ~> 1.0", [hex: :castore, repo: "hexpm", optional: true]}, {:certifi, "~> 2.5", [hex: :certifi, repo: "hexpm", optional: true]}, {:decimal, "~> 1.9 or ~> 2.0 or ~> 3.0", [hex: :decimal, repo: "hexpm", optional: false]}], "hexpm", "4bddcd597fee34e2d2829ae9ef62bcfef8d97ae5f6b75f0c6ee37a3db31aa73a"}, - "color": {:hex, :color, "0.13.0", "068110e5397ac5d3c9f97658282e0f4ab9a32468be6d7a2a91a8804e67b228d7", [:mix], [{:bandit, "~> 1.5", [hex: :bandit, repo: "hexpm", optional: true]}, {:plug, "~> 1.15", [hex: :plug, repo: "hexpm", optional: true]}], "hexpm", "de127946869931d418bac2d82dc29feae1a8f5f729f135922fbccf0059a58ab2"}, "combine": {:hex, :combine, "0.10.0", "eff8224eeb56498a2af13011d142c5e7997a80c8f5b97c499f84c841032e429f", [:mix], [], "hexpm", "1b1dbc1790073076580d0d1d64e42eae2366583e7aecd455d1215b0d16f2451b"}, "comeonin": {:hex, :comeonin, "5.5.1", "5113e5f3800799787de08a6e0db307133850e635d34e9fab23c70b6501669510", [:mix], [], "hexpm", "65aac8f19938145377cee73973f192c5645873dcf550a8a6b18187d17c13ccdb"}, "complex": {:hex, :complex, "0.7.0", "695632ef9487517aa5d57edd1697801079d622414cb2e1a7cf538b1f9a50f205", [:mix], [], "hexpm", "0ee39c0803129f546e7f3f640da8f021c9e659402bf59da6f7f2c4848f068f8d"},