Search in sources :

Example 31 with IgnoredFiles

use of com.thoughtworks.go.config.materials.IgnoredFiles in project gocd by gocd.

the class AutoTriggerDependencyResolutionTest method shouldNotTriggerPipelineWhenOnlyValidChangesAreIgnoredFiles.

@Test
public void shouldNotTriggerPipelineWhenOnlyValidChangesAreIgnoredFiles() throws Exception {
    // p1  <- SVN
    // |    /
    // v   v
    // p2 <- git (BL)
    SvnMaterial svn = u.wf(new SvnMaterial("url", "username", "password", false), "folder1");
    u.checkinInOrder(svn, "s1", "s2");
    GitMaterial git = u.wf(new GitMaterial("git"), "folder2");
    git.setFilter(new Filter(new IgnoredFiles("ignored.txt")));
    u.checkinInOrder(git, "g1");
    u.checkinFile(git, "g2", new File("ignored.txt"), ModifiedAction.modified);
    ScheduleTestUtil.AddedPipeline p1 = u.saveConfigWith("p1", u.m(svn));
    ScheduleTestUtil.AddedPipeline p2 = u.saveConfigWith("p2", u.m(p1), u.m(svn), u.m(git));
    String p1_1 = u.runAndPass(p1, "s1");
    String p2_1 = u.runAndPass(p2, p1_1, "s1", "g1");
    MaterialRevisions given = u.mrs(new MaterialRevision[] { u.mr(p1, false, p1_1), u.mr(svn, true, "s2"), u.mr(git, true, "g2") });
    MaterialRevisions previousRevisions = u.mrs(new MaterialRevision[] { u.mr(p1, false, p1_1), u.mr(svn, true, "s1"), u.mr(git, true, "g1") });
    AutoBuild autoBuild = new AutoBuild(goConfigService, pipelineService, p2.config.name().toString(), systemEnvironment, materialChecker);
    pipelineTimeline.update();
    BuildCause buildCause = autoBuild.onModifications(given, false, previousRevisions);
    assertThat(buildCause, is(nullValue()));
}
Also used : GitMaterial(com.thoughtworks.go.config.materials.git.GitMaterial) Filter(com.thoughtworks.go.config.materials.Filter) MaterialRevisions(com.thoughtworks.go.domain.MaterialRevisions) SvnMaterial(com.thoughtworks.go.config.materials.svn.SvnMaterial) IgnoredFiles(com.thoughtworks.go.config.materials.IgnoredFiles) CaseInsensitiveString(com.thoughtworks.go.config.CaseInsensitiveString) File(java.io.File) BuildCause(com.thoughtworks.go.domain.buildcause.BuildCause) Test(org.junit.jupiter.api.Test)

Example 32 with IgnoredFiles

use of com.thoughtworks.go.config.materials.IgnoredFiles in project gocd by gocd.

the class AutoTriggerDependencyResolutionTest method shouldNotTriggerPipelineWhenOnlyValidChangesAreIgnoredFiles_WhenFaninOff.

@Test
public void shouldNotTriggerPipelineWhenOnlyValidChangesAreIgnoredFiles_WhenFaninOff() throws Exception {
    // p1  <- SVN
    // |    /
    // v   v
    // p2 <- git (BL)
    SystemEnvironment env = mock(SystemEnvironment.class);
    when(env.enforceRevisionCompatibilityWithUpstream()).thenReturn(false);
    SvnMaterial svn = u.wf(new SvnMaterial("url", "username", "password", false), "folder1");
    u.checkinInOrder(svn, "s1", "s2");
    GitMaterial git = u.wf(new GitMaterial("git"), "folder2");
    git.setFilter(new Filter(new IgnoredFiles("ignored.txt")));
    u.checkinInOrder(git, "g1");
    u.checkinFile(git, "g2", new File("ignored.txt"), ModifiedAction.modified);
    ScheduleTestUtil.AddedPipeline p1 = u.saveConfigWith("p1", u.m(svn));
    ScheduleTestUtil.AddedPipeline p2 = u.saveConfigWith("p2", u.m(p1), u.m(svn), u.m(git));
    String p1_1 = u.runAndPass(p1, "s1");
    String p2_1 = u.runAndPass(p2, p1_1, "s1", "g1");
    MaterialRevisions given = u.mrs(new MaterialRevision[] { u.mr(p1, false, p1_1), u.mr(svn, true, "s2"), u.mr(git, true, "g2") });
    MaterialRevisions previousRevisions = u.mrs(new MaterialRevision[] { u.mr(p1, false, p1_1), u.mr(svn, true, "s1"), u.mr(git, true, "g1") });
    AutoBuild autoBuild = new AutoBuild(goConfigService, pipelineService, p2.config.name().toString(), env, materialChecker);
    pipelineTimeline.update();
    BuildCause buildCause = autoBuild.onModifications(given, false, previousRevisions);
    assertThat(buildCause, is(nullValue()));
}
Also used : SystemEnvironment(com.thoughtworks.go.util.SystemEnvironment) GitMaterial(com.thoughtworks.go.config.materials.git.GitMaterial) Filter(com.thoughtworks.go.config.materials.Filter) MaterialRevisions(com.thoughtworks.go.domain.MaterialRevisions) SvnMaterial(com.thoughtworks.go.config.materials.svn.SvnMaterial) IgnoredFiles(com.thoughtworks.go.config.materials.IgnoredFiles) CaseInsensitiveString(com.thoughtworks.go.config.CaseInsensitiveString) File(java.io.File) BuildCause(com.thoughtworks.go.domain.buildcause.BuildCause) Test(org.junit.jupiter.api.Test)

