-
Notifications
You must be signed in to change notification settings - Fork 2
Run the upload-to-s3 step in release #40
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
WalkthroughReplaces the Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes
Possibly related PRs
Suggested reviewers
Poem
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this 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: defaults
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
.github/workflows/build-and-release.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). (3)
- GitHub Check: build-artifacts (aarch64-darwin, macos-latest-xlarge, flake-iter-ARM64-macOS)
- GitHub Check: flake-check
- GitHub Check: rust-fmt-and-clippy
🔇 Additional comments (1)
.github/workflows/build-and-release.yml (1)
57-57: Verify that thereleaseenvironment has proper protection rules configured.Replacing the explicit conditional (
if: github.event_name == 'push' && github.ref == 'refs/heads/main') with environment-based gating changes the job's execution model. The job will now attempt to run for all workflow triggers (includingpull_requestevents), and thereleaseenvironment's protection rules must prevent unauthorized execution.Ensure the
releaseenvironment is configured with:
- Branch restrictions limited to
main- Required reviewers (if manual approval is desired)
- Prevention of access from forked PRs
Without these safeguards, secrets (
AWS_S3_UPLOAD_ROLE,AWS_S3_UPLOAD_BUCKET) and S3 upload permissions could be exposed to untrusted code.
There was a problem hiding this 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
🧹 Nitpick comments (1)
.github/workflows/build-and-release.yml (1)
54-56: Consider adding a comment to document the environment-based gating.The past review mentioned an outdated comment "Upload only on PR merge" that has been removed. While removing misleading comments is appropriate, the new environment-based gating approach is less self-evident than the previous explicit conditional. Consider adding a brief comment to document the behavior.
Apply this diff to add a clarifying comment:
upload-artifacts-to-s3: needs: build-artifacts + # Gated by 'release' environment protection rules environment: release
📜 Review details
Configuration used: defaults
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
.github/workflows/build-and-release.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). (3)
- GitHub Check: build-artifacts (aarch64-darwin, macos-latest-xlarge, flake-iter-ARM64-macOS)
- GitHub Check: flake-check
- GitHub Check: rust-fmt-and-clippy
| needs: build-artifacts | ||
| # Upload only on PR merge | ||
| if: github.event_name == 'push' && github.ref == 'refs/heads/main' | ||
| environment: release |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🏁 Script executed:
# Read the workflow file to understand context
cat -n .github/workflows/build-and-release.ymlRepository: DeterminateSystems/flake-iter
Length of output: 2783
🏁 Script executed:
# Check for environment configuration files
find .github -name "*environment*" -o -name "*release*" 2>/dev/null | head -20
ls -la .github/ 2>/dev/nullRepository: DeterminateSystems/flake-iter
Length of output: 279
🏁 Script executed:
# Search for references to 'release' environment or environment setup
rg "release.*environment|environment.*release" --type md --type txt --type yml -i
# Check if README mentions environment setup
cat README.md 2>/dev/null | head -100Repository: DeterminateSystems/flake-iter
Length of output: 1445
Verify the release environment exists and is configured with branch restrictions to main.
This change significantly alters job execution behavior:
- Previous behavior: Job only ran on push to
main(explicit conditional) - New behavior: Job attempts to run on all triggers (including PRs, workflow_dispatch) but is gated by the
releaseenvironment's protection rules
If the release environment doesn't exist, GitHub will automatically create it with no protection rules configured, which means all branches can deploy and uploads could occur from feature branches.
Confirm:
- The
releaseenvironment exists and is configured in repository settings - It has branch restrictions limited to
main - The change in PR check behavior (upload job showing as pending) is intentional
🤖 Prompt for AI Agents
.github/workflows/build-and-release.yml around line 56: the job now uses
environment: release which will cause the job to be gated by a GitHub
Environment rather than only running on pushes to main; verify the release
environment exists in repository settings and configure its protection to
restrict deployments to the main branch (add branch protection rules to only
allow main), or if this gating was not intended revert the change to keep the
previous conditional that ran the job only on pushes to main; also confirm the
altered PR check behavior (upload job showing as pending) is intentional with
stakeholders.
There was a problem hiding this 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
♻️ Duplicate comments (1)
.github/workflows/build-and-release.yml (1)
56-56: Verify thereleaseenvironment is configured with proper branch restrictions.This change replaces explicit conditional logic with environment-based gating. As previously noted, if the
releaseenvironment doesn't exist or lacks protection rules, uploads could execute from any branch, including PRs.Confirm that the
releaseenvironment:
- Exists in repository settings
- Has branch protection limiting deployments to
mainonly- Has appropriate approval requirements if needed
Run the following to check if the environment is configured:
#!/bin/bash # Check if the release environment exists and its configuration gh api repos/DeterminateSystems/flake-iter/environments/release --jq '{name: .name, protection_rules: .protection_rules, deployment_branch_policy: .deployment_branch_policy}'
📜 Review details
Configuration used: defaults
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
.github/workflows/build-and-release.yml(2 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). (3)
- GitHub Check: build-artifacts (aarch64-darwin, macos-latest-xlarge, flake-iter-ARM64-macOS)
- GitHub Check: rust-fmt-and-clippy
- GitHub Check: flake-check
Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.