Skip to content

fix: correct SNAPSHOT dependency check logic in release workflow#25

Merged
aneojgurhem merged 1 commit intomainfrom
fix_release_pipeline
Nov 24, 2025
Merged

fix: correct SNAPSHOT dependency check logic in release workflow#25
aneojgurhem merged 1 commit intomainfrom
fix_release_pipeline

Conversation

@camory
Copy link
Copy Markdown
Collaborator

@camory camory commented Nov 24, 2025

Motivation

The release workflow is currently failing at the "Check for SNAPSHOT dependencies" validation step, preventing us from publishing new releases. Investigation revealed this is caused by a shell scripting bug in the SNAPSHOT detection logic, not actual SNAPSHOT dependencies in our POMs.

Description

Root Cause

The original SNAPSHOT check used the following logic:

if find . -name "pom.xml" -exec grep -l "SNAPSHOT" {} \;; then
    echo "❌ ERROR: SNAPSHOT dependencies found in release build!"
    exit 1
fi

This has a critical flaw: find -exec returns exit code 0 (success) as long as it successfully executes the command on each file, regardless of whether grep finds any matches. This causes false positives where the check fails even when no SNAPSHOT dependencies exist.

Investigation Results

Local testing with the diagnostic script revealed:

  • ✅ All POM files are clean after versions:set updates project version
  • ✅ No SNAPSHOT occurrences found in any POM file
  • ✅ Maven dependency:tree shows no SNAPSHOT dependencies
  • ❌ CI check still fails but shows NO files (proving grep found nothing)

This confirms the issue is purely a shell scripting logic error.

Solution

  1. Captures output instead of relying on exit codes
  2. Tests for non-empty output to determine if SNAPSHOT exists
  3. Shows file path information when SNAPSHOT is found
  4. Only fails when SNAPSHOT actually exists in the POMs

Changes Made

  • Updated the "Check for SNAPSHOT dependencies" step in both validate-modules job
  • Changed from exit-code-based check to output-based check
  • Enhanced error output to show file paths and line numbers when SNAPSHOT is detected
  • No changes to actual Maven build or deployment logic

Testing

Local Testing

Ran the diagnostic script with version update to 0.1.0:

  • ✅ Confirmed versions:set successfully updates all POMs
  • ✅ Confirmed no SNAPSHOT in files after update
  • ✅ Confirmed Maven dependency tree is clean
  • ✅ New check logic correctly passes when no SNAPSHOT exists

Expected CI Behavior

With this fix, the release workflow will:

  • ✅ Pass validation when POMs are clean (current state)
  • ❌ Properly fail if actual SNAPSHOT dependencies are introduced
  • 📋 Show clear error messages with file paths and line numbers if SNAPSHOT is found

Impact

  • Unblocks releases - The workflow will now pass validation correctly
  • No functional changes - Only fixes the validation logic, doesn't change what gets released
  • Better error reporting - When SNAPSHOT is legitimately found, the error message is more helpful
  • No performance impact - The check runs at the same speed

Checklist

  • My code adheres to the coding and style guidelines of the project.
  • I have performed a self-review of my code.
  • I have commented my code, particularly in hard-to-understand areas.
  • I have made corresponding changes to the documentation.
  • I have thoroughly tested my modifications and added tests when necessary.
  • Tests pass locally and in the CI.
  • I have assessed the performance impact of my modifications.

@aneojgurhem aneojgurhem merged commit 5a2c26e into main Nov 24, 2025
3 checks passed
@aneojgurhem aneojgurhem deleted the fix_release_pipeline branch November 24, 2025 10:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants