Skip to content

Commit 909f3e5

Browse files
SSI: Gitlab fix collapsible sections (#7050)
1 parent 0084e19 commit 909f3e5

1 file changed

Lines changed: 13 additions & 4 deletions

File tree

.gitlab/ssi_gitlab-ci.yml

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -123,10 +123,15 @@ ssi_tests:
123123
SCENARIO_SUFIX=$(echo "$SCENARIO" | tr "[:upper:]" "[:lower:]")
124124
mkdir -p reports/
125125
# Upload logs to S3 and delete large files
126+
# When this template is included from downstream repos (dd-trace-*), the
127+
# system-tests checkout lives under a `system-tests/` subdirectory, so
128+
# all relative paths into the system-tests repo need that prefix.
126129
if [ "$CI_PROJECT_NAME" = "system-tests" ]; then
127130
LOGS_FOLDER="logs_${SCENARIO_SUFIX}"
131+
COLLAPSIBLE_LOGS_SCRIPT="./utils/scripts/gitlab_collapsible_logs.sh"
128132
else
129133
LOGS_FOLDER="system-tests/logs_${SCENARIO_SUFIX}"
134+
COLLAPSIBLE_LOGS_SCRIPT="./system-tests/utils/scripts/gitlab_collapsible_logs.sh"
130135
fi
131136
# Upload to S3 (the URL is printed once at the end of the after_script).
132137
AWS_CONSOLE_URL=""
@@ -161,10 +166,14 @@ ssi_tests:
161166
fi
162167
163168
# Dump every log file as a collapsible section (full content).
164-
while IFS= read -r -d '' file; do
165-
section_id=$(printf '%s' "$file" | tr -c '[:alnum:]' '_')
166-
./utils/scripts/gitlab_collapsible_logs.sh "$file" "logs_${SCENARIO_SUFIX}_${section_id}" "Logs for ${SCENARIO_SUFIX} - ${file}"
167-
done < <(find reports -type f \! -name report.json \! -name tests.log -print0)
169+
if [ -f "${COLLAPSIBLE_LOGS_SCRIPT}" ]; then
170+
while IFS= read -r -d '' file; do
171+
section_id=$(printf '%s' "$file" | tr -c '[:alnum:]' '_')
172+
bash "${COLLAPSIBLE_LOGS_SCRIPT}" "$file" "logs_${SCENARIO_SUFIX}_${section_id}" "Logs for ${SCENARIO_SUFIX} - ${file}"
173+
done < <(find reports -type f \! -name report.json \! -name tests.log -print0)
174+
else
175+
echo "Skipping collapsible log dump: ${COLLAPSIBLE_LOGS_SCRIPT} not found"
176+
fi
168177
169178
# Re-print the captured run.sh summary at the END
170179
if [ -f "${CI_PROJECT_DIR}/run_output.log" ]; then

0 commit comments

Comments
 (0)