Skip to content

Commit 9404439

Browse files
justin808claude
andauthored
Show gem versions in CI failure output (#1984)
## Summary Enhanced the `bin/ci-rerun-failures` script to display actual gem versions instead of just matrix parameters when reporting CI failures. **Before:** ``` ✗ dummy-app-integration-tests (3.2, 20, minimum) ``` **After:** ``` ✗ dummy-app-integration-tests (3.2, 20, minimum) (Ruby 3.2, Node 20, Shakapacker 8.2.0, React 18) ``` ## Changes - Added `JOB_VERSION_MAP` associative array to map CI job names to human-readable version strings - Updated the "Failed CI jobs" output to include version information - Updated the "Will run the following commands" output to include version information - Updated the running progress and summary outputs to include version information ## Benefits - Developers immediately see which exact gem versions are being tested - Makes it easier to replicate failures locally by knowing the exact configuration - Reduces the need to look up what "minimum" or "latest" configurations mean - Improves troubleshooting experience when CI fails ## Test Plan - [x] Verified script syntax with `bash -n bin/ci-rerun-failures` - [x] Ran `bundle exec rubocop` - passes with no offenses - [x] Pre-commit hooks pass 🤖 Generated with [Claude Code](https://claude.com/claude-code) <!-- Reviewable:start --> - - - This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/shakacode/react_on_rails/1984) <!-- Reviewable:end --> --------- Co-authored-by: Claude <noreply@anthropic.com>
1 parent 2d94bc4 commit 9404439

File tree

1 file changed

+34
-11
lines changed

1 file changed

+34
-11
lines changed

bin/ci-rerun-failures

Lines changed: 34 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -173,13 +173,8 @@ if [ -z "$FAILED_CHECKS" ]; then
173173
exit 0
174174
fi
175175

176-
echo -e "${YELLOW}Failed CI jobs:${NC}"
177-
echo "$FAILED_CHECKS" | while read -r check; do
178-
echo -e "${RED}$check${NC}"
179-
done
180-
echo ""
181-
182176
# Map CI job names to local commands
177+
# NOTE: Version numbers below must match .github/workflows/main.yml matrix configuration
183178
declare -A JOB_MAP
184179
JOB_MAP["lint-js-and-ruby"]="bundle exec rubocop && yarn run eslint --report-unused-disable-directives && yarn start format.listDifferent"
185180
JOB_MAP["rspec-package-tests"]="bundle exec rake run_rspec:gem"
@@ -188,6 +183,30 @@ JOB_MAP["dummy-app-integration-tests (3.4, 22, latest)"]="bundle exec rake run_r
188183
JOB_MAP["dummy-app-integration-tests (3.2, 20, minimum)"]="bundle exec rake run_rspec:all_dummy"
189184
JOB_MAP["examples"]="bundle exec rake run_rspec:shakapacker_examples"
190185

186+
# Map CI job names to human-readable versions (matches SWITCHING_CI_CONFIGS.md)
187+
declare -A JOB_VERSION_MAP
188+
JOB_VERSION_MAP["dummy-app-integration-tests (3.4, 22, latest)"]="Ruby 3.4, Node 22, Shakapacker 9.3.0, React 19"
189+
JOB_VERSION_MAP["dummy-app-integration-tests (3.2, 20, minimum)"]="Ruby 3.2, Node 20, Shakapacker 8.2.0, React 18"
190+
191+
# Helper function to get version info for a job name
192+
get_version_info() {
193+
local job_name="$1"
194+
for mapped_job_name in "${!JOB_VERSION_MAP[@]}"; do
195+
if [[ "$job_name" == "$mapped_job_name"* ]]; then
196+
echo " (${JOB_VERSION_MAP[$mapped_job_name]})"
197+
return
198+
fi
199+
done
200+
echo ""
201+
}
202+
203+
echo -e "${YELLOW}Failed CI jobs:${NC}"
204+
echo "$FAILED_CHECKS" | while read -r check; do
205+
version_info=$(get_version_info "$check")
206+
echo -e "${RED}$check${version_info}${NC}"
207+
done
208+
echo ""
209+
191210
# Track what we'll run (deduplicated)
192211
declare -A COMMANDS_TO_RUN
193212

@@ -218,7 +237,9 @@ fi
218237

219238
echo -e "${BLUE}Will run the following commands:${NC}"
220239
for cmd in "${!COMMANDS_TO_RUN[@]}"; do
221-
echo -e "${BLUE}${COMMANDS_TO_RUN[$cmd]}:${NC} $cmd"
240+
job_name="${COMMANDS_TO_RUN[$cmd]}"
241+
version_info=$(get_version_info "$job_name")
242+
echo -e "${BLUE}$job_name${version_info}:${NC} $cmd"
222243
done
223244
echo ""
224245

@@ -251,19 +272,21 @@ FAILED_COMMANDS=()
251272

252273
for cmd in "${!COMMANDS_TO_RUN[@]}"; do
253274
job_name="${COMMANDS_TO_RUN[$cmd]}"
254-
echo -e "${BLUE}▶ Running: $job_name${NC}"
275+
version_info=$(get_version_info "$job_name")
276+
277+
echo -e "${BLUE}▶ Running: $job_name${version_info}${NC}"
255278
echo -e "${BLUE}Command: $cmd${NC}"
256279
echo ""
257280

258281
# Note: Using eval here is safe because $cmd comes from predefined JOB_MAP,
259282
# not from user input. Commands may contain shell operators like && and ||.
260283
if eval "$cmd"; then
261-
echo -e "${GREEN}$job_name passed${NC}"
284+
echo -e "${GREEN}$job_name${version_info} passed${NC}"
262285
echo ""
263286
else
264-
echo -e "${RED}$job_name failed${NC}"
287+
echo -e "${RED}$job_name${version_info} failed${NC}"
265288
echo ""
266-
FAILED_COMMANDS+=("$job_name")
289+
FAILED_COMMANDS+=("${job_name}${version_info}")
267290
fi
268291
done
269292

0 commit comments

Comments
 (0)