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

libgit2: refactor feature managed transport usage #779

Closed
wants to merge 2 commits into from

Conversation

aryan9600
Copy link
Member

This PR adds a new field Managed to CheckoutOpts to let checkout impls
figure out when to use managed transport. Adds a new field to the
reconciler which stores the state of managed transport registration and
uses the same to return a stalling error when managed transports are not
registered but the feature is enabled.

Follow up to #727 and branched off from #746

…heckout pkg

Adds a new field `Managed` to `CheckoutOpts` to let checkout impls
figure out when to use managed transport. Adds a new field to the
reconciler which stores the state of managed transport registration and
uses the same to return a stalling error when managed transports are not
registered but the feature is enabled.

Signed-off-by: Sanskar Jaiswal <jaiswalsanskar078@gmail.com>
Signed-off-by: Sanskar Jaiswal <jaiswalsanskar078@gmail.com>
}
conditions.MarkTrue(obj, sourcev1.FetchFailedCondition, e.Reason, e.Err.Error())
return nil, e
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Seeing the complexity this new approach (removing Enabled() from libgit2/managed/ package and storing the result of initialization in ManagedTransportRegistered) adds, and considering that we'll not need all these anymore soon, maybe we don't need to change any of it.
In this implementation, what was short and simple before using Enabled() which indicated if managed transport is requested and is successfully initialized, is now divided into two separate variables and we now need to add more checks to ensure that the reconciler doesn't enter into an undefined state.
Also considering that in the current implementation, if managed transport initialization fails, Enabled() wouldn't be true, maybe we should keep Enabled() and improve it a little.

err = registerManagedSSH()
enabled = true
will set enabled to true even if ssh managed transport initialization fails. We can make sure that enabled is true only when both http and ssh managed transports are initialized successfully.

@pjbgf
Copy link
Member

pjbgf commented Jun 10, 2022

We are probably better off focusing on decommissioning unmanaged transport rather than making more changes to the current setup. Specially if we are removing that feature in the next minor or so.

@pjbgf pjbgf added the area/git Git related issues and pull requests label Jun 10, 2022
@aryan9600
Copy link
Member Author

Closing because of #779 (comment) and #779 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/git Git related issues and pull requests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants