From 41decb3ef3e36e7e8d8dde7142e1ed60d68876f7 Mon Sep 17 00:00:00 2001 From: Zack Siri Date: Thu, 26 Oct 2023 12:45:52 +0700 Subject: [PATCH 1/4] clean up formatting --- test/pakman/push_test.exs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/test/pakman/push_test.exs b/test/pakman/push_test.exs index 91fc0e1..785bc16 100644 --- a/test/pakman/push_test.exs +++ b/test/pakman/push_test.exs @@ -57,7 +57,10 @@ defmodule Pakman.PushTest do Bypass.expect(bypass, "GET", "/publish/deployments/somesha", fn conn -> conn |> Plug.Conn.put_resp_header("content-type", "application/json") - |> Plug.Conn.resp(404, Jason.encode!(%{data: %{errors: %{detail: "not_found"}}})) + |> Plug.Conn.resp( + 404, + Jason.encode!(%{data: %{errors: %{detail: "not_found"}}}) + ) end) Bypass.expect(bypass, "GET", "/publish/storage", fn conn -> @@ -114,7 +117,8 @@ defmodule Pakman.PushTest do |> Plug.Conn.resp(200, Jason.encode!(%{data: %{attributes: %{id: 1}}})) end) - assert {:ok, :already_exists} = Push.perform(config: "test/fixtures/rails.yml") + assert {:ok, :already_exists} = + Push.perform(config: "test/fixtures/rails.yml") end end end From ca49b8b0097cdbe227192dc61a70d2ec83abad71 Mon Sep 17 00:00:00 2001 From: Zack Siri Date: Thu, 26 Oct 2023 18:30:28 +0700 Subject: [PATCH 2/4] Add custom log level Signed-off-by: Zack Siri --- lib/pakman/instellar.ex | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/pakman/instellar.ex b/lib/pakman/instellar.ex index 4e6fc91..dc7acbd 100644 --- a/lib/pakman/instellar.ex +++ b/lib/pakman/instellar.ex @@ -150,10 +150,17 @@ defmodule Pakman.Instellar do [ {Tesla.Middleware.BaseUrl, endpoint}, Tesla.Middleware.JSON, - {Tesla.Middleware.Logger, debug: false} + {Tesla.Middleware.Logger, debug: false, log_level: &custom_log_level/1} ] end Tesla.client(middleware) end + + defp custom_log_level(env) do + case env.status do + 404 -> :info + _ -> :default + end + end end From 7c7209cb2597b2a90eee405af0359a5893e14fd9 Mon Sep 17 00:00:00 2001 From: Zack Siri Date: Thu, 26 Oct 2023 18:35:52 +0700 Subject: [PATCH 3/4] =?UTF-8?q?don=E2=80=99t=20output=20rendered=5Fcommand?= =?UTF-8?q?=20only=20assign?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Zack Siri --- lib/pakman/bootstrap/templates/initd.eex | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/pakman/bootstrap/templates/initd.eex b/lib/pakman/bootstrap/templates/initd.eex index ed12074..251f1a1 100644 --- a/lib/pakman/bootstrap/templates/initd.eex +++ b/lib/pakman/bootstrap/templates/initd.eex @@ -20,7 +20,7 @@ s6_service_path="${RC_SVCDIR}/s6-scan/<%= configuration["name"] %>" <%= Enum.map(commands, fn command -> %> <%= command["name"] %>() { - <%= rendered_command = if command["path"], + <% rendered_command = if command["path"], do: "#{command["path"]}/#{command["binary"]}", else: "/var/lib/#{configuration["name"]}/bin/#{command["binary"]}" %> export HOME=/var/lib/<%= configuration["name"] %> From 37f845f6a238850507ab98406087d1f52b7ce525 Mon Sep 17 00:00:00 2001 From: Zack Siri Date: Thu, 26 Oct 2023 18:37:23 +0700 Subject: [PATCH 4/4] clean up init.d output --- action.yml | 4 ++-- lib/pakman/instellar.ex | 3 ++- mix.exs | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/action.yml b/action.yml index db4c209..2c4fca2 100644 --- a/action.yml +++ b/action.yml @@ -47,14 +47,14 @@ runs: uses: actions/cache@v3 with: path: ~/.mix - key: ${{ runner.arch }}-alpine-${{ inputs.alpine }}-pakman-8.1.3 + key: ${{ runner.arch }}-alpine-${{ inputs.alpine }}-pakman-8.1.4 - name: Install Pakman if: steps.cache-pakman.outputs.cache-hit != 'true' run: | mix local.rebar --force mix local.hex --force - mix escript.install hex pakman 8.1.3 --force + mix escript.install hex pakman 8.1.4 --force shell: alpine.sh {0} env: MIX_ENV: prod diff --git a/lib/pakman/instellar.ex b/lib/pakman/instellar.ex index dc7acbd..4c59ec3 100644 --- a/lib/pakman/instellar.ex +++ b/lib/pakman/instellar.ex @@ -150,7 +150,8 @@ defmodule Pakman.Instellar do [ {Tesla.Middleware.BaseUrl, endpoint}, Tesla.Middleware.JSON, - {Tesla.Middleware.Logger, debug: false, log_level: &custom_log_level/1} + {Tesla.Middleware.Logger, + debug: false, log_level: &custom_log_level/1} ] end diff --git a/mix.exs b/mix.exs index 6a4fc54..9539616 100644 --- a/mix.exs +++ b/mix.exs @@ -4,7 +4,7 @@ defmodule Pakman.MixProject do def project do [ app: :pakman, - version: "8.1.3", + version: "8.1.4", elixir: "~> 1.13", elixirc_paths: elixirc_paths(Mix.env()), start_permanent: Mix.env() == :prod,