Search in sources :

Example 6 with CheckoutRules

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

the class DiffWithUpperLimitRevisionTest method no_error_when_revisions_are_the_same.

public void no_error_when_revisions_are_the_same() throws Exception {
    String version = "ad4528ed5c84092fdbe9e0502163cf8d6e6141e7";
    AgentRunningBuild build = createBuild(version, version);
    myVcsSupport.updateSources(myRoot, new CheckoutRules("+:.=>dir"), version, myCheckoutDir, build, false);
    then(myBuildLogger.getErrors()).isEmpty();
}
Also used : AgentRunningBuild(jetbrains.buildServer.agent.AgentRunningBuild) CheckoutRules(jetbrains.buildServer.vcs.CheckoutRules)

Example 7 with CheckoutRules

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

the class DiffWithUpperLimitRevisionTest method error_if_diff_found.

public void error_if_diff_found() throws Exception {
    String version = "ad4528ed5c84092fdbe9e0502163cf8d6e6141e7";
    AgentRunningBuild build = createBuild(version, "465ad9f630e451b9f2b782ffb09804c6a98c4bb9");
    myVcsSupport.updateSources(myRoot, new CheckoutRules("+:dir"), version, myCheckoutDir, build, false);
    then(myBuildLogger.getErrors()).isNotEmpty();
    then(myBuildLogger.getErrors().iterator().next()).contains("Files matched by checkout rules changed between build revision and upper-limit revision");
}
Also used : AgentRunningBuild(jetbrains.buildServer.agent.AgentRunningBuild) CheckoutRules(jetbrains.buildServer.vcs.CheckoutRules)

Example 8 with CheckoutRules

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

the class AgentVcsSupportTest method testSubmodulesCheckoutWithCustomConfig.

@Test
public void testSubmodulesCheckoutWithCustomConfig() throws Throwable {
    final AgentRunningBuild build = createRunningBuild(new HashMap<String, String>() {

        {
            put(PluginConfigImpl.CUSTOM_GIT_CONFIG, FileUtil.readText(dataFile("custom_config_example")));
        }
    });
    myRoot.addProperty(Constants.BRANCH_NAME, "patch-tests");
    myRoot.addProperty(Constants.SUBMODULES_CHECKOUT, SubmodulesCheckoutPolicy.CHECKOUT.name());
    myVcsSupport.updateSources(myRoot, new CheckoutRules(""), GitVcsSupportTest.SUBMODULE_ADDED_VERSION, myCheckoutDir, build, false);
    assertTrue(new File(myCheckoutDir, "submodule" + File.separator + "file.txt").exists());
}
Also used : CheckoutRules(jetbrains.buildServer.vcs.CheckoutRules) GitTestUtil.dataFile(jetbrains.buildServer.buildTriggers.vcs.git.tests.GitTestUtil.dataFile) File(java.io.File) Test(org.testng.annotations.Test)

Example 9 with CheckoutRules

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

the class AgentVcsSupportTest method testSubmmoduleCommitReferencedByTag_no_mirrors.

public void testSubmmoduleCommitReferencedByTag_no_mirrors() throws Exception {
    final AgentRunningBuild build = createRunningBuild(false);
    myRoot.addProperty(Constants.BRANCH_NAME, "TW-65043");
    myRoot.addProperty(Constants.SUBMODULES_CHECKOUT, SubmodulesCheckoutPolicy.CHECKOUT.name());
    myVcsSupport.updateSources(myRoot, new CheckoutRules(""), "4be4cc77ac427ecabf6ca53a76e33f6e186db6f2", myCheckoutDir, build, false);
    final File file = new File(myCheckoutDir, "submodule" + File.separator + "file.txt");
    assertTrue(file.exists());
    assertEquals("TW-65043", FileUtil.readText(file, "UTF-8").trim());
}
Also used : CheckoutRules(jetbrains.buildServer.vcs.CheckoutRules) GitTestUtil.dataFile(jetbrains.buildServer.buildTriggers.vcs.git.tests.GitTestUtil.dataFile) File(java.io.File)

Example 10 with CheckoutRules

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

the class AgentVcsSupportTest method short_lived_agent_auto_clone.

@Test
public void short_lived_agent_auto_clone() throws Exception {
    myBuild.getAgentConfiguration().addConfigurationParameter(AgentMiscConstants.IS_EPHEMERAL_AGENT_PROP, "true");
    final File remote = dataFile("repo_for_shallow_fetch.git");
    final File shallowMarker = new File(myCheckoutDir, ".git/shallow");
    final VcsRootImpl root = createRoot(remote, "refs/heads/main");
    root.addProperty(Constants.CHECKOUT_POLICY, AgentCheckoutPolicy.AUTO.name());
    myVcsSupport.updateSources(root, new CheckoutRules(""), "64195c330d99c467a142f682bc23d4de3a68551d", myCheckoutDir, myBuild, false);
    assertTrue(shallowMarker.exists());
}
Also used : VcsRootImpl(jetbrains.buildServer.vcs.impl.VcsRootImpl) CheckoutRules(jetbrains.buildServer.vcs.CheckoutRules) GitTestUtil.dataFile(jetbrains.buildServer.buildTriggers.vcs.git.tests.GitTestUtil.dataFile) File(java.io.File) Test(org.testng.annotations.Test)

Aggregations

CheckoutRules (jetbrains.buildServer.vcs.CheckoutRules)71 File (java.io.File)29 GitTestUtil.dataFile (jetbrains.buildServer.buildTriggers.vcs.git.tests.GitTestUtil.dataFile)29 VcsRoot (jetbrains.buildServer.vcs.VcsRoot)25 Test (org.testng.annotations.Test)23 TestFor (jetbrains.buildServer.util.TestFor)21 AgentRunningBuild (jetbrains.buildServer.agent.AgentRunningBuild)13 GitVcsSupport (jetbrains.buildServer.buildTriggers.vcs.git.GitVcsSupport)10 AgentCheckoutAbility (jetbrains.buildServer.agent.vcs.AgentCheckoutAbility)7 VcsException (jetbrains.buildServer.vcs.VcsException)6 VcsRootImpl (jetbrains.buildServer.vcs.impl.VcsRootImpl)5 FileReader (java.io.FileReader)4 Method (java.lang.reflect.Method)4 FetchCommand (jetbrains.buildServer.buildTriggers.vcs.git.command.FetchCommand)4 SVcsRoot (jetbrains.buildServer.vcs.SVcsRoot)4 BuildTypeOrTemplate (jetbrains.buildServer.server.rest.util.BuildTypeOrTemplate)3 AfterMethod (org.testng.annotations.AfterMethod)3 BeforeMethod (org.testng.annotations.BeforeMethod)3 ArrayList (java.util.ArrayList)2 BuildTriggerDescriptor (jetbrains.buildServer.buildTriggers.BuildTriggerDescriptor)2