Feature: Add Global Admin-Defined EC2 Limits for Autograders#2320
Open
Giabbi wants to merge 3 commits intoec2-testingfrom
Open
Feature: Add Global Admin-Defined EC2 Limits for Autograders#2320Giabbi wants to merge 3 commits intoec2-testingfrom
Giabbi wants to merge 3 commits intoec2-testingfrom
Conversation
… instance selection. TODO: connect array to admin panel so that admin can select which instance to allow
…lled back previous database schema change in favor of a global approach with a yaml config file
Contributor
|
Caution Review failedFailed to post review comments 📝 WalkthroughWalkthroughThis pull request introduces EC2 SSH support for autograders with encrypted credential management, instance type selection, and administrative configuration. It includes database migrations for encrypted storage, controller and view refactoring with tabbed UI layouts, updated job parameter handling for EC2 integration, and enhanced authorization and validation rules across multiple layers. Changes
Sequence Diagram(s)sequenceDiagram
participant Admin as Administrator
participant Web as Autograder Form
participant Ctrl as Autograders<br/>Controller
participant Model as Autograder<br/>Model
participant DB as Database<br/>(Encrypted)
participant TangoHelper as tango_add_job<br/>Helper
participant Tango as TangoClient<br/>Job Queue
Admin->>Web: Fill EC2 settings form<br/>(instance type, access keys)
Web->>Ctrl: POST update with params
Ctrl->>Ctrl: Normalize use_access_key<br/>to boolean
Ctrl->>Ctrl: Conditionally clear or<br/>preserve access keys
Ctrl->>Model: Save autograder with<br/>EC2 params
Model->>Model: Validate instance_type<br/>against INSTANCE_TYPES
Model->>Model: Validate access_key_id<br/>format if use_access_key?
Model->>DB: Encrypt & persist<br/>access_key credentials
DB-->>Model: Confirmation
Model-->>Ctrl: Save success
Note over Tango: Later, on autograde trigger:
Ctrl->>TangoHelper: Call tango_add_job
TangoHelper->>TangoHelper: Check Rails.config.x.ec2_ssh
alt EC2 SSH Enabled
TangoHelper->>TangoHelper: Add ec2Vmms: true
TangoHelper->>TangoHelper: Add instanceType
alt use_access_key?
TangoHelper->>TangoHelper: Add accessKey,<br/>accessKeyId
end
end
TangoHelper->>Tango: POST job with<br/>conditional EC2 params
Tango-->>TangoHelper: Job ID
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes Possibly related PRs
Suggested reviewers
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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. Comment |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This PR introduces the ability for global administrators to restrict which AWS EC2 instance types are available to instructors when configuring an assessment's autograder.
Key changes:
(Note: Per discussion with Soma, moving the EC2 hardware descriptions themselves into a dynamic YAML dictionary is deferred to next semester. This PR focuses strictly on the global filtering mechanism).
Motivation and Context
Previously, instructors were exposed to a hardcoded list of all possible EC2 instances supported by Autolab. This posed a risk of over-provisioning expensive compute resources (eg, an instructor accidentally selecting a GPU instance for a basic "Hello World" C assignment). This change gives Computing Services (or whoever the admin is in the org) centralized control over AWS resource allocation while keeping the instructor experience streamlined.
How Has This Been Tested?
Tested locally on development environment:
Types of changes
[ ] Bug fix (non-breaking change which fixes an issue)
[x] New feature (non-breaking change which adds functionality)
[ ] Breaking change (fix or feature that would cause existing functionality to change)
Checklist:
[x] I have run rubocop and erblint for style check. If you haven't, run overcommit --install && overcommit --sign to use pre-commit hook for linting
[ ] My change requires a change to the documentation, which is located at Autolab Docs
[ ] I have updated the documentation accordingly, included in this PR
Other issues / help required
Documentation: I left the documentation checkboxes blank, but this feature likely requires a small update to the Autolab Docs to explain the new "EC2 Limits" tab under "Configure Autolab". I can write that up if needed!