Search in sources :

Example 1 with AgentCheckoutAbility

use of jetbrains.buildServer.agent.vcs.AgentCheckoutAbility 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);
}
Also used : AgentRunningBuild(jetbrains.buildServer.agent.AgentRunningBuild) GitVersion(jetbrains.buildServer.buildTriggers.vcs.git.GitVersion) AgentCheckoutAbility(jetbrains.buildServer.agent.vcs.AgentCheckoutAbility) CheckoutRules(jetbrains.buildServer.vcs.CheckoutRules) VcsRoot(jetbrains.buildServer.vcs.VcsRoot)

Example 2 with AgentCheckoutAbility

use of jetbrains.buildServer.agent.vcs.AgentCheckoutAbility 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");
}
Also used : AgentCheckoutAbility(jetbrains.buildServer.agent.vcs.AgentCheckoutAbility) VcsRoot(jetbrains.buildServer.vcs.VcsRoot)

Example 3 with AgentCheckoutAbility

use of jetbrains.buildServer.agent.vcs.AgentCheckoutAbility in project teamcity-git by JetBrains.

the class AutoCheckoutTest method git_version_does_not_support_sparse_checkout_default_rules.

public void git_version_does_not_support_sparse_checkout_default_rules() throws IOException, VcsException {
    GitVersion gitVersion = GIT_WITH_SPARSE_CHECKOUT.previousVersion();
    myVcsSupport = vcsSupportWithFakeGitOfVersion(gitVersion);
    VcsRoot vcsRoot = vcsRootWithAgentGitPath(gitVersion.toString());
    AgentRunningBuild build = runningBuild().sharedConfigParams(PluginConfigImpl.USE_SPARSE_CHECKOUT, "true").addRoot(vcsRoot).build();
    AgentCheckoutAbility canCheckout = myVcsSupport.canCheckout(vcsRoot, CheckoutRules.DEFAULT, build);
    then(canCheckout.getCanNotCheckoutReason()).isNull();
}
Also used : AgentRunningBuild(jetbrains.buildServer.agent.AgentRunningBuild) GitVersion(jetbrains.buildServer.buildTriggers.vcs.git.GitVersion) AgentCheckoutAbility(jetbrains.buildServer.agent.vcs.AgentCheckoutAbility) VcsRoot(jetbrains.buildServer.vcs.VcsRoot)

Example 4 with AgentCheckoutAbility

use of jetbrains.buildServer.agent.vcs.AgentCheckoutAbility in project teamcity-git by JetBrains.

the class AutoCheckoutTest method should_check_auth_method.

public void should_check_auth_method() throws Exception {
    myVcsSupport = vcsSupportWithRealGit();
    VcsRoot vcsRoot = vcsRoot().withFetchUrl(getRemoteRepositoryUrl("repo.git")).withAuthMethod(AuthenticationMethod.PRIVATE_KEY_FILE).withAgentGitPath(getGitPath()).build();
    AgentCheckoutAbility canCheckout = myVcsSupport.canCheckout(vcsRoot, CheckoutRules.DEFAULT, runningBuild().addRoot(vcsRoot).build());
    then(canCheckout.getCanNotCheckoutReason().getType()).isEqualTo(AgentCanNotCheckoutReason.UNKNOWN_REASON_TYPE);
    then(canCheckout.getCanNotCheckoutReason().getDetails()).contains("TeamCity doesn't support authentication method 'Private Key' with agent checkout. Please use different authentication method.");
}
Also used : AgentCheckoutAbility(jetbrains.buildServer.agent.vcs.AgentCheckoutAbility) VcsRoot(jetbrains.buildServer.vcs.VcsRoot)

Example 5 with AgentCheckoutAbility

use of jetbrains.buildServer.agent.vcs.AgentCheckoutAbility in project teamcity-git by JetBrains.

the class AutoCheckoutTest method exclude_rules_are_used_without_sparse_checkout.

public void exclude_rules_are_used_without_sparse_checkout() throws IOException, VcsException {
    myVcsSupport = vcsSupportWithFakeGitOfVersion(GIT_WITH_SPARSE_CHECKOUT);
    VcsRoot vcsRoot = vcsRootWithAgentGitPath();
    AgentRunningBuild build = runningBuild().sharedConfigParams(PluginConfigImpl.USE_SPARSE_CHECKOUT, "false").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 " + GIT_WITH_SPARSE_CHECKOUT);
}
Also used : AgentRunningBuild(jetbrains.buildServer.agent.AgentRunningBuild) AgentCheckoutAbility(jetbrains.buildServer.agent.vcs.AgentCheckoutAbility) CheckoutRules(jetbrains.buildServer.vcs.CheckoutRules) VcsRoot(jetbrains.buildServer.vcs.VcsRoot)

Aggregations

AgentCheckoutAbility (jetbrains.buildServer.agent.vcs.AgentCheckoutAbility)11 VcsRoot (jetbrains.buildServer.vcs.VcsRoot)10 AgentRunningBuild (jetbrains.buildServer.agent.AgentRunningBuild)8 CheckoutRules (jetbrains.buildServer.vcs.CheckoutRules)7 TestFor (jetbrains.buildServer.util.TestFor)3 GitVersion (jetbrains.buildServer.buildTriggers.vcs.git.GitVersion)2 BuildAgentConfiguration (jetbrains.buildServer.agent.BuildAgentConfiguration)1 GitDetector (jetbrains.buildServer.buildTriggers.vcs.git.agent.GitDetector)1 GitExec (jetbrains.buildServer.buildTriggers.vcs.git.command.GitExec)1 VcsException (jetbrains.buildServer.vcs.VcsException)1 VcsRootImpl (jetbrains.buildServer.vcs.impl.VcsRootImpl)1 NotNull (org.jetbrains.annotations.NotNull)1 Test (org.testng.annotations.Test)1