Search in sources :

Example 1 with PipeConfValueVO

use of com.epam.pipeline.entity.configuration.PipeConfValueVO in project cloud-pipeline by epam.

the class PipelineConfigurationManager method updateMasterConfiguration.

public void updateMasterConfiguration(PipelineConfiguration configuration, boolean isNFS) {
    configuration.setClusterRole(MASTER_CLUSTER_ROLE);
    if (isNFS) {
        configuration.getParameters().put(NFS_CLUSTER_ROLE, new PipeConfValueVO("true"));
    }
    configuration.buildEnvVariables();
}
Also used : PipeConfValueVO(com.epam.pipeline.entity.configuration.PipeConfValueVO)

Example 2 with PipeConfValueVO

use of com.epam.pipeline.entity.configuration.PipeConfValueVO in project cloud-pipeline by epam.

the class PipelineConfigurationManager method updateWorkerConfiguration.

public void updateWorkerConfiguration(String parentId, PipelineStart runVO, PipelineConfiguration configuration, boolean isNFS, boolean clearParams) {
    configuration.setEraseRunEndpoints(hasBooleanParameter(configuration, ERASE_WORKER_ENDPOINTS));
    Map<String, PipeConfValueVO> updatedParams = clearParams ? new HashMap<>() : configuration.getParameters();
    updatedParams.put(PipelineRun.PARENT_ID_PARAM, new PipeConfValueVO(parentId));
    if (isNFS) {
        updatedParams.put(NFS_CLUSTER_ROLE, new PipeConfValueVO("true"));
    } else {
        updatedParams.remove(NFS_CLUSTER_ROLE);
    }
    configuration.setParameters(updatedParams);
    configuration.setClusterRole(WORKER_CLUSTER_ROLE);
    configuration.setCmdTemplate(StringUtils.hasText(runVO.getWorkerCmd()) ? runVO.getWorkerCmd() : WORKER_CMD_TEMPLATE);
    // remove node count parameter for workers
    configuration.setNodeCount(null);
    configuration.buildEnvVariables();
}
Also used : PipeConfValueVO(com.epam.pipeline.entity.configuration.PipeConfValueVO)

Example 3 with PipeConfValueVO

use of com.epam.pipeline.entity.configuration.PipeConfValueVO in project cloud-pipeline by epam.

the class ToolVersionDaoTest method shouldCRUDWithSettings.

@Test
public void shouldCRUDWithSettings() {
    Long toolId = tool.getId();
    PipelineConfiguration pipelineConfiguration = new PipelineConfiguration();
    pipelineConfiguration.setCmdTemplate(TEST_CMD_TEMPLATE_1);
    pipelineConfiguration.setNodeCount(TEST_NODE_COUNT);
    pipelineConfiguration.setParameters(Collections.singletonMap(TEST_PARAMETER_NAME, new PipeConfValueVO(TEST_PARAMETER_VALUE)));
    ConfigurationEntry configurationEntry = new ConfigurationEntry(pipelineConfiguration);
    List<ConfigurationEntry> settings = Collections.singletonList(configurationEntry);
    toolVersion1.setSettings(settings);
    toolVersionDao.createToolVersionWithSettings(toolVersion1);
    ToolVersion actual = toolVersionDao.loadToolVersionWithSettings(toolId, TEST_VERSION).orElse(null);
    validateToolVersionSettings(actual, configurationEntry, TEST_VERSION, toolId, TEST_PARAMETER_NAME);
    pipelineConfiguration.setCmdTemplate(TEST_CMD_TEMPLATE_2);
    configurationEntry.setConfiguration(pipelineConfiguration);
    settings = Collections.singletonList(configurationEntry);
    toolVersion1.setSettings(settings);
    toolVersionDao.updateToolVersionWithSettings(toolVersion1);
    actual = toolVersionDao.loadToolVersionWithSettings(toolId, TEST_VERSION).orElse(null);
    validateToolVersionSettings(actual, configurationEntry, TEST_VERSION, toolId, TEST_PARAMETER_NAME);
    toolVersionDao.deleteToolVersions(toolId);
    actual = toolVersionDao.loadToolVersion(toolId, TEST_VERSION).orElse(null);
    assertThat(actual).isNull();
}
Also used : PipeConfValueVO(com.epam.pipeline.entity.configuration.PipeConfValueVO) PipelineConfiguration(com.epam.pipeline.entity.configuration.PipelineConfiguration) ToolVersion(com.epam.pipeline.entity.docker.ToolVersion) ConfigurationEntry(com.epam.pipeline.entity.configuration.ConfigurationEntry) Test(org.junit.Test) AbstractSpringTest(com.epam.pipeline.AbstractSpringTest)

