Skip to content

Commit 78a64a2

Browse files
committed
Refine changelog entries and enhance reporting by adding framework version retrieval
1 parent e35b27a commit 78a64a2

File tree

4 files changed

+12
-34
lines changed

4 files changed

+12
-34
lines changed

docs/CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@ Release Date: 11-04-2025
1313
- Offline Validation for HA configurations for SAP HANA Database and Central Services.
1414
2. Configuration Checks (preview release):
1515
- Initial implementation of configuration checks for SAP systems.
16-
- Support for validating SAP systems with HANA/DB2 database types.
16+
- Support for validating SAP systems with HANA and IBM Db2 databases.

scripts/sap_automation_qa.sh

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -348,15 +348,13 @@ retrieve_secret_from_key_vault() {
348348
# :param system_params: The path to the SAP parameters file.
349349
# :param auth_type: The authentication type (e.g., "SSHKEY", "VMPASSWORD").
350350
# :param system_config_folder: The path to the system configuration folder.
351-
# :param framework_version: The framework version from VERSION file.
352351
# :return: None. Exits with the return code of the ansible-playbook command.
353352
run_ansible_playbook() {
354353
local playbook_name=$1
355354
local system_hosts=$2
356355
local system_params=$3
357356
local auth_type=$4
358357
local system_config_folder=$5
359-
local framework_version=$6
360358

361359
local extra_vars=""
362360
if [[ -n "$TEST_GROUPS" || -n "$TEST_CASES" ]]; then
@@ -380,7 +378,7 @@ run_ansible_playbook() {
380378
log "INFO" "Offline mode: Skipping SSH authentication setup"
381379
command="ansible-playbook ${cmd_dir}/../src/$playbook_name.yml -i $system_hosts \
382380
-e @$VARS_FILE -e @$system_params -e '_workspace_directory=$system_config_folder' \
383-
-e \"framework_version=$framework_version\" $extra_vars --connection=local"
381+
-e $extra_vars --connection=local"
384382
else
385383
# Set local secret_id and key_vault_id if defined
386384
local secret_id=$(grep "^secret_id:" "$system_params" | awk '{split($0,a,": "); print a[2]}' | xargs || true)
@@ -405,7 +403,7 @@ run_ansible_playbook() {
405403
"Temporary SSH key file not found. Please check the Key Vault secret ID."
406404
command="ansible-playbook ${cmd_dir}/../src/$playbook_name.yml -i $system_hosts --private-key $temp_file \
407405
-e @$VARS_FILE -e @$system_params -e '_workspace_directory=$system_config_folder' \
408-
-e \"framework_version=$framework_version\" $extra_vars"
406+
-e $extra_vars"
409407
else
410408
local ssh_key_dir="${cmd_dir}/../WORKSPACES/SYSTEM/$SYSTEM_CONFIG_NAME"
411409
local ssh_key=""
@@ -438,7 +436,7 @@ run_ansible_playbook() {
438436
chmod 600 "$ssh_key"
439437
command="ansible-playbook ${cmd_dir}/../src/$playbook_name.yml -i $system_hosts --private-key $ssh_key \
440438
-e @$VARS_FILE -e @$system_params -e '_workspace_directory=$system_config_folder' \
441-
-e \"framework_version=$framework_version\" $extra_vars"
439+
-e $extra_vars"
442440
fi
443441

444442
elif [[ "$auth_type" == "VMPASSWORD" ]]; then
@@ -452,14 +450,14 @@ run_ansible_playbook() {
452450
"Temporary password file not found. Please check the Key Vault secret ID."
453451
command="ansible-playbook ${cmd_dir}/../src/$playbook_name.yml -i $system_hosts \
454452
--extra-vars 'ansible_ssh_pass=$(cat $temp_file)' --extra-vars @$VARS_FILE -e @$system_params \
455-
-e '_workspace_directory=$system_config_folder' -e \"framework_version=$framework_version\" $extra_vars"
453+
-e '_workspace_directory=$system_config_folder' -e $extra_vars"
456454
else
457455
local password_file="${cmd_dir}/../WORKSPACES/SYSTEM/$SYSTEM_CONFIG_NAME/password"
458456
check_file_exists "$password_file" \
459457
"password file not found in WORKSPACES/SYSTEM/$SYSTEM_CONFIG_NAME directory."
460458
command="ansible-playbook ${cmd_dir}/../src/$playbook_name.yml -i $system_hosts \
461459
--extra-vars 'ansible_ssh_pass=$(cat $password_file)' --extra-vars @$VARS_FILE -e @$system_params \
462-
-e '_workspace_directory=$system_config_folder' -e \"framework_version=$framework_version\" $extra_vars"
460+
-e '_workspace_directory=$system_config_folder' -e $extra_vars"
463461
fi
464462

465463
else
@@ -547,9 +545,7 @@ main() {
547545
playbook_name=$(get_playbook_name "$TEST_TYPE" "$SAP_FUNCTIONAL_TEST_TYPE" "$OFFLINE_MODE")
548546
log "INFO" "Using playbook: $playbook_name."
549547

550-
FRAMEWORK_VERSION=$(read_version_file)
551-
log "INFO" "Framework version: $FRAMEWORK_VERSION"
552-
run_ansible_playbook "$playbook_name" "$SYSTEM_HOSTS" "$SYSTEM_PARAMS" "$AUTHENTICATION_TYPE" "$SYSTEM_CONFIG_FOLDER" "$FRAMEWORK_VERSION"
548+
run_ansible_playbook "$playbook_name" "$SYSTEM_HOSTS" "$SYSTEM_PARAMS" "$AUTHENTICATION_TYPE" "$SYSTEM_CONFIG_FOLDER"
553549

554550
}
555551

scripts/utils.sh

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -233,26 +233,3 @@ install_packages() {
233233
log "INFO" "All required packages are already installed."
234234
fi
235235
}
236-
237-
238-
# Function to read VERSION file
239-
# Looks for VERSION file in the project root directory
240-
# :return: The version string from the VERSION file
241-
read_version_file() {
242-
local script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
243-
local project_root="$(cd "$script_dir/.." && pwd)"
244-
local version_file="$project_root/VERSION"
245-
246-
if [[ -f "$version_file" ]]; then
247-
local version
248-
version=$(<"$version_file")
249-
version=$(echo "$version" | tr -d '[:space:]')
250-
if [[ -z "$version" ]]; then
251-
log "ERROR" "VERSION file is empty at: $version_file"
252-
fi
253-
echo "$version"
254-
else
255-
log "ERROR" "VERSION file not found at: $version_file"
256-
exit 1
257-
fi
258-
}

src/roles/misc/tasks/render-html-report.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,11 @@
1414
ansible.builtin.set_fact:
1515
html_report_template: "{{ lookup('file', html_template_name | default('./templates/report.html')) }}"
1616

17+
- name: "Get framework version"
18+
no_log: true
19+
ansible.builtin.set_fact:
20+
framework_version: "{{ lookup('file', '../../../../VERSION') | default('unknown') }}"
21+
1722
- name: "Read the log file and create a HTML report"
1823
render_html_report:
1924
test_group_invocation_id: "{{ test_group_invocation_id }}"

0 commit comments

Comments
 (0)