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

Revamped Upgrade Agent for Litmus 3.x.x #4740

Merged
merged 26 commits into from
Sep 13, 2024

Conversation

kartikaysaxena
Copy link
Contributor

Proposed changes

Related #4632

Summarize your changes here to communicate with the maintainers and make sure to put the link of that issue

Types of changes

What types of changes does your code introduce to Litmus? Put an x in the boxes that apply

  • New feature (non-breaking change which adds functionality)
  • Bugfix (non-breaking change which fixes an issue)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation Update (if none of the other choices applies)

Checklist

Put an x in the boxes that apply. You can also fill these out after creating the PR. If you're unsure about any of them, don't hesitate to ask. We're here to help! This is simply a reminder of what we are going to look for before merging your code.

  • I have read the CONTRIBUTING doc
  • I have signed the commit for DCO to be passed.
  • Lint and unit tests pass locally with my changes
  • I have added tests that prove my fix is effective or that my feature works (if appropriate)
  • I have added necessary documentation (if appropriate)

Dependency

  • Please add the links to the dependent PR need to be merged before this (if any).

Special notes for your reviewer:

Revamped Litmus Upgrade Agent for Litmus 3.x.x

@kartikaysaxena kartikaysaxena marked this pull request as draft July 1, 2024 10:27
@kartikaysaxena kartikaysaxena force-pushed the upgrade-agent branch 2 times, most recently from 2c4a19b to 09b3b07 Compare July 5, 2024 05:59
Signed-off-by: Kartikay <[email protected]>
Signed-off-by: Kartikay <[email protected]>
Signed-off-by: Kartikay <[email protected]>
Copy link
Contributor

@SarthakJain26 SarthakJain26 left a comment

Choose a reason for hiding this comment

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

Please remove the commented code

@Saranya-jena Saranya-jena marked this pull request as ready for review September 6, 2024 06:04
NextVersion: "",
VersionManager: v3_9_0.NewVersionManger(m.Logger, m.DBClient),
},
"4.0.0-beta8": {
Copy link
Contributor

Choose a reason for hiding this comment

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

We can remove this for now

Copy link
Contributor

@SarthakJain26 SarthakJain26 left a comment

Choose a reason for hiding this comment

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

Great work @kartikaysaxena 🚀 , This is a great feature addition and will help the users in seamless upgrade of chaos center.

1) If upgrade volume is huge, then transaction is not favorable.
2) Split the upgrades into proprietary functions depending on their purpose and database/collection names.
3) Use logging techniques as used in other versions to provide the user an insight of how the upgrades are being done.
4) While using a transaction, make sure the session context is properly passed into the relevant mongo operations and related functions.
Copy link
Contributor

Choose a reason for hiding this comment

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

  1. Script should be written in a way that even if run twice, should not affect the already updated documents.


There are some other files not mentioned here.

## **Upgrade to version 3.9.0**
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
## **Upgrade to version 3.9.0**
## **Example: Upgrade to version 3.9.0**

Beta int
}

// Converts version from type string to type Version
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you please add comment describing what this function will return for different inputs. For e.g 3.0.0-beta-10, 3.1.0, 3.1.1 etc

NextVersion: "3.7.0",
VersionManager: nil,
},
"3.7.7-beta8": {
Copy link
Contributor

Choose a reason for hiding this comment

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

All these old versions where no upgrades are available can be removed from this map

}
}

func arrayToVersion(versionArray []int) string {
Copy link
Contributor

Choose a reason for hiding this comment

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

Please add a comment to describe what this function does


func upgradeUsersCollection(logger *log.Logger, dbClient *mongo.Client, ctx context.Context) error {

logVersion := log.Fields{
Copy link
Contributor

Choose a reason for hiding this comment

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


environmentIDIndexExists := false

logVersion := log.Fields{
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you please follow this kind of logging here: https://github.com/litmuschaos/litmus/pull/4740/files#diff-c3dcc200129e5965fb7dc2655155eb285cfea424297940f911ffe1b6624b8316R62

Please update in other places as well


defer session.EndSession(ctx)

logVersion := log.Fields{
Copy link
Contributor

Choose a reason for hiding this comment

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

@Saranya-jena
Copy link
Contributor

Awesome work @kartikaysaxena 🚀 ❤️

@Saranya-jena Saranya-jena merged commit 41da06a into litmuschaos:master Sep 13, 2024
17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants