Skip to content

Commit 696ff2a

Browse files
author
Trong Nhan Mai
committed
chore: support gen-build-spec for the Docker image
1 parent 717803a commit 696ff2a

File tree

1 file changed

+36
-1
lines changed

1 file changed

+36
-1
lines changed

scripts/release_scripts/run_macaron.sh

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,7 @@ while [[ $# -gt 0 ]]; do
283283
entrypoint+=("macaron")
284284
;;
285285
# Parsing commands for macaron entrypoint.
286-
analyze|dump-defaults|verify-policy)
286+
analyze|dump-defaults|verify-policy|gen-build-spec)
287287
command=$1
288288
shift
289289
break
@@ -359,6 +359,19 @@ elif [[ $command == "verify-policy" ]]; then
359359
esac
360360
shift
361361
done
362+
elif [[ $command == "gen-build-spec" ]]; then
363+
while [[ $# -gt 0 ]]; do
364+
case $1 in
365+
-d|--database)
366+
gen_build_spec_arg_database="$2"
367+
shift
368+
;;
369+
*)
370+
rest_command+=("$1")
371+
;;
372+
esac
373+
shift
374+
done
362375
elif [[ $command == "dump-defaults" ]]; then
363376
while [[ $# -gt 0 ]]; do
364377
case $1 in
@@ -512,6 +525,28 @@ if [[ -n "${arg_datalog_policy_file:-}" ]]; then
512525
mount_file "-f/--file" "$datalog_policy_file" "$datalog_policy_file_in_container" "ro,Z"
513526
fi
514527

528+
# MACARON entrypoint - gen-build-spec command argvs
529+
# This is for macaron gen-build-spec command.
530+
# Determine the database path to be mounted into ${MACARON_WORKSPACE}/database/<database_file_name>.
531+
if [[ -n "${gen_build_spec_arg_database:-}" ]]; then
532+
gen_build_spec_database_path="${gen_build_spec_arg_database}"
533+
file_name="$(basename "${gen_build_spec_database_path}")"
534+
gen_build_spec_database_path_in_container="${MACARON_WORKSPACE}/database/${file_name}"
535+
536+
argv_command+=("--database" "$gen_build_spec_database_path_in_container")
537+
mount_file "-d/--database" "$gen_build_spec_database_path" "$gen_build_spec_database_path_in_container" "rw,Z"
538+
fi
539+
540+
# Determine that ~/.gradle/gradle.properties exists to be mounted into ${MACARON_WORKSPACE}/gradle.properties
541+
if [[ -f "$HOME/.gradle/gradle.properties" ]]; then
542+
mounts+=("-v" "$HOME/.gradle/gradle.properties":"${MACARON_WORKSPACE}/gradle.properties:ro,Z")
543+
fi
544+
545+
# Determine that ~/.m2/settings.xml exists to be mounted into ${MACARON_WORKSPACE}/settings.xml
546+
if [[ -f "$HOME/.m2/settings.xml" ]]; then
547+
mounts+=("-v" "$HOME/.m2/settings.xml":"${MACARON_WORKSPACE}/settings.xml:ro,Z")
548+
fi
549+
515550
# Set up proxy.
516551
# We respect the host machine's proxy environment variables.
517552
proxy_var_names=(

0 commit comments

Comments
 (0)