Ejemplo n.º 1
0
def update_build_configuration(environment, product_version_id, art_params,
                               scm_repo_url, scm_revision, artifact_name,
                               project):
    build_config = buildconfigurations.get_build_configuration_by_name(
        name=artifact_name)
    internal_url = build_config.repository_configuration.internal_url
    external_url = build_config.repository_configuration.external_url

    scm_repo_url_no_git_ext = _remove_git_ext(scm_repo_url)

    if _remove_git_ext(internal_url) != scm_repo_url_no_git_ext and (
            external_url is not None
            and _remove_git_ext(external_url) != scm_repo_url_no_git_ext):
        logging.error(
            "SCM URL of existing Build Configuration '%s' cannot be changed" %
            artifact_name)
        return None

    buildconfigurations.update_build_configuration_raw(
        id=build_config.id,
        name=artifact_name,
        project=project.id,
        environment=environment.id,
        scm_repo_url=scm_repo_url,
        scm_revision=scm_revision,
        build_script=get_maven_options(art_params),
        product_version_id=product_version_id,
        generic_parameters=get_generic_parameters(art_params))
    return buildconfigurations.get_build_configuration_raw(id=build_config.id)
Ejemplo n.º 2
0
def update_build_configuration(environment, product_version_id, art_params, scm_repo_url, scm_revision, artifact_name, project):
    build_config = buildconfigurations.get_build_configuration_by_name(name=artifact_name)
    internal_url = build_config.repository_configuration.internal_url
    external_url = build_config.repository_configuration.external_url

    scm_repo_url_no_git_ext = _remove_git_ext(scm_repo_url)

    if _remove_git_ext(internal_url) != scm_repo_url_no_git_ext and (external_url is not None and _remove_git_ext(external_url) != scm_repo_url_no_git_ext):
        logging.error("SCM URL of existing Build Configuration '%s' cannot be changed" % artifact_name)
        return None

    buildconfigurations.update_build_configuration_raw(
                                                   id=build_config.id,
                                                   name=artifact_name,
                                                   project=project.id,
                                                   environment=environment.id,
                                                   scm_repo_url=scm_repo_url,
                                                   scm_revision=scm_revision,
                                                   build_script=get_maven_options(art_params),
                                                   product_version_id=product_version_id,
                                                   generic_parameters=get_generic_parameters(art_params))
    return buildconfigurations.get_build_configuration_raw(id=build_config.id)
Ejemplo n.º 3
0
def test_get_build_configuration_id(mock_configs_api, mock_get_specific,
                                    mock_set_id):
    result = buildconfigurations.get_build_configuration_raw(id=1)
    mock_set_id.assert_called_once_with(mock_configs_api, 1, None)
    mock_get_specific.assert_called_once_with(id=1)
    assert result == 'buildconfiguration'
def test_get_build_configuration_id(mock_configs_api, mock_get_specific, mock_set_id):
    result = buildconfigurations.get_build_configuration_raw(name='testerino')
    mock_set_id.assert_called_once_with(mock_configs_api, None, 'testerino')
    mock_get_specific.assert_called_once_with(id=1)
    assert result == 'buildconfiguration'