diff --git a/install_script.sh.template b/install_script.sh.template index 7b3a9b26..0bdfde40 100644 --- a/install_script.sh.template +++ b/install_script.sh.template @@ -1027,6 +1027,11 @@ if [ -n "$DD_PRIVATE_ACTION_RUNNER_API_KEY_ONLY_ENROLLMENT" ]; then par_api_key_only_enrollment=$DD_PRIVATE_ACTION_RUNNER_API_KEY_ONLY_ENROLLMENT fi +par_split_enabled= +if [ -n "$DD_PRIVATE_ACTION_RUNNER_SPLIT_ENABLED" ]; then + par_split_enabled=$DD_PRIVATE_ACTION_RUNNER_SPLIT_ENABLED +fi + ## # INSTALL SCRIPT CONFIGURATION OPTIONS # Technical options to test with non-production values for signature keys, packages or reporting telemetry. @@ -2260,6 +2265,7 @@ function update_par(){ local par_enabled="$3" local par_actions_allowlist="$4" local par_api_key_only_enrollment="$5" + local par_split_enabled="$6" if [ "$par_enabled" != "true" ]; then return @@ -2294,6 +2300,10 @@ function update_par(){ par_config="${par_config} api_key_only_enrollment: ${par_api_key_only_enrollment}" fi + if [ -n "$par_split_enabled" ]; then + par_config="${par_config} + split_enabled: ${par_split_enabled}" + fi $sudo_cmd sh -c "cat >> '$config_file'" < /dev/null + ensure_config_file_exists "sudo" $config_file "dd-agent" + update_par "sudo" $config_file "true" "" "" "true" + yamllint -c "$yaml_config" --no-warnings $config_file + assertEquals 0 $? + assertEquals "$(sudo yq eval '.private_action_runner.enabled' $config_file)" "true" + assertEquals "$(sudo yq eval '.private_action_runner.split_enabled' $config_file)" "true" +} +testParEnabledWithoutSplitMode() { + sudo rm $config_file 2> /dev/null + ensure_config_file_exists "sudo" $config_file "dd-agent" + update_par "sudo" $config_file "true" "" "" "false" + yamllint -c "$yaml_config" --no-warnings $config_file + assertEquals 0 $? + assertEquals "$(sudo yq eval '.private_action_runner.enabled' $config_file)" "true" + assertEquals "$(sudo yq eval '.private_action_runner.split_enabled' $config_file)" "false" +} +testParEnabledWithDefaultSplitMode() { + sudo rm $config_file 2> /dev/null + ensure_config_file_exists "sudo" $config_file "dd-agent" + update_par "sudo" $config_file "true" "" + # Should not add split_enabled when not provided, preserving the Agent's platform default + assertEquals "$(sudo yq eval '.private_action_runner.split_enabled' $config_file)" "null" +} ### get_redhat_release_version setUpReleaseFiles() {