コード例 #1
0
ファイル: DependencyMaterial.java プロジェクト: ollie314/gocd
 public void populateEnvironmentContext(
     EnvironmentVariableContext context, MaterialRevision materialRevision, File workingDir) {
   DependencyMaterialRevision revision =
       (DependencyMaterialRevision) materialRevision.getRevision();
   context.setPropertyWithEscape(
       format("GO_DEPENDENCY_LABEL_%s", getName()), revision.getPipelineLabel());
   context.setPropertyWithEscape(
       format("GO_DEPENDENCY_LOCATOR_%s", getName()), revision.getRevision());
 }
コード例 #2
0
 public List<MaterialRevision> addDependencyRevisionModification(
     List<MaterialRevision> materialRevisions,
     DependencyMaterial dependencyMaterial,
     Pipeline... upstreams) {
   String stageName = CaseInsensitiveString.str(dependencyMaterial.getStageName());
   String label = upstreams[0].getLabel();
   List<Modification> modifications = new ArrayList<Modification>();
   for (Pipeline upstream : upstreams) {
     modifications.add(
         new Modification(
             new Date(),
             DependencyMaterialRevision.create(
                     CaseInsensitiveString.str(dependencyMaterial.getPipelineName()),
                     upstream.getCounter(),
                     label,
                     stageName,
                     upstream.findStage(stageName).getCounter())
                 .getRevision(),
             label,
             upstream.getId()));
   }
   MaterialRevision depRev =
       addRevisionsWithModifications(
           dependencyMaterial, modifications.toArray(new Modification[0]));
   materialRevisions.add(depRev);
   return Arrays.asList(depRev);
 }
コード例 #3
0
 @Test
 public void shouldPublishItselfAsARealRevision() throws Exception {
   assertThat(new StringRevision("foo").isRealRevision(), is(true));
   assertThat(
       DependencyMaterialRevision.create("blahPipeline", 5, "blahLabel", "blahStage", 2)
           .isRealRevision(),
       is(true));
   assertThat(new NullRevision().isRealRevision(), is(false));
   assertThat(PipelineInstanceModel.UNKNOWN_REVISION.isRealRevision(), is(false));
 }
コード例 #4
0
ファイル: DependencyMaterial.java プロジェクト: ollie314/gocd
 public Revision oldestRevision(Modifications modifications) {
   if (modifications.size() > 1) {
     LOGGER.warn(
         String.format(
             "Dependency material %s has multiple modifications", this.getDisplayName()));
   }
   Modification oldestModification = modifications.get(modifications.size() - 1);
   String revision = oldestModification.getRevision();
   return DependencyMaterialRevision.create(revision, oldestModification.getPipelineLabel());
 }