Search in sources :

Example 1 with SCMPropertyConfiguration

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;
}
Also used : SCMPropertyConfiguration(com.thoughtworks.go.plugin.access.scm.SCMPropertyConfiguration)

Example 2 with 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);
}
Also used : MaterialPollResult(com.thoughtworks.go.plugin.access.scm.material.MaterialPollResult) SCMPropertyConfiguration(com.thoughtworks.go.plugin.access.scm.SCMPropertyConfiguration) PluggableSCMMaterialRevision(com.thoughtworks.go.domain.materials.scm.PluggableSCMMaterialRevision) SCMRevision(com.thoughtworks.go.plugin.access.scm.revision.SCMRevision) MaterialInstance(com.thoughtworks.go.domain.MaterialInstance)

Example 3 with SCMPropertyConfiguration

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");
}
Also used : SCMPropertyConfiguration(com.thoughtworks.go.plugin.access.scm.SCMPropertyConfiguration) PluggableSCMMaterialRevision(com.thoughtworks.go.domain.materials.scm.PluggableSCMMaterialRevision) SCMRevision(com.thoughtworks.go.plugin.access.scm.revision.SCMRevision) Result(com.thoughtworks.go.plugin.api.response.Result) MaterialPollResult(com.thoughtworks.go.plugin.access.scm.material.MaterialPollResult)

Example 4 with SCMPropertyConfiguration

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;
}
Also used : SCMPropertyConfiguration(com.thoughtworks.go.plugin.access.scm.SCMPropertyConfiguration)

Example 5 with 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;
}
Also used : SCMPropertyConfiguration(com.thoughtworks.go.plugin.access.scm.SCMPropertyConfiguration) SCMConfigurations(com.thoughtworks.go.plugin.access.scm.SCMConfigurations) SCMProperty(com.thoughtworks.go.plugin.access.scm.SCMProperty)

Aggregations

SCMPropertyConfiguration (com.thoughtworks.go.plugin.access.scm.SCMPropertyConfiguration)7 MaterialPollResult (com.thoughtworks.go.plugin.access.scm.material.MaterialPollResult)3 SCMRevision (com.thoughtworks.go.plugin.access.scm.revision.SCMRevision)3 MaterialInstance (com.thoughtworks.go.domain.MaterialInstance)2 PluggableSCMMaterialRevision (com.thoughtworks.go.domain.materials.scm.PluggableSCMMaterialRevision)2 SCMConfigurations (com.thoughtworks.go.plugin.access.scm.SCMConfigurations)2 SCMProperty (com.thoughtworks.go.plugin.access.scm.SCMProperty)2 Configuration (com.thoughtworks.go.domain.config.Configuration)1 PluginConfiguration (com.thoughtworks.go.domain.config.PluginConfiguration)1 Modifications (com.thoughtworks.go.domain.materials.Modifications)1 Result (com.thoughtworks.go.plugin.api.response.Result)1 Test (org.junit.jupiter.api.Test)1