예제 #1
0
def _build_url(url, branches):
    try:
        projects = (Project.objects.filter(repo__endswith=url)
                    | Project.objects.filter(repo__endswith=url + '.git'))
        if not projects.count():
            raise NoProjectException()
        for project in projects:
            (to_build, not_building) = _build_branches(project, branches)
            if not to_build:
                update_imported_docs.delay(
                    project.versions.get(slug=LATEST).pk)
                msg = '(URL Build) Syncing versions for %s' % project.slug
                pc_log.info(msg)
        if to_build:
            msg = '(URL Build) Build Started: %s [%s]' % (url,
                                                          ' '.join(to_build))
            pc_log.info(msg)
            return HttpResponse(msg)
        else:
            msg = '(URL Build) Not Building: %s [%s]' % (
                url, ' '.join(not_building))
            pc_log.info(msg)
            return HttpResponse(msg)
    except Exception, e:
        if e.__class__ == NoProjectException:
            raise
        msg = "(URL Build) Failed: %s:%s" % (url, e)
        pc_log.error(msg, exc_info=True)
        return HttpResponse(msg)
예제 #2
0
def _build_url(url, branches):
    """
    Map a URL onto specific projects to build that are linked to that URL.

    Check each of the ``branches`` to see if they are active and should be built.
    """
    try:
        projects = (Project.objects.filter(repo__iendswith=url)
                    | Project.objects.filter(repo__iendswith=url + '.git'))
        if not projects.count():
            raise NoProjectException()
        for project in projects:
            (built, not_building) = _build_branches(project, branches)
            if not built:
                # Call update_imported_docs to update tag/branch info
                update_imported_docs.delay(
                    project.versions.get(slug=LATEST).pk)
                msg = '(URL Build) Syncing versions for %s' % project.slug
                pc_log.info(msg)
        if built:
            msg = '(URL Build) Build Started: %s [%s]' % (url, ' '.join(built))
            pc_log.info(msg)
            return HttpResponse(msg)
        else:
            msg = '(URL Build) Not Building: %s [%s]' % (
                url, ' '.join(not_building))
            pc_log.info(msg)
            return HttpResponse(msg)
    except Exception as e:
        if e.__class__ == NoProjectException:
            raise
        msg = "(URL Build) Failed: %s:%s" % (url, e)
        pc_log.error(msg, exc_info=True)
        return HttpResponse(msg)
예제 #3
0
def _build_url(url, branches):
    try:
        projects = (
            Project.objects.filter(repo__endswith=url) |
            Project.objects.filter(repo__endswith=url + '.git'))
        if not projects.count():
            raise NoProjectException()
        for project in projects:
            (to_build, not_building) = _build_branches(project, branches)
            if not to_build:
                update_imported_docs.delay(project.versions.get(slug=LATEST).pk)
                msg = '(URL Build) Syncing versions for %s' % project.slug
                pc_log.info(msg)
        if to_build:
            msg = '(URL Build) Build Started: %s [%s]' % (
                url, ' '.join(to_build))
            pc_log.info(msg)
            return HttpResponse(msg)
        else:
            msg = '(URL Build) Not Building: %s [%s]' % (
                url, ' '.join(not_building))
            pc_log.info(msg)
            return HttpResponse(msg)
    except Exception as e:
        if e.__class__ == NoProjectException:
            raise
        msg = "(URL Build) Failed: %s:%s" % (url, e)
        pc_log.error(msg, exc_info=True)
        return HttpResponse(msg)
예제 #4
0
def _build_url(url, branches):
    """
    Map a URL onto specific projects to build that are linked to that URL.

    Check each of the ``branches`` to see if they are active and should be built.
    """
    try:
        projects = (
            Project.objects.filter(repo__iendswith=url) |
            Project.objects.filter(repo__iendswith=url + '.git'))
        if not projects.count():
            raise NoProjectException()
        for project in projects:
            (built, not_building) = _build_branches(project, branches)
            if not built:
                # Call update_imported_docs to update tag/branch info
                update_imported_docs.delay(project.versions.get(slug=LATEST).pk)
                msg = '(URL Build) Syncing versions for %s' % project.slug
                pc_log.info(msg)
        if built:
            msg = '(URL Build) Build Started: %s [%s]' % (
                url, ' '.join(built))
            pc_log.info(msg)
            return HttpResponse(msg)
        else:
            msg = '(URL Build) Not Building: %s [%s]' % (
                url, ' '.join(not_building))
            pc_log.info(msg)
            return HttpResponse(msg)
    except Exception as e:
        if e.__class__ == NoProjectException:
            raise
        msg = "(URL Build) Failed: %s:%s" % (url, e)
        pc_log.error(msg, exc_info=True)
        return HttpResponse(msg)
