From 0a4b85f4018ff4922cb742521cfe3ca1e1705e61 Mon Sep 17 00:00:00 2001 From: RocketQuack <202538874+Rocket-Quack@users.noreply.github.com> Date: Mon, 20 Apr 2026 23:36:34 +0200 Subject: [PATCH] fix(easy-docker): pass apps.json as a build secret --- .../lib/app/wizard/common/compose/build.sh | 12 +----------- .../easy-docker/lib/app/wizard/flows/manage/build.sh | 6 ------ tests/easy-docker/65_apps_jq_migration.bats | 7 ++----- 3 files changed, 3 insertions(+), 22 deletions(-) diff --git a/scripts/easy-docker/lib/app/wizard/common/compose/build.sh b/scripts/easy-docker/lib/app/wizard/common/compose/build.sh index 803f3cd4..0fa2dd06 100755 --- a/scripts/easy-docker/lib/app/wizard/common/compose/build.sh +++ b/scripts/easy-docker/lib/app/wizard/common/compose/build.sh @@ -11,7 +11,6 @@ build_stack_custom_image() { local frappe_path="https://github.com/frappe/frappe" local repo_root="" local containerfile_path="" - local apps_json_base64="" local apps_refs_lines="" local app_ref_line="" local app_url="" @@ -89,15 +88,6 @@ build_stack_custom_image() { ${apps_refs_lines} EOF - if ! command_exists base64; then - return 18 - fi - - apps_json_base64="$(base64 "${apps_json_path}" | tr -d '\r\n')" - if [ -z "${apps_json_base64}" ]; then - return 19 - fi - repo_root="$(get_easy_docker_repo_root)" containerfile_path="${repo_root}/images/layered/Containerfile" if [ ! -f "${containerfile_path}" ]; then @@ -110,7 +100,7 @@ EOF -f "${containerfile_path}" \ --build-arg "FRAPPE_BRANCH=${frappe_branch}" \ --build-arg "FRAPPE_PATH=${frappe_path}" \ - --build-arg "APPS_JSON_BASE64=${apps_json_base64}" \ + --secret "id=apps_json,src=${apps_json_path}" \ -t "${image_ref}" \ "${repo_root}" || return 21 diff --git a/scripts/easy-docker/lib/app/wizard/flows/manage/build.sh b/scripts/easy-docker/lib/app/wizard/flows/manage/build.sh index b88ab426..3c424b41 100755 --- a/scripts/easy-docker/lib/app/wizard/flows/manage/build.sh +++ b/scripts/easy-docker/lib/app/wizard/flows/manage/build.sh @@ -51,12 +51,6 @@ run_build_stack_custom_image_with_feedback() { 17) show_warning_and_wait "Custom image build failed: apps.json not found after generation." 4 ;; - 18) - show_warning_and_wait "Custom image build failed: base64 command is not available in this environment." 4 - ;; - 19) - show_warning_and_wait "Custom image build failed: apps.json could not be base64-encoded." 4 - ;; 20) show_warning_and_wait "Custom image build failed: images/layered/Containerfile not found." 4 ;; diff --git a/tests/easy-docker/65_apps_jq_migration.bats b/tests/easy-docker/65_apps_jq_migration.bats index 6ab1b423..3a8205b0 100755 --- a/tests/easy-docker/65_apps_jq_migration.bats +++ b/tests/easy-docker/65_apps_jq_migration.bats @@ -214,7 +214,7 @@ EOF [ "${status}" -eq 25 ] } -@test "build_stack_custom_image parses apps.json with jq before git branch checks" { +@test "build_stack_custom_image parses apps.json with jq before git branch checks and passes apps.json as a build secret" { local sandbox_root="" local stack_dir="" local env_path="" @@ -252,10 +252,6 @@ EOF "printf '%s\n' \"docker \$*\" >>\"${docker_log}\"" \ 'exit 0' - easy_docker_test_write_bin_command base64 \ - 'set -euo pipefail' \ - 'printf "%s\n" "W3sidXJsIjogImh0dHBzOi8vZXhhbXBsZS5pbnZhbGlkL2FwcCIsICJicmFuY2giOiAidmVyc2lvbi0xNiJ9XQ=="' - easy_docker_test_prepend_bin_dir run build_stack_custom_image "${stack_dir}" @@ -270,4 +266,5 @@ EOF run cat "${docker_log}" [ "${status}" -eq 0 ] [[ "${output}" == *'docker build -f '* ]] + [[ "${output}" == *"--secret id=apps_json,src=${stack_dir}/apps.json"* ]] }