Skip to content
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

chore!: adjust stopped status actions for the update image and others #563

Merged
merged 6 commits into from
Sep 24, 2024

Conversation

mojtaba-esk
Copy link
Member

@mojtaba-esk mojtaba-esk commented Sep 13, 2024

Closes #561

Note: This PR removes the UpgradeImage functions, instead, the user has to stop their instance, configure whatever they want and start it again.

Summary by CodeRabbit

Release Notes

  • New Features

    • Introduced flexibility in state management, allowing operations like setting images, adding ports, and adjusting resources even when instances are in a 'Stopped' state.
    • Enhanced error handling with clearer feedback for state restrictions when adding hosts to a proxy.
  • Bug Fixes

    • Improved state checks for various methods, ensuring proper functionality across different instance states.
  • Documentation

    • Updated comments and documentation to reflect changes in state conditions for various functionalities.

@mojtaba-esk mojtaba-esk self-assigned this Sep 13, 2024
Copy link
Contributor

coderabbitai bot commented Sep 13, 2024

Walkthrough

The changes involve modifications to the state management of an instance, allowing certain methods to be executed when the instance is in the StateStopped state. Key methods across various files have been updated to include this new state in their validation checks. Additionally, specific methods related to image management and error handling have been removed or added to streamline functionality and improve clarity regarding state restrictions.

Changes

Files Change Summary
pkg/instance/build.go Updated state checks in methods to allow execution in StateStopped. Removed setImageWithGracePeriod method.
pkg/instance/errors.go Added new error variable ErrAddingHostToProxyNotAllowed for state restrictions.
pkg/instance/execution.go Introduced SetImage method; removed UpgradeImage and UpgradeImageWithGracePeriod methods.
pkg/instance/network.go Updated AddPortTCP and AddPortUDP to allow execution in StateStopped.
pkg/instance/resources.go Allowed SetMemory and SetCPU functions to execute in StateStopped.
pkg/instance/sidecars.go Modified Add method to allow adding sidecars in StateStopped.
pkg/instance/storage.go Expanded functions to allow operations in Stopped state, including AddFile, AddFolder, AddVolume, and AddVolumeWithOwner.
pkg/instance/proxy.go Added state check in AddHost method to restrict addition of hosts based on instance state.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant Instance
    participant Build
    participant Execution
    participant Network
    participant Resources
    participant Sidecars
    participant Storage

    User->>Instance: Stop()
    User->>Build: SetArgs()
    User->>Execution: SetImage()
    User->>Network: AddPortTCP()
    User->>Resources: SetMemory()
    User->>Sidecars: Add()
    User->>Storage: AddFile()
Loading

Assessment against linked issues

Objective Addressed Explanation
Allow SetArgs and other functions in StateStopped (#[561])
Enable setting arguments when upgrading an image (#[561])

🐇 Hopping through the code so bright,
With states now open, what a delight!
In Stopped we can play,
Set args and images our way,
Flexibility blooms, oh what a sight! 🌼


Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 8e1b8e4 and c66549c.

Files selected for processing (1)
  • pkg/instance/monitoring.go (1 hunks)
Files skipped from review as they are similar to previous changes (1)
  • pkg/instance/monitoring.go

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    -- I pushed a fix in commit <commit_id>, please review it.
    -- Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    -- @coderabbitai generate unit testing code for this file.
    -- @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    -- @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    -- @coderabbitai read src/utils.ts and generate unit testing code.
    -- @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    -- @coderabbitai help me debug CodeRabbit configuration file.

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)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@mojtaba-esk mojtaba-esk requested a review from a team September 13, 2024 13:24
Copy link
Member

@MSevey MSevey left a comment

Choose a reason for hiding this comment

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

A breaking change should break tests. If not then that is a clear gap in our testing, so we should be adding a test for the new use case.

@mojtaba-esk
Copy link
Member Author

A breaking change should break tests. If not then that is a clear gap in our testing, so we should be adding a test for the new use case.

There is no dedicated E2E test for the upgrade image that's why it does not brake any. There is one use case in the app e2e test which we have to update the sequence. i.e. Stop the instance first, upgrade the image, then Start the instance again.

smuu
smuu previously approved these changes Sep 19, 2024
Copy link
Contributor

@tty47 tty47 left a comment

Choose a reason for hiding this comment

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

nice!

Copy link
Member

@MSevey MSevey left a comment

Choose a reason for hiding this comment

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

Approved with #565 as a follow up

@MSevey MSevey enabled auto-merge (squash) September 23, 2024 15:51
@MSevey MSevey merged commit 6623172 into main Sep 24, 2024
12 checks passed
@MSevey MSevey deleted the mojtaba/adjust-state-stopped-actions-update-image branch September 24, 2024 07:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

feat: set the args when we replace the image
4 participants