Search in sources :

Example 6 with GitExec

use of jetbrains.buildServer.buildTriggers.vcs.git.command.GitExec in project teamcity-git by JetBrains.

the class GitDiagnosticsTab method fillModel.

@Override
public void fillModel(@NotNull Map<String, Object> model, @NotNull HttpServletRequest request) {
    super.fillModel(model, request);
    model.put("nativeGitOperationsEnabled", myMainConfigProcessor.isNativeGitOperationsEnabled());
    model.put("isMultinodeSetup", myNodes.getNodes().size() > 1);
    try {
        final GitExec gitExec = myOperations.detectGit();
        model.put("gitExec", gitExec);
        model.put("isGitExecError", false);
        model.put("nativeGitOperationsSupported", myOperations.isNativeGitOperationsSupported(gitExec));
        model.put("projectsWithGitRoots", getProjectsWithGitRoots());
        model.put("projectGitRoots", getProjectGitRoots(request));
    } catch (VcsException e) {
        model.put("gitExecError", e);
        model.put("isGitExecError", true);
        model.put("nativeGitOperationsSupported", false);
    }
}
Also used : VcsException(jetbrains.buildServer.vcs.VcsException) GitExec(jetbrains.buildServer.buildTriggers.vcs.git.command.GitExec)

Example 7 with GitExec

use of jetbrains.buildServer.buildTriggers.vcs.git.command.GitExec in project teamcity-git by JetBrains.

the class GitServerVersionHealthReport method report.

@Override
public void report(@NotNull HealthStatusScope scope, @NotNull HealthStatusItemConsumer consumer) {
    if (!myGitOperations.isNativeGitOperationsEnabled())
        return;
    GitExec gitExec = null;
    String reason = null;
    try {
        gitExec = myGitOperations.detectGit();
        if (myGitOperations.isNativeGitOperationsSupported(gitExec))
            return;
    } catch (Exception e) {
        reason = e.getMessage();
    }
    final Map<String, Object> data = new HashMap<>();
    data.put("gitExec", gitExec);
    data.put("reason", reason);
    consumer.consumeGlobal(new HealthStatusItem("GitServerVersionId", CATEGORY, data));
}
Also used : HashMap(java.util.HashMap) GitExec(jetbrains.buildServer.buildTriggers.vcs.git.command.GitExec)

Example 8 with GitExec

use of jetbrains.buildServer.buildTriggers.vcs.git.command.GitExec in project teamcity-git by JetBrains.

the class GitVersionProvider method version.

@DataProvider
public static Object[][] version(Method testMethod) throws Exception {
    String gitPath = getGitPath();
    GitVersion version = new AgentGitFacadeImpl(gitPath).version().call();
    RequiredGitVersion requirement = testMethod.getAnnotation(RequiredGitVersion.class);
    if (requirement == null)
        requirement = testMethod.getDeclaringClass().getAnnotation(RequiredGitVersion.class);
    if (requirement == null) {
        return new Object[][] { new Object[] { new GitExec(gitPath, version) } };
    } else {
        GitVersion minRequired = GitVersion.parse("git version " + requirement.min());
        if (version.isLessThan(minRequired)) {
            return new Object[0][];
        } else {
            return new Object[][] { new Object[] { new GitExec(gitPath, version) } };
        }
    }
}
Also used : AgentGitFacadeImpl(jetbrains.buildServer.buildTriggers.vcs.git.agent.AgentGitFacadeImpl) GitVersion(jetbrains.buildServer.buildTriggers.vcs.git.GitVersion) GitExec(jetbrains.buildServer.buildTriggers.vcs.git.command.GitExec) DataProvider(org.testng.annotations.DataProvider)

Example 9 with GitExec

use of jetbrains.buildServer.buildTriggers.vcs.git.command.GitExec in project teamcity-git by JetBrains.

the class GitPerformanceTests method incrementalIntellijFetch.

