Skip to content

Commit d2093a2

Browse files
committed
display git hash in the summary
1 parent 9f131e4 commit d2093a2

File tree

6 files changed

+230
-111
lines changed

6 files changed

+230
-111
lines changed

integration_test.sh

Lines changed: 77 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,70 @@ set -euo pipefail
33

44
# Integration build script.
55
# Captures warning counts for regression tracking.
6+
#
7+
# Usage: ./integration_test.sh [--known-good <path>]
8+
# --known-good: Optional path to known_good.json file
69

710
CONFIG=${CONFIG:-bl-x86_64-linux}
811
LOG_DIR=${LOG_DIR:-_logs/logs}
912
SUMMARY_FILE=${SUMMARY_FILE:-_logs/build_summary.md}
13+
KNOWN_GOOD_FILE=""
14+
15+
# Parse command line arguments
16+
while [[ $# -gt 0 ]]; do
17+
case $1 in
18+
--known-good)
19+
KNOWN_GOOD_FILE="$2"
20+
shift 2
21+
;;
22+
*)
23+
echo "Unknown option: $1"
24+
echo "Usage: $0 [--known-good <path>]"
25+
exit 1
26+
;;
27+
esac
28+
done
29+
1030
mkdir -p "${LOG_DIR}" || true
1131

