use of com.thoughtworks.go.plugin.access.scm.SCMPropertyConfiguration in project gocd by gocd.
the class PluggableSCMMaterialAgent method buildSCMPropertyConfigurations.
private SCMPropertyConfiguration buildSCMPropertyConfigurations(SCM scmConfig) {
SCMPropertyConfiguration scmPropertyConfiguration = new SCMPropertyConfiguration();
populateConfiguration(scmConfig.getConfiguration(), scmPropertyConfiguration);
return scmPropertyConfiguration;
}
use of com.thoughtworks.go.plugin.access.scm.SCMPropertyConfiguration in project gocd by gocd.
the class PluggableSCMMaterialPoller method modificationsSince.
@Override
public List<Modification> modificationsSince(final PluggableSCMMaterial material, File baseDir, final Revision revision, SubprocessExecutionContext execCtx) {
SCMPropertyConfiguration scmPropertyConfiguration = buildSCMPropertyConfigurations(material.getScmConfig());
MaterialInstance materialInstance = materialRepository.findMaterialInstance(material);
PluggableSCMMaterialRevision pluggableSCMMaterialRevision = (PluggableSCMMaterialRevision) revision;
SCMRevision previouslyKnownRevision = new SCMRevision(pluggableSCMMaterialRevision.getRevision(), pluggableSCMMaterialRevision.getTimestamp(), null, null, pluggableSCMMaterialRevision.getData(), null);
MaterialPollResult pollResult = scmExtension.latestModificationSince(material.getPluginId(), scmPropertyConfiguration, materialInstance.getAdditionalDataMap(), baseDir.getAbsolutePath(), previouslyKnownRevision);
final Map<String, String> materialData = pollResult.getMaterialData();
if (materialInstance.requiresUpdate(materialData)) {
updateAdditionalData(materialInstance.getId(), materialData);
}
List<SCMRevision> scmRevisions = pollResult.getRevisions();
return getModifications(scmRevisions);
}
use of com.thoughtworks.go.plugin.access.scm.SCMPropertyConfiguration in project gocd by gocd.
the class PluggableSCMMaterialPoller method checkout.
@Override
public void checkout(PluggableSCMMaterial material, File baseDir, Revision revision, SubprocessExecutionContext execCtx) {
SCMPropertyConfiguration scmPropertyConfiguration = buildSCMPropertyConfigurations(material.getScmConfig());
materialRepository.findMaterialInstance(material);
PluggableSCMMaterialRevision pluggableSCMMaterialRevision = (PluggableSCMMaterialRevision) revision;
SCMRevision scmRevision = new SCMRevision(pluggableSCMMaterialRevision.getRevision(), pluggableSCMMaterialRevision.getTimestamp(), null, null, pluggableSCMMaterialRevision.getData(), null);
Result result = scmExtension.checkout(material.getPluginId(), scmPropertyConfiguration, baseDir.getAbsolutePath(), scmRevision);
if (!result.isSuccessful())
throw new RuntimeException("Failed to perform checkout on pluggable SCM");
}
use of com.thoughtworks.go.plugin.access.scm.SCMPropertyConfiguration in project gocd by gocd.
the class PluggableSCMMaterialPoller method buildSCMPropertyConfigurations.
private SCMPropertyConfiguration buildSCMPropertyConfigurations(SCM scmConfig) {
SCMPropertyConfiguration scmPropertyConfiguration = new SCMPropertyConfiguration();
populateConfiguration(scmConfig.getConfiguration(), scmPropertyConfiguration);
return scmPropertyConfiguration;
}
use of com.thoughtworks.go.plugin.access.scm.SCMPropertyConfiguration in project gocd by gocd.
the class ScheduledPipelineLoaderIntegrationTest method setupPipelineWithScmMaterial.
private PipelineConfig setupPipelineWithScmMaterial(String pipelineName, String stageName, String jobName) {
PluggableSCMMaterialConfig pluggableSCMMaterialConfig = MaterialConfigsMother.pluggableSCMMaterialConfigWithConfigProperties("url", "password");
SCMPropertyConfiguration configuration = new SCMPropertyConfiguration();
configuration.add(new SCMProperty("url", null).with(PackageConfiguration.PART_OF_IDENTITY, true));
configuration.add(new SCMProperty("password", null).with(PackageConfiguration.PART_OF_IDENTITY, false));
SCMMetadataStore.getInstance().addMetadataFor(pluggableSCMMaterialConfig.getPluginId(), new SCMConfigurations(configuration), null);
PipelineConfig pipelineConfig = PipelineConfigMother.pipelineConfig(pipelineName, stageName, new MaterialConfigs(pluggableSCMMaterialConfig), jobName);
configHelper.addSCMConfig(pluggableSCMMaterialConfig.getSCMConfig());
configHelper.addPipeline(pipelineConfig);
return pipelineConfig;
}
Aggregations