예제 #5
0
def _build_url(url, projects, branches):
    """
    Map a URL onto specific projects to build that are linked to that URL.

    Check each of the ``branches`` to see if they are active and should be
    built.
    """
    ret = ""
    all_built = {}
    all_not_building = {}

    # This endpoint doesn't require authorization, we shouldn't allow builds to
    # be triggered from this any longer. Deprecation plan is to selectively
    # allow access to this endpoint for now.
    if not any(_allow_deprecated_webhook(project) for project in projects):
        return HttpResponse('This API endpoint is deprecated', status=403)

    for project in projects:
        (built, not_building) = build_branches(project, branches)
        if not built:
            # Call update_imported_docs to update tag/branch info
            update_imported_docs.delay(project.versions.get(slug=LATEST).pk)
            msg = '(URL Build) Syncing versions for %s' % project.slug
            log.info(msg)
        all_built[project.slug] = built
        all_not_building[project.slug] = not_building

    for project_slug, built in list(all_built.items()):
        if built:
            msg = '(URL Build) Build Started: %s [%s]' % (
                url, ' '.join(built))
            log_info(project_slug, msg=msg)
            ret += msg

    for project_slug, not_building in list(all_not_building.items()):
        if not_building:
            msg = '(URL Build) Not Building: %s [%s]' % (
                url, ' '.join(not_building))
            log_info(project_slug, msg=msg)
            ret += msg

    if not ret:
        ret = '(URL Build) No known branches were pushed to.'

    return HttpResponse(ret)
예제 #6
0
def _build_url(url, projects, branches):
    """
    Map a URL onto specific projects to build that are linked to that URL.

    Check each of the ``branches`` to see if they are active and should be
    built.
    """
    ret = ""
    all_built = {}
    all_not_building = {}

    # This endpoint doesn't require authorization, we shouldn't allow builds to
    # be triggered from this any longer. Deprecation plan is to selectively
    # allow access to this endpoint for now.
    if not any(_allow_deprecated_webhook(project) for project in projects):
        return HttpResponse('This API endpoint is deprecated', status=403)

    for project in projects:
        (built, not_building) = build_branches(project, branches)
        if not built:
            # Call update_imported_docs to update tag/branch info
            update_imported_docs.delay(project.versions.get(slug=LATEST).pk)
            msg = '(URL Build) Syncing versions for %s' % project.slug
            log.info(msg)
        all_built[project.slug] = built
        all_not_building[project.slug] = not_building

    for project_slug, built in list(all_built.items()):
        if built:
            msg = '(URL Build) Build Started: %s [%s]' % (url, ' '.join(built))
            log_info(project_slug, msg=msg)
            ret += msg

    for project_slug, not_building in list(all_not_building.items()):
        if not_building:
            msg = '(URL Build) Not Building: %s [%s]' % (
                url, ' '.join(not_building))
            log_info(project_slug, msg=msg)
            ret += msg

    if not ret:
        ret = '(URL Build) No known branches were pushed to.'

    return HttpResponse(ret)
예제 #7
0
def _build_url(url, projects, branches):
    """
    Map a URL onto specific projects to build that are linked to that URL.

    Check each of the ``branches`` to see if they are active and should be built.
    """
    ret = ""
    all_built = {}
    all_not_building = {}
    for project in projects:
        (built, not_building) = build_branches(project, branches)
        if not built:
            # Call update_imported_docs to update tag/branch info
            update_imported_docs.delay(project.versions.get(slug=LATEST).pk)
            msg = '(URL Build) Syncing versions for %s' % project.slug
            log.info(msg)
        all_built[project.slug] = built
        all_not_building[project.slug] = not_building

    for project_slug, built in all_built.items():
        if built:
            msg = '(URL Build) Build Started: %s [%s]' % (
                url, ' '.join(built))
            log_info(project_slug, msg=msg)
            ret += msg

    for project_slug, not_building in all_not_building.items():
        if not_building:
            msg = '(URL Build) Not Building: %s [%s]' % (
                url, ' '.join(not_building))
            log_info(project_slug, msg=msg)
            ret += msg

    if not ret:
        ret = '(URL Build) No known branches were pushed to.'

    return HttpResponse(ret)
예제 #8
0
def _build_url(url, projects, branches):
    """
    Map a URL onto specific projects to build that are linked to that URL.

    Check each of the ``branches`` to see if they are active and should be built.
    """
    ret = ""
    all_built = {}
    all_not_building = {}
    for project in projects:
        (built, not_building) = _build_branches(project, branches)
        if not built:
            # Call update_imported_docs to update tag/branch info
            update_imported_docs.delay(project.versions.get(slug=LATEST).pk)
            msg = '(URL Build) Syncing versions for %s' % project.slug
            log.info(msg)
        all_built[project.slug] = built
        all_not_building[project.slug] = not_building

    for project_slug, built in all_built.items():
        if built:
            msg = '(URL Build) Build Started: %s [%s]' % (
                url, ' '.join(built))
            log_info(project_slug, msg=msg)
            ret += msg

    for project_slug, not_building in all_not_building.items():
        if not_building:
            msg = '(URL Build) Not Building: %s [%s]' % (
                url, ' '.join(not_building))
            log_info(project_slug, msg=msg)
            ret += msg

    if not ret:
        ret = '(URL Build) No known branches were pushed to.'

    return HttpResponse(ret)