@Test
public // @Test(invocationCount = 100)
void incrementalIntellijFetch() throws Exception {
    final VcsRootImpl root = VcsRootBuilder.vcsRoot().withBranchSpec("+:refs/heads/*").withFetchUrl("ssh://git@git.jetbrains.team/intellij.git").withAuthMethod(AuthenticationMethod.PRIVATE_KEY_DEFAULT).build();
    final ServerPaths sp = new ServerPaths("/Users/victory/Tests/server_paths");
    final ServerPluginConfig config = new PluginConfigBuilder(sp).setSeparateProcessForFetch(true).build();
    final GitSupportBuilder builder = GitSupportBuilder.gitSupport().withServerPaths(sp).withPluginConfig(config).withFetchCommand(new NativeGitCommands(config, () -> new GitExec("git", new GitVersion(2, 34, 0)), new VcsRootSshKeyManager() {

        @Nullable
        @Override
        public TeamCitySshKey getKey(@NotNull VcsRoot root) {
            return null;
        }
    }));
    GitVcsSupport support = builder.build();
    final RepositoryStateData currentState = support.getCurrentState(root);
    final long startTime = new Date().getTime();
    System.out.println("Fetching repository...");
    final OperationContext ctx = support.createContext(root, "fetch");
    try {
        support.getCollectChangesPolicy().ensureRepositoryStateLoadedFor(ctx, currentState, true);
    } finally {
        ctx.close();
    }
    final long totalTime = new Date().getTime() - startTime;
    System.out.println("Fetch time: " + totalTime + "ms");
}
Also used : NativeGitCommands(jetbrains.buildServer.buildTriggers.vcs.git.command.NativeGitCommands) GitExec(jetbrains.buildServer.buildTriggers.vcs.git.command.GitExec) VcsRoot(jetbrains.buildServer.vcs.VcsRoot) NotNull(org.jetbrains.annotations.NotNull) Date(java.util.Date) VcsRootImpl(jetbrains.buildServer.vcs.impl.VcsRootImpl) RepositoryStateData(jetbrains.buildServer.vcs.RepositoryStateData) VcsRootSshKeyManager(jetbrains.buildServer.ssh.VcsRootSshKeyManager) ServerPaths(jetbrains.buildServer.serverSide.ServerPaths) Test(org.testng.annotations.Test)

Example 10 with GitExec

use of jetbrains.buildServer.buildTriggers.vcs.git.command.GitExec in project teamcity-git by JetBrains.

the class AgentConfigPluginTest method test_path_to_git.

public void test_path_to_git() throws VcsException {
    assertEquals("git", getPluginConfig().getPathToGit());
    assertEquals("/usr/bin/git", new PluginConfigImpl(myAgentConfig, myBuild, getVcsRoot(), new GitExec("/usr/bin/git", GitVersion.MIN)).getPathToGit());
}
Also used : GitExec(jetbrains.buildServer.buildTriggers.vcs.git.command.GitExec) PluginConfigImpl(jetbrains.buildServer.buildTriggers.vcs.git.agent.PluginConfigImpl)

Aggregations

GitExec (jetbrains.buildServer.buildTriggers.vcs.git.command.GitExec)11 NotNull (org.jetbrains.annotations.NotNull)5 VcsException (jetbrains.buildServer.vcs.VcsException)4 File (java.io.File)2 GitVersion (jetbrains.buildServer.buildTriggers.vcs.git.GitVersion)2 VcsRoot (jetbrains.buildServer.vcs.VcsRoot)2 GeneralCommandLine (com.intellij.execution.configurations.GeneralCommandLine)1 Date (java.util.Date)1 HashMap (java.util.HashMap)1 ExecResult (jetbrains.buildServer.ExecResult)1 AgentRunningBuild (jetbrains.buildServer.agent.AgentRunningBuild)1 BuildAgentConfiguration (jetbrains.buildServer.agent.BuildAgentConfiguration)1 AgentCheckoutAbility (jetbrains.buildServer.agent.vcs.AgentCheckoutAbility)1 GitProgressLogger (jetbrains.buildServer.buildTriggers.vcs.git.GitProgressLogger)1 AgentGitFacadeImpl (jetbrains.buildServer.buildTriggers.vcs.git.agent.AgentGitFacadeImpl)1 GitAgentSSHService (jetbrains.buildServer.buildTriggers.vcs.git.agent.GitAgentSSHService)1 GitDetector (jetbrains.buildServer.buildTriggers.vcs.git.agent.GitDetector)1 PluginConfigImpl (jetbrains.buildServer.buildTriggers.vcs.git.agent.PluginConfigImpl)1 Context (jetbrains.buildServer.buildTriggers.vcs.git.command.Context)1 NativeGitCommands (jetbrains.buildServer.buildTriggers.vcs.git.command.NativeGitCommands)1