32+
# Function to extract commit hash from known_good.json
33+
get_commit_hash() {
34+
local module_name=$1
35+
local known_good_file=$2
36+
37+
if [[ -z "${known_good_file}" ]] || [[ ! -f "${known_good_file}" ]]; then
38+
echo "N/A"
39+
return
40+
fi
41+
42+
# Get the script directory
43+
local script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
44+
45+
# Use the Python script to extract module info
46+
python3 "${script_dir}/tools/get_module_info.py" "${known_good_file}" "${module_name}" "hash" 2>/dev/null || echo "N/A"
47+
}
48+
49+
# Function to extract repo URL from known_good.json
50+
get_module_repo() {
51+
local module_name=$1
52+
local known_good_file=$2
53+
54+
if [[ -z "${known_good_file}" ]] || [[ ! -f "${known_good_file}" ]]; then
55+
echo "N/A"
56+
return
57+
fi
58+
59+
# Get the script directory
60+
local script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
61+
62+
# Use the Python script to extract module repo
63+
python3 "${script_dir}/tools/get_module_info.py" "${known_good_file}" "${module_name}" "repo" 2>/dev/null || echo "N/A"
64+
}
65+
1266
declare -A BUILD_TARGET_GROUPS=(
13-
[baselibs]="@score_baselibs//score/..."
67+
[score_baselibs]="@score_baselibs//score/..."
1468
[communication]="@communication//score/mw/com:com"
15-
[persistency]="@score_persistency//src/cpp/src/... @score_persistency//src/rust/..."
69+
[score_persistency]="@score_persistency//src/cpp/src/... @score_persistency//src/rust/..."
1670
#[score_logging]="@score_logging//src/..."
1771
[score_orchestrator]="@score_orchestrator//src/..."
1872
[score_test_scenarios]="@score_test_scenarios//..."
@@ -35,13 +89,16 @@ timestamp() { date '+%Y-%m-%d %H:%M:%S'; }
3589

3690
echo "=== Integration Build Started $(timestamp) ===" | tee "${SUMMARY_FILE}"
3791
echo "Config: ${CONFIG}" | tee -a "${SUMMARY_FILE}"
92+
if [[ -n "${KNOWN_GOOD_FILE}" ]]; then
93+
echo "Known Good File: ${KNOWN_GOOD_FILE}" | tee -a "${SUMMARY_FILE}"
94+
fi
3895
echo "" >> "${SUMMARY_FILE}"
3996
echo "## Build Groups Summary" >> "${SUMMARY_FILE}"
4097
echo "" >> "${SUMMARY_FILE}"
4198
# Markdown table header
4299
{
43-
echo "| Group | Status | Duration (s) | Warnings | Deprecated refs |";
44-
echo "|-------|--------|--------------|----------|-----------------|";
100+
echo "| Group | Status | Duration (s) | Warnings | Deprecated refs | Commit/Version |";
101+
echo "|-------|--------|--------------|----------|-----------------|----------------|";
45102
} >> "${SUMMARY_FILE}"
46103

47104
overall_warn_total=0
@@ -50,6 +107,7 @@ overall_depr_total=0
50107
for group in "${!BUILD_TARGET_GROUPS[@]}"; do
51108
targets="${BUILD_TARGET_GROUPS[$group]}"
52109
log_file="${LOG_DIR}/${group}.log"
110+
53111
# Log build group banner only to stdout/stderr (not into summary table file)
54112
echo "--- Building group: ${group} ---"
55113
start_ts=$(date +%s)
@@ -73,16 +131,24 @@ for group in "${!BUILD_TARGET_GROUPS[@]}"; do
73131
else
74132
status_symbol="❌(${build_status})"
75133
fi
76-
echo "| ${group} | ${status_symbol} | ${duration} | ${w_count} | ${d_count} |" | tee -a "${SUMMARY_FILE}"
134+
135+
# Get commit hash/version for this group (group name is the module name)
136+
commit_hash=$(get_commit_hash "${group}" "${KNOWN_GOOD_FILE}")
137+
repo=$(get_module_repo "${group}" "${KNOWN_GOOD_FILE}")
138+
139+
# Truncate commit hash for display (first 8 chars)
140+
if [[ "${commit_hash}" != "N/A" ]] && [[ ${#commit_hash} -gt 8 ]]; then
141+
commit_hash_display="${commit_hash:0:8}"
142+
else
143+
commit_hash_display="${commit_hash}"
144+
fi
145+
146+
echo "| ${group} | ${status_symbol} | ${duration} | ${w_count} | ${d_count} | [${commit_hash_display}](${repo}/tree/${commit_hash}) |" | tee -a "${SUMMARY_FILE}"
77147
done
78148

79149
# Append aggregate totals row to summary table
80-
echo "| TOTAL | | | ${overall_warn_total} | ${overall_depr_total} |" >> "${SUMMARY_FILE}"
81-
82-
# Display the full build summary explicitly at the end
150+
echo "| TOTAL | | | ${overall_warn_total} | ${overall_depr_total} | |" >> "${SUMMARY_FILE}"# Display the full build summary explicitly at the end
83151
echo '::group::Build Summary'
84152
echo '=== Build Summary (echo) ==='
85153
cat "${SUMMARY_FILE}" || echo "(Could not read summary file ${SUMMARY_FILE})"
86-
echo '::endgroup::'
87-
88-
exit 0
154+
echo '::endgroup::'

known_good.json

Lines changed: 12 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,60 +1,50 @@
11
{
22
"timestamp": "2025-08-13T12:55:10Z",
3-
"modules": [
4-
{
5-
"name": "score_baselibs",
3+
"modules": {
4+
"score_baselibs": {
65
"version": "0.1.3",
76
"repo": "https://github.com/eclipse-score/baselibs.git",
87
"patches": [
98
"//:wait_free_stack_fix.patch"
109
]
1110
},
12-
{
13-
"name": "communication",
11+
"communication": {
1412
"version": "0.1.1",
1513
"repo": "https://github.com/eclipse-score/communication.git"
1614
},
17-
{
18-
"name": "score_persistency",
15+
"score_persistency": {
1916
"version": "0.2.1",
2017
"repo": "https://github.com/eclipse-score/persistency.git"
2118
},
22-
{
23-
"name": "score_orchestrator",
19+
"score_orchestrator": {
2420
"version": "0.0.3",
2521
"repo": "https://github.com/eclipse-score/orchestrator.git"
2622
},
27-
{
28-
"name": "score_tooling",
23+
"score_tooling": {
2924
"version": "1.0.2",
3025
"repo": "https://github.com/eclipse-score/tooling.git"
3126
},
32-
{
33-
"name": "score_platform",
27+
"score_platform": {
3428
"hash": "a9cf44be1342f3c62111de2249eb3132f5ab88da",
3529
"repo": "https://github.com/eclipse-score/score.git"
3630
},
37-
{
38-
"name": "score_bazel_platforms",
31+
"score_bazel_platforms": {
3932
"version": "0.0.2",
4033
"repo": "https://github.com/eclipse-score/bazel_platforms.git"
4134
},
42-
{
43-
"name": "score_test_scenarios",
35+
"score_test_scenarios": {
4436
"version": "0.3.0",
4537
"repo": "https://github.com/eclipse-score/testing_tools.git"
4638
},
47-
{
48-
"name": "score_docs_as_code",
39+
"score_docs_as_code": {
4940
"version": "2.0.1",
5041
"repo": "https://github.com/eclipse-score/docs-as-code.git"
5142
},
52-
{
53-
"name": "score_process",
43+
"score_process": {
5444
"version": "1.3.1",
5545
"repo": "https://github.com/eclipse-score/process_description.git"
5646
}
57-
],
47+
},
5848
"manifest_sha256": "4c9b7f...",
5949
"suite": "full",
6050
"duration_s": 742

known_good.updated.json

Lines changed: 49 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -1,61 +1,51 @@
11
{
2-
"timestamp": "2025-11-13T08:26:11Z",
3-
"modules": [
4-
{
5-
"name": "score_baselibs",
6-
"repo": "https://github.com/eclipse-score/baselibs.git",
7-
"hash": "edc4f8841c2210d11ef310049a78644ff3d039a3",
8-
"patches": [
9-
"//:wait_free_stack_fix.patch"
10-
]
11-
},
12-
{
13-
"name": "communication",
14-
"repo": "https://github.com/eclipse-score/communication.git",
15-
"hash": "ff40e5f1e90ce406b71c664cc6c8e902ab465305"
16-
},
17-
{
18-
"name": "score_persistency",
19-
"repo": "https://github.com/eclipse-score/persistency.git",
20-
"hash": "7548876ed3e40ec3f3053c57634de68129287e05"
21-
},
22-
{
23-
"name": "score_orchestrator",
24-
"repo": "https://github.com/eclipse-score/orchestrator.git",
25-
"hash": "7bb94ebae08805ea0a83dcc14f7c17da5ab927e6"
26-
},
27-
{
28-
"name": "score_tooling",
29-
"repo": "https://github.com/eclipse-score/tooling.git",
30-
"hash": "f36904e8c3d06c0ee761b14877ce7e5f6d3d9edb"
31-
},
32-
{
33-
"name": "score_platform",
34-
"repo": "https://github.com/eclipse-score/score.git",
35-
"hash": "4277c625daca11ef1fe16ffe7670498b354baa72"
36-
},
37-
{
38-
"name": "score_bazel_platforms",
39-
"repo": "https://github.com/eclipse-score/bazel_platforms.git",
40-
"hash": "0115193f958e8e592168df1e29cf86174bdba761"
41-
},
42-
{
43-
"name": "score_test_scenarios",
44-
"repo": "https://github.com/eclipse-score/testing_tools.git",
45-
"hash": "a2f9cded3deb636f5dc800bf7a47131487119721"
46-
},
47-
{
48-
"name": "score_docs_as_code",
49-
"repo": "https://github.com/eclipse-score/docs-as-code.git",
50-
"hash": "1067fb67782389b50827f8637a74b1027ece52ee"
51-
},
52-
{
53-
"name": "score_process",
54-
"repo": "https://github.com/eclipse-score/process_description.git",
55-
"hash": "ea78e6d616adf1f13236c31479a31db813086a77"
56-
}
57-
],
58-
"manifest_sha256": "4c9b7f...",
59-
"suite": "full",
60-
"duration_s": 742
2+
"timestamp": "2025-11-13T10:12:42Z",
3+
"modules": {
4+
"score_baselibs": {
5+
"repo": "https://github.com/eclipse-score/baselibs.git",
6+
"hash": "edc4f8841c2210d11ef310049a78644ff3d039a3",
7+
"patches": [
8+
"//:wait_free_stack_fix.patch"
9+
]
10+
},
11+
"communication": {
12+
"repo": "https://github.com/eclipse-score/communication.git",
13+
"hash": "ff40e5f1e90ce406b71c664cc6c8e902ab465305"
14+
},
15+
"score_persistency": {
16+
"repo": "https://github.com/eclipse-score/persistency.git",
17+
"hash": "7548876ed3e40ec3f3053c57634de68129287e05"
18+
},
19+
"score_orchestrator": {
20+
"repo": "https://github.com/eclipse-score/orchestrator.git",
21+
"hash": "7bb94ebae08805ea0a83dcc14f7c17da5ab927e6"
22+
},
23+
"score_tooling": {
24+
"repo": "https://github.com/eclipse-score/tooling.git",
25+
"hash": "654664dae7df2700fd5840c5ed6c07ac6c61705d"
26+
},
27+
"score_platform": {
28+
"repo": "https://github.com/eclipse-score/score.git",
29+
"hash": "4277c625daca11ef1fe16ffe7670498b354baa72"
30+
},
31+
"score_bazel_platforms": {
32+
"repo": "https://github.com/eclipse-score/bazel_platforms.git",
33+
"hash": "0115193f958e8e592168df1e29cf86174bdba761"
34+
},
35+
"score_test_scenarios": {
36+
"repo": "https://github.com/eclipse-score/testing_tools.git",
37+
"hash": "a2f9cded3deb636f5dc800bf7a47131487119721"
38+
},
39+
"score_docs_as_code": {
40+
"repo": "https://github.com/eclipse-score/docs-as-code.git",
41+
"hash": "1067fb67782389b50827f8637a74b1027ece52ee"
42+
},
43+
"score_process": {
44+
"repo": "https://github.com/eclipse-score/process_description.git",
45+
"hash": "e62e4c30808436e790590845f6c297cf605d7649"
46+
}
47+
},
48+
"manifest_sha256": "4c9b7f...",
49+
"suite": "full",
50+
"duration_s": 742
6151
}

tools/get_module_info.py

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
#!/usr/bin/env python3
2+
"""Extract module information from known_good.json."""
3+
4+
import json
5+
import sys
6+
7+
8+
def load_module_data(known_good_file, module_name):
9+
"""
10+
Load module data from known_good.json.
11+
12+
Args:
13+
known_good_file: Path to the known_good.json file
14+
module_name: Name of the module to look up
15+
16+
Returns:
17+
Dictionary with module data, or empty dict if not found
18+
"""
19+
try:
20+
with open(known_good_file, 'r') as f:
21+
data = json.load(f)
22+
modules = data.get('modules', {})
23+
return modules.get(module_name, {})
24+
except Exception:
25+
return {}
26+
27+
28+
def get_module_field(module_data, field='hash'):
29+
"""
30+
Extract a specific field from module data.
31+
32+
Args:
33+
module_data: Dictionary with module information
34+
field: Field to extract ('hash', 'version', 'repo', or 'all')
35+
36+
Returns:
37+
Requested field value, or 'N/A' if not found
38+
For 'hash': truncated to 8 chars if longer
39+
For 'all': returns hash/version (prefers hash, falls back to version)
40+
"""
41+
if not module_data:
42+
return 'N/A'
43+
44+
if field == 'repo':
45+
repo = module_data.get('repo', 'N/A')
46+
# Remove .git suffix if present
47+
if repo.endswith('.git'):
48+
repo = repo[:-4]
49+
return repo
50+
elif field == 'version':
51+
return module_data.get('version', 'N/A')
52+
elif field == 'hash':
53+
hash_val = module_data.get('hash', 'N/A')
54+
return hash_val
55+
else: # field == 'all' or default
56+
hash_val = module_data.get('hash', module_data.get('version', 'N/A'))
57+
return hash_val
58+
59+
60+
if __name__ == '__main__':
61+
if len(sys.argv) < 3 or len(sys.argv) > 4:
62+
print('Usage: get_module_info.py <known_good.json> <module_name> [field]')
63+
print(' field: hash (default), version, repo, or all')
64+
print('N/A')
65+
sys.exit(1)
66+
67+
known_good_file = sys.argv[1]
68+
module_name = sys.argv[2]
69+
field = sys.argv[3] if len(sys.argv) == 4 else 'all'
70+
71+
module_data = load_module_data(known_good_file, module_name)
72+
result = get_module_field(module_data, field)
73+
print(result)

0 commit comments

Comments
 (0)