Example 4 with PipeConfValueVO

use of com.epam.pipeline.entity.configuration.PipeConfValueVO in project cloud-pipeline by epam.

the class PipelineConfigurationManagerTest method getPipelineStartVO.

private PipelineStart getPipelineStartVO() {
    PipelineStart vo = new PipelineStart();
    vo.setInstanceType(TEST_INSTANCE_TYPE);
    vo.setDockerImage(tool.getImage());
    vo.setHddSize(1);
    vo.setCmdTemplate("template");
    vo.setTimeout(TEST_TIMEOUT);
    vo.setNodeCount(1);
    vo.setIsSpot(true);
    vo.setParams(Collections.singletonMap("testParam", new PipeConfValueVO("testParamValue", "int", true)));
    return vo;
}
Also used : PipeConfValueVO(com.epam.pipeline.entity.configuration.PipeConfValueVO) PipelineStart(com.epam.pipeline.entity.pipeline.run.PipelineStart)

Example 5 with PipeConfValueVO

use of com.epam.pipeline.entity.configuration.PipeConfValueVO in project cloud-pipeline by epam.

the class PipelineRunTest method shouldReturnValidStringWithType.

@Test
public void shouldReturnValidStringWithType() {
    PipelineRun pipelineRun = new PipelineRun();
    Map<String, PipeConfValueVO> params = new HashMap<>();
    params.put(PARAM1_NAME, new PipeConfValueVO(PARAM1_VALUE, PARAM1_TYPE));
    params.put(PARAM2_NAME, new PipeConfValueVO(PARAM2_VALUE, PARAM2_TYPE));
    pipelineRun.convertParamsToString(params);
    assertThat(pipelineRun.getParams(), is(glueParams(glueParam(PARAM1_NAME, PARAM1_VALUE, PARAM1_TYPE), glueParam(PARAM2_NAME, PARAM2_VALUE, PARAM2_TYPE))));
}
Also used : PipeConfValueVO(com.epam.pipeline.entity.configuration.PipeConfValueVO) HashMap(java.util.HashMap) Test(org.junit.Test)

Aggregations

PipeConfValueVO (com.epam.pipeline.entity.configuration.PipeConfValueVO)11 PipelineConfiguration (com.epam.pipeline.entity.configuration.PipelineConfiguration)4 HashMap (java.util.HashMap)4 Test (org.junit.Test)4 ConfigurationEntry (com.epam.pipeline.entity.configuration.ConfigurationEntry)2 ToolVersion (com.epam.pipeline.entity.docker.ToolVersion)2 PipelineStart (com.epam.pipeline.entity.pipeline.run.PipelineStart)2 AbstractSpringTest (com.epam.pipeline.AbstractSpringTest)1 MessageConstants (com.epam.pipeline.common.MessageConstants)1 MessageHelper (com.epam.pipeline.common.MessageHelper)1 AbstractDataStorage (com.epam.pipeline.entity.datastorage.AbstractDataStorage)1 NFSDataStorage (com.epam.pipeline.entity.datastorage.nfs.NFSDataStorage)1 MetadataEntity (com.epam.pipeline.entity.metadata.MetadataEntity)1 PipeConfValue (com.epam.pipeline.entity.metadata.PipeConfValue)1 PipelineRun (com.epam.pipeline.entity.pipeline.PipelineRun)1 RunInstance (com.epam.pipeline.entity.pipeline.RunInstance)1 Tool (com.epam.pipeline.entity.pipeline.Tool)1 GitClientException (com.epam.pipeline.exception.git.GitClientException)1 AbstractManagerTest (com.epam.pipeline.manager.AbstractManagerTest)1 DataStorageApiService (com.epam.pipeline.manager.datastorage.DataStorageApiService)1