Skip to content

Update LibGit2Sharp and add ssh credentials for git#1917

Open
eddymoulton wants to merge 56 commits into
mainfrom
em/openssl1.1-handling
Open

Update LibGit2Sharp and add ssh credentials for git#1917
eddymoulton wants to merge 56 commits into
mainfrom
em/openssl1.1-handling

Conversation

@eddymoulton
Copy link
Copy Markdown
Contributor

@eddymoulton eddymoulton commented May 7, 2026

⚠️ Puts a dependency on the host (Linux only) running Calamari to have openssl 1.1 or 3 installed before using git operations ⚠️

I'll get some docs published before this merges so on the off chance someone is running Argo steps on some old version, support can point to it.

Adds support for SSH credentials when using git, but does not use them until Server gets the same treatment.
We don't have known host support yet, I'm going to do that separately for PR conciseness. In the meantime, we accept all hosts.

Closes MD-1680

How to review this PR

The SSH specific changes should be code reviewed, but we can do the full testing of that from server side once that work goes in (it will be easier that way, and we can make follow up fixes to Calamari if required).

For this specific PR the bits to confirm are whether we introduce any regressions to our libgit usage - which is currently used for Argo steps only. We'll want to double check this on mac (for devs), windows and a tentacle target.

# Conflicts:
#	source/Calamari/CommitToGit/CommitToGitConfigFactory.cs
# Conflicts:
#	source/Calamari/CommitToGit/CommitToGitConfigFactory.cs
…enssl1.1-handling

# Conflicts:
#	source/Calamari.Common/Plumbing/Variables/CustomPropertiesLoader.cs
#	source/Calamari.Contracts/ArgoCD/ArgoCDCustomPropertiesDto.cs
#	source/Calamari.Tests/ArgoCD/Contracts/ArgoCDCustomPropertiesDtoSerializationTests.cs
#	source/Calamari.Tests/ArgoCD/Git/AuthenticatingRepositoryFactoryTests.cs
#	source/Calamari.Tests/ArgoCD/Git/GitCloneSafeUrlTests.cs
#	source/Calamari.Tests/ArgoCD/Git/PullRequests/GitPullRequestClientResolverTests.cs
#	source/Calamari.Tests/CommitToGit/CommitToGitConfigFactoryTests.cs
#	source/Calamari/ArgoCD/Conventions/UpdateArgoCDAppImagesInstallConvention.cs
#	source/Calamari/ArgoCD/Conventions/UpdateArgoCDApplicationManifestsInstallConvention.cs
#	source/Calamari/ArgoCD/Git/AuthenticatingRepositoryFactory.cs
#	source/Calamari/ArgoCD/Git/GitCloneSafeUrl.cs
#	source/Calamari/ArgoCD/Git/GitConnection.cs
#	source/Calamari/ArgoCD/Git/IGitCredentialDtoJsonConverter.cs
#	source/Calamari/ArgoCD/Git/PullRequests/GitVendorPullRequestClientResolver.cs
#	source/Calamari/ArgoCD/Git/PullRequests/StringExtensionMethods.cs
#	source/Calamari/ArgoCD/Git/PullRequests/Vendors/AzureDevOps/AzureDevOpsPullRequestClient.cs
#	source/Calamari/ArgoCD/Git/PullRequests/Vendors/BitBucket/BitBucketPullRequestClient.cs
#	source/Calamari/ArgoCD/Git/PullRequests/Vendors/GitHub/GitHubPullRequestClient.cs
#	source/Calamari/ArgoCD/Git/PullRequests/Vendors/GitLab/GitLabPullRequestClient.cs
#	source/Calamari/ArgoCD/Git/PullRequests/Vendors/GitLab/GitLabPullRequestClientFactory.cs
#	source/Calamari/ArgoCD/Git/RepositoryFactory.cs
#	source/Calamari/ArgoCD/Git/RepositoryWrapper.cs
#	source/Calamari/CommitToGit/CommitToGitConfigFactory.cs
# Conflicts:
#	source/Calamari.Contracts/ArgoCD/ArgoCDCustomPropertiesDto.cs
#	source/Calamari.Tests/ArgoCD/Contracts/ArgoCDCustomPropertiesDtoSerializationTests.cs
#	source/Calamari.Tests/ArgoCD/Git/AuthenticatingRepositoryFactoryTests.cs
#	source/Calamari/ArgoCD/Git/AuthenticatingRepositoryFactory.cs
#	source/Calamari/ArgoCD/Git/GitConnection.cs
#	source/Calamari/ArgoCD/Git/IGitCredentialDtoJsonConverter.cs
#	source/Calamari/ArgoCD/Git/PullRequests/GitVendorPullRequestClientResolver.cs
#	source/Calamari/ArgoCD/Git/PullRequests/StringExtensionMethods.cs
#	source/Calamari/ArgoCD/Git/RepositoryFactory.cs
#	source/Calamari/ArgoCD/Git/RepositoryWrapper.cs

internal static class SshHostKeyVerificationBypass
{
// TODO(eddy): Implement proper host key verification
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Future PR

using var temporaryFolder = TemporaryDirectory.Create();

CredentialsHandler credentialsHandler = (url, usernameFromUrl, types) => new UsernamePasswordCredentials { Username = cloneUsername, Password = clonePassword};
LibGit2SharpTransportRegistration.EnsureRegistered();
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

We enter git usage in a few weird places in the tests, so for now I've just called this method so we get decent errors if the test runner doesn't meet the dependencies.

Normally this gets done in the repo wrapper and it's a bit cleaner.

@eddymoulton eddymoulton changed the title Add ssh credentials for git Update LibGit2Sharp and add ssh credentials for git May 18, 2026
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.

1 participant