Skip to content

Conversation

@nixel2007
Copy link
Member

@nixel2007 nixel2007 commented Oct 21, 2025

Update command to retrieve release version from Gradle.

Описание

Связанные задачи

Closes

Чеклист

Общие

  • Ветка PR обновлена из develop
  • Отладочные, закомментированные и прочие, не имеющие смысла участки кода удалены
  • Изменения покрыты тестами
  • Обязательные действия перед коммитом выполнены (запускал команду gradlew precommit)

Для диагностик

  • Описание диагностики заполнено для обоих языков (присутствуют файлы для обоих языков, для русского заполнено все подробно, перевод на английский можно опустить)

Дополнительно

Summary by CodeRabbit

  • Chores
    • Improved build process reliability by refining how version information is extracted during the build pipeline, ensuring accurate version tracking.
Update command to retrieve release version from Gradle.
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Oct 21, 2025

Walkthrough

A GitHub Actions workflow step for extracting version from Gradle is updated to execute with stricter flags (-q, --no-daemon, --warning-mode none), suppress stderr, and filter output to the final line, improving reliability of the version extraction.

Changes

Cohort / File(s) Change Summary
CI/CD Workflow Configuration
\.github/workflows/sentry\.yml
Modified Gradle version extraction command to add quiet mode, disable daemon, suppress warnings, redirect stderr to null, and pipe output through tail -1 for capturing only the final line

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Poem

🐰 A quieter gradle hops with grace,
No warnings whisper, no stderr trace,
Just one last line, the version found,
Our release version, safe and sound! ✨

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The title "Improve Gradle version retrieval in Sentry workflow" directly aligns with the primary change in the changeset. The modification focuses on enhancing the Gradle version retrieval step in the .github/workflows/sentry.yml file by adding command flags (-q, --no-daemon, --warning-mode none) and output filtering to ensure cleaner version extraction. The title is concise, specific to the change being made, and avoids vague terminology. A developer reviewing the commit history would immediately understand that this PR improves how the Sentry workflow retrieves the Gradle version.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.
✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch nixel2007-patch-1

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 5d02152 and 97535c2.

📒 Files selected for processing (1)
  • .github/workflows/sentry.yml (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (20)
  • GitHub Check: build (23, ubuntu-latest)
  • GitHub Check: build (21, windows-latest)
  • GitHub Check: build (23, windows-latest)
  • GitHub Check: build (17, windows-latest)
  • GitHub Check: build (21, ubuntu-latest)
  • GitHub Check: build (21, macOS-latest)
  • GitHub Check: build (17, ubuntu-latest)
  • GitHub Check: build (17, macOS-latest)
  • GitHub Check: Analyse
  • GitHub Check: build (23, macOS-latest)
  • GitHub Check: build (23, windows-latest)
  • GitHub Check: build (21, windows-latest)
  • GitHub Check: build (17, windows-latest)
  • GitHub Check: build (17, macOS-latest)
  • GitHub Check: build (21, ubuntu-latest)
  • GitHub Check: build (21, macOS-latest)
  • GitHub Check: build (23, ubuntu-latest)
  • GitHub Check: build (17, ubuntu-latest)
  • GitHub Check: build
  • GitHub Check: Sentry
- name: Get version from Gradle
id: get_version
run: echo "RELEASE_VERSION=$(./gradlew version --console plain -q)" >> $GITHUB_ENV
run: echo "RELEASE_VERSION=$(./gradlew version -q --console plain --no-daemon --warning-mode none 2>/dev/null | tail -1)" >> $GITHUB_ENV
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

Add error handling for Gradle version extraction.

The command suppresses all stderr (2>/dev/null) and pipes to tail -1, which silently masks failures. If ./gradlew version fails or produces no output, RELEASE_VERSION will be set to an empty string, causing downstream steps to fail in confusing ways without clear error messages.

Consider:

  1. Checking if the command succeeded before proceeding
  2. Validating that RELEASE_VERSION is non-empty and in the expected format
  3. Using more targeted stderr filtering (if suppression is necessary) rather than discarding all diagnostics

Apply this diff to add basic error handling:

- run: echo "RELEASE_VERSION=$(./gradlew version -q --console plain --no-daemon --warning-mode none 2>/dev/null | tail -1)" >> $GITHUB_ENV + run: | + VERSION=$(./gradlew version -q --console plain --no-daemon --warning-mode none 2>&1 | tail -1) + if [ -z "$VERSION" ]; then + echo "ERROR: Failed to retrieve version from Gradle" >&2 + exit 1 + fi + echo "RELEASE_VERSION=$VERSION" >> $GITHUB_ENV

Alternatively, if the full stderr is intentionally suppressed to hide build warnings, add a comment explaining why, and consider logging the extracted version for debugging.


 --- 🏁 Script executed: ```shell #!/bin/bash # Examine the sentry workflow file around line 27 fd -name "sentry.yml" -path "*/.github/workflows/*" --exec cat {} \; 

Length of output: 230


🏁 Script executed:

#!/bin/bash # Search for RELEASE_VERSION usage in workflows rg -n "RELEASE_VERSION" .github/workflows/ -A 2 -B 2

Length of output: 1399


🏁 Script executed:

#!/bin/bash # Check for error handling patterns in GitHub Actions workflows rg -n "set -e|exit 1|\$\?||| exit" .github/workflows/ --type yaml

Length of output: 48481


Add error handling for Gradle version extraction to prevent silent failures.

The command suppresses all stderr (2>/dev/null) and pipes to tail -1, which silently masks failures. If ./gradlew version fails or produces no output, RELEASE_VERSION will be set to an empty string. This causes the subsequent conditionals (lines 31–35) to fail matching, silently defaulting to ENVIRONMENT=feature (line 38), and the Sentry release action to receive an invalid version.

Apply this diff to add validation:

- run: echo "RELEASE_VERSION=$(./gradlew version -q --console plain --no-daemon --warning-mode none 2>/dev/null | tail -1)" >> $GITHUB_ENV + run: | + VERSION=$(./gradlew version -q --console plain --no-daemon --warning-mode none 2>&1 | tail -1) + if [ -z "$VERSION" ]; then + echo "ERROR: Failed to retrieve version from Gradle" >&2 + exit 1 + fi + echo "RELEASE_VERSION=$VERSION" >> $GITHUB_ENV
🤖 Prompt for AI Agents
.github/workflows/sentry.yml around line 27: the current command hides all stderr and can produce an empty RELEASE_VERSION silently; change it to capture both stdout and stderr (don’t redirect stderr to /dev/null), assign the command output to a variable, trim and validate that it is non-empty and matches the expected version pattern, and if validation fails print an error to stdout/stderr and exit non‑zero so the workflow fails early; alternatively, set a clear fallback and log a warning before exiting to avoid passing an invalid empty RELEASE_VERSION to the Sentry action. 
@nixel2007 nixel2007 closed this Oct 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

2 participants