use of jetbrains.buildServer.vcs.VcsRoot in project teamcity-git by JetBrains.
the class FetchCommandImpl method getTeamCityPrivateKey.
private File getTeamCityPrivateKey(@NotNull AuthSettings authSettings) throws VcsException {
if (authSettings.getAuthMethod() != AuthenticationMethod.TEAMCITY_SSH_KEY)
return null;
String keyId = authSettings.getTeamCitySshKeyId();
if (keyId == null)
return null;
VcsRoot root = authSettings.getRoot();
if (root == null)
return null;
TeamCitySshKey privateKey = mySshKeyManager.getKey(root);
if (privateKey == null)
return null;
try {
File privateKeyFile = FileUtil.createTempFile("private", "key");
FileUtil.writeToFile(privateKeyFile, privateKey.getPrivateKey());
return privateKeyFile;
} catch (IOException e) {
throw new VcsException(e);
}
}
use of jetbrains.buildServer.vcs.VcsRoot in project teamcity-git by JetBrains.
the class AuthSettingsTest method credential_provider_should_return_true_when_all_items_provided.
public void credential_provider_should_return_true_when_all_items_provided() throws Exception {
VcsRoot root = vcsRoot().withFetchUrl("http://some.org/repository").withAuthMethod(AuthenticationMethod.PASSWORD).withUsername("user").build();
CredentialsProvider c = new AuthCredentialsProvider(new AuthSettingsImpl(root, new URIishHelperImpl()));
assertFalse(c.supports(new CredentialItem.Username(), new CredentialItem.Password()));
final URIish uri = new URIish("http://some.org/repository");
assertTrue(c.get(uri, new CredentialItem.Username()));
assertFalse(c.get(uri, new CredentialItem.Password()));
assertFalse(c.get(uri, new CredentialItem.Username(), new CredentialItem.Password()));
}
use of jetbrains.buildServer.vcs.VcsRoot in project teamcity-git by JetBrains.
the class AutoCheckoutTest method git_client_found_by_path_from_root.
public void git_client_found_by_path_from_root() throws IOException, VcsException {
myVcsSupport = vcsSupportWithRealGit();
VcsRoot vcsRoot = vcsRootWithAgentGitPath();
verifyCanCheckout(vcsRoot, CheckoutRules.DEFAULT, runningBuild().addRoot(vcsRoot).withAgentConfiguration(myAgentConfiguration).build());
}
use of jetbrains.buildServer.vcs.VcsRoot in project teamcity-git by JetBrains.
the class AutoCheckoutTest method git_version_does_not_support_sparse_checkout.
public void git_version_does_not_support_sparse_checkout() throws IOException, VcsException {
GitVersion gitVersion = GIT_WITH_SPARSE_CHECKOUT.previousVersion();
myVcsSupport = vcsSupportWithFakeGitOfVersion(gitVersion);
VcsRoot vcsRoot = vcsRootWithAgentGitPath(getGitPath());
AgentRunningBuild build = runningBuild().sharedConfigParams(PluginConfigImpl.USE_SPARSE_CHECKOUT, "true").addRootEntry(vcsRoot, "-:dir/q.txt").build();
AgentCheckoutAbility canCheckout = myVcsSupport.canCheckout(vcsRoot, new CheckoutRules("-:dir/q.txt"), build);
then(canCheckout.getCanNotCheckoutReason().getType()).isEqualTo(AgentCanNotCheckoutReason.NOT_SUPPORTED_CHECKOUT_RULES);
then(canCheckout.getCanNotCheckoutReason().getDetails()).contains("Cannot perform sparse checkout using git " + gitVersion);
}
use of jetbrains.buildServer.vcs.VcsRoot in project teamcity-git by JetBrains.
the class AutoCheckoutTest method git_client_not_found_by_path_from_root.
public void git_client_not_found_by_path_from_root() throws IOException {
myVcsSupport = vcsSupportWithRealGit();
VcsRoot vcsRoot = vcsRootWithAgentGitPath("gitt");
AgentCheckoutAbility canCheckout = myVcsSupport.canCheckout(vcsRoot, CheckoutRules.DEFAULT, runningBuild().addRoot(vcsRoot).build());
then(canCheckout.getCanNotCheckoutReason().getType()).isEqualTo(AgentCanNotCheckoutReason.NO_VCS_CLIENT);
then(canCheckout.getCanNotCheckoutReason().getDetails()).contains("Unable to run git at path gitt");
}
Aggregations