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()); }
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); }
@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)); }
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()); }