ci: trim whitespace from R2 secrets and improve debug logging#189
ci: trim whitespace from R2 secrets and improve debug logging#189Pratham-Mishra04 merged 1 commit intomainfrom
Conversation
Summary by CodeRabbit
WalkthroughThe changes introduce stricter handling and validation of environment variables used in the build upload process. In the workflow file, whitespace is explicitly trimmed from relevant environment variables before use. The upload script now provides detailed debug output, masking variable values, checking for whitespace or newlines, and exiting immediately if a required variable is missing. Changes
Sequence Diagram(s)sequenceDiagram
participant GitHub Actions
participant upload-builds.mjs
GitHub Actions->>GitHub Actions: Trim whitespace from R2 env vars
GitHub Actions->>upload-builds.mjs: Run upload script with cleaned env vars
upload-builds.mjs->>upload-builds.mjs: Validate each env var
alt Variable missing
upload-builds.mjs->>GitHub Actions: Log missing variable, exit
else Variable present
upload-builds.mjs->>GitHub Actions: Log masked value, check for whitespace/newlines
upload-builds.mjs->>GitHub Actions: Warn if whitespace/newlines found
upload-builds.mjs->>GitHub Actions: Continue process
end
Estimated code review effort2 (~15 minutes) Possibly related PRs
Suggested reviewers
Poem
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (2)
🧠 Learnings (2)📓 Common learningsci/scripts/upload-builds.mjs (2)Learnt from: Pratham-Mishra04 Learnt from: Pratham-Mishra04 🧰 Additional context used🧠 Learnings (2)📓 Common learningsci/scripts/upload-builds.mjs (2)Learnt from: Pratham-Mishra04 Learnt from: Pratham-Mishra04 🔇 Additional comments (2)
✨ Finishing Touches
🧪 Generate unit tests
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
# Trim whitespace from R2 secrets and improve environment variable validation This PR addresses an issue with R2 credentials in our release workflow by: 1. Adding whitespace trimming for R2 environment variables in the transports-release workflow 2. Enhancing the upload-builds.mjs script with better environment variable validation: - Displays the length of each credential - Shows first/last few characters of credentials (partially masked) - Detects and warns about common issues like newlines or trailing spaces These changes will help prevent authentication failures caused by invisible whitespace characters in secrets.

Trim whitespace from R2 secrets and improve environment variable validation
This PR addresses an issue with R2 credentials in our release workflow by:
These changes will help prevent authentication failures caused by invisible whitespace characters in secrets.