Example 33 with IgnoredFiles

use of com.thoughtworks.go.config.materials.IgnoredFiles in project gocd by gocd.

the class BuildCauseProducerServiceIntegrationHgTest method setup.

@BeforeEach
public void setup(@TempDir Path tempDir) throws Exception {
    dbHelper.onSetUp();
    configHelper.usingCruiseConfigDao(goConfigDao);
    configHelper.onSetUp();
    hgTestRepo = new HgTestRepo("hgTestRepo1", tempDir);
    hgMaterial = MaterialsMother.hgMaterial(hgTestRepo.projectRepositoryUrl());
    hgMaterial.setFilter(new Filter(new IgnoredFiles("helper/**/*.*")));
    workingFolder = TempDirUtils.createTempDirectoryIn(tempDir, "workingFolder").toFile();
    outputStreamConsumer = inMemoryConsumer();
    mingleConfig = configHelper.addPipeline("cruise", STAGE_NAME, this.hgMaterial.config(), "unit", "functional");
}
Also used : Filter(com.thoughtworks.go.config.materials.Filter) IgnoredFiles(com.thoughtworks.go.config.materials.IgnoredFiles) HgTestRepo(com.thoughtworks.go.helper.HgTestRepo) BeforeEach(org.junit.jupiter.api.BeforeEach)

Aggregations

Filter (com.thoughtworks.go.config.materials.Filter)33 IgnoredFiles (com.thoughtworks.go.config.materials.IgnoredFiles)33 Test (org.junit.jupiter.api.Test)19 CaseInsensitiveString (com.thoughtworks.go.config.CaseInsensitiveString)8 MaterialRevisions (com.thoughtworks.go.domain.MaterialRevisions)7 GitMaterialConfig (com.thoughtworks.go.config.materials.git.GitMaterialConfig)6 DependencyMaterialRevision (com.thoughtworks.go.domain.materials.dependency.DependencyMaterialRevision)6 HashMap (java.util.HashMap)6 Test (org.junit.Test)6 PluggableSCMMaterialConfig (com.thoughtworks.go.config.materials.PluggableSCMMaterialConfig)5 DependencyMaterialConfig (com.thoughtworks.go.config.materials.dependency.DependencyMaterialConfig)5 P4MaterialConfig (com.thoughtworks.go.config.materials.perforce.P4MaterialConfig)5 SvnMaterialConfig (com.thoughtworks.go.config.materials.svn.SvnMaterialConfig)5 BuildCause (com.thoughtworks.go.domain.buildcause.BuildCause)5 SystemEnvironment (com.thoughtworks.go.util.SystemEnvironment)5 PackageMaterialConfig (com.thoughtworks.go.config.materials.PackageMaterialConfig)4 HgMaterialConfig (com.thoughtworks.go.config.materials.mercurial.HgMaterialConfig)4 SvnMaterial (com.thoughtworks.go.config.materials.svn.SvnMaterial)4 TfsMaterialConfig (com.thoughtworks.go.config.materials.tfs.TfsMaterialConfig)4 MaterialConfig (com.thoughtworks.go.domain.materials.MaterialConfig)4