Skip to content

feat: Add support for 'swarm' backend in schema ,cli and core extensions #149

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

Merged
merged 39 commits into from
Apr 3, 2025

Conversation

sanjay7178
Copy link
Member

@sanjay7178 sanjay7178 commented Mar 4, 2025

This PR implements support for Docker Swarm commands in Sugar, expanding its capabilities beyond Docker Compose.

As this PR might be take prolong time to complete support Swarm to Sugar

Solve for #126 and #124

How to test these changes

These are the currently working CLI commands

sugar swarm init # Initialize a swarm
sugar swarm --help # Sugar swarm help manual
sugar swarm node [COMMAND] # Implemented swarm multiple node management , Note: replace [COMMAND] with args from `sugar swarm node --help`

Pull Request checklists

This PR is a:

  • new feature

PR Checklist:

  • Add unit tests for swarm functionality (tests/unit/extensions/test_swarm.py)
  • Add smoke tests for swarm commands in .makim.yaml
  • Docker Swarm visualizer using the Docker Engine API , Textual/Rich and Plotille (ie ..TUI Integration)
  • Updated core.py to integrate the swarm extension
  • Added proper documentation for all commands.

Sugar Swarm CLI Specific Checklist :

  • sugar swarm init - Initialize a swarm
  • sugar swarm join - Join a swarm as a node and/or manager
  • sugar swarm create - Create a new service
  • sugar swarm inspect - Display detailed information on services
  • sugar swarm logs - Fetch service/task logs
  • sugar swarm ls - List services
  • sugar swarm ps - List service tasks
  • sugar swarm rm - Remove services
  • sugar swarm rollback - Revert service configuration changes
  • sugar swarm scale - Scale replicated services
  • sugar swarm update - Update services
  • sugar swarm node - Manage Swarm nodes
  • sugar swarm update - update services
  • sugar swarm deploy - deploy stack

Additional information

Screenshots attached as far current progress

image
image

Copy link
Contributor

@xmnlab xmnlab left a comment

Choose a reason for hiding this comment

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

Thanks for working on that @sanjay7178
I added a few comments here.
also please add some tests on ci

@sanjay7178
Copy link
Member Author

Thanks for working on that @sanjay7178
I added a few comments here.
also please add some tests on ci

Thanks , sure by this end of day I'll make changes

@xmnlab
Copy link
Contributor

xmnlab commented Mar 7, 2025

Hi @sanjay7178 , could you please rebase this branch on top of the upstream/main?

I just pushed this new mechanism: #157

you maybe could use that for the node command

@sanjay7178
Copy link
Member Author

Hi @sanjay7178 , could you please rebase this branch on top of the upstream/main?

I just pushed this new mechanism: #157

you maybe could use that for the node command

Sure ivan

@docparams(doc_node_options)
def _cmd_node(
self,
demote: str = '',
Copy link
Contributor

Choose a reason for hiding this comment

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

now, the positional only is already implemented ..
so it should look like this:

    def _cmd_node(
        self,
        action: str = '',
        /,
        update: str = '',
        options: str = '',
    ) - > None:

Copy link
Contributor

Choose a reason for hiding this comment

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

remember to update doc_node_options

Copy link
Contributor

Choose a reason for hiding this comment

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

I think we still need to address this. but we can do it in follow up prs

Copy link
Contributor

@xmnlab xmnlab left a comment

Choose a reason for hiding this comment

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

I will review more carefully soon ... but I am already sharing some comments here
thanks for working on that

@docparams(doc_node_options)
def _cmd_node(
self,
demote: str = '',
Copy link
Contributor

Choose a reason for hiding this comment

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

remember to update doc_node_options

@xmnlab
Copy link
Contributor

xmnlab commented Mar 13, 2025

@sanjay7178 , please ping me again when this pr is ready for review.

@sanjay7178
Copy link
Member Author

@sanjay7178 , please ping me again when this pr is ready for review.

Sure 😊

@sanjay7178 sanjay7178 requested a review from xmnlab March 17, 2025 21:59
@xmnlab
Copy link
Contributor

xmnlab commented Mar 18, 2025

thanks @sanjay7178 , I will review this pr again tomorrow.

Copy link
Contributor

@xmnlab xmnlab left a comment

Choose a reason for hiding this comment

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

thanks for working on that, @sanjay7178
it seems that the tests are not executed in the ci.
could add these tests on ci?
thanks!

@sanjay7178
Copy link
Member Author

thanks for working on that, @sanjay7178 it seems that the tests are not executed in the ci. could add these tests on ci? thanks!

Sorry Ivan , I've missed out putting tests in CI , sure I'll do that

Copy link

This pull request has been marked as stale because it has been
inactive for more than 5 days. Please update this pull request
or it will be automatically closed in 5 days.

@github-actions github-actions bot added the stale label Mar 31, 2025
@xmnlab
Copy link
Contributor

xmnlab commented Mar 31, 2025

@sanjay7178 could you rebase your branch on top of the upstream main ?

@xmnlab
Copy link
Contributor

xmnlab commented Mar 31, 2025

also please remember to add tests in ci

@sanjay7178
Copy link
Member Author

@sanjay7178 could you rebase your branch on top of the upstream main ?

Sure I would do that

@sanjay7178
Copy link
Member Author

also please remember to add tests in ci

Sure

@github-actions github-actions bot removed the stale label Apr 1, 2025
Copy link
Contributor

@xmnlab xmnlab left a comment

Choose a reason for hiding this comment

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

thanks @sanjay7178 ! lgtm! appreciate it
maybe we will need some refactoring .. but we can do it as follow ups

@xmnlab xmnlab merged commit 0631be0 into sugar-org:main Apr 3, 2025
9 checks passed
@sanjay7178
Copy link
Member Author

thanks @sanjay7178 ! lgtm! appreciate it maybe we will need some refactoring .. but we can do it as follow ups

thanks , I would do that in this week

sanjay7178 added a commit to sanjay7178/sugar that referenced this pull request Apr 3, 2025
Copy link

github-actions bot commented May 3, 2025

🎉 This PR is included in version 1.17.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants