コード例 #1
0
ファイル: route_api.py プロジェクト: ivancoppa/orlo
def post_packages(release_id):
    """
    Add a package to a release

    :param string release_id: UUID of the release to add the package to
    :<json string name: Name of the package
    :<json string version: Version of the package
    :<json boolean rollback: Whether this package deploy is a rollback
    :>json string id: UUID reference to the created package
    :reqheader Content-Type: Must be application/json
    :status 200: Package was added to the release successfully
    :status 400: Invalid request
    **Example curl**:

    .. sourcecode:: shell

        curl -H "Content-Type: application/json" \\
        -X POST \\
        http://127.0.0.1/releases/${RELEASE_ID}/packages \\
        -d '{"name": "test-package", "version": "1.0.1"}'
    """
    validate_package_input(request, release_id)

    release = fetch_release(release_id)
    package = create_package(release.id, request)

    app.logger.info(
            'Create package {}, release {}, name {}, version {}'.format(
                    package.id, release.id, request.json['name'],
                    request.json['version']))

    db.session.add(package)
    db.session.commit()

    return jsonify(id=package.id)
コード例 #2
0
ファイル: route_releases.py プロジェクト: dustinnguyen/orlo
def post_releases_start(release_id):
    """
    Indicate that a release is starting

    This trigger the start of the deploy

    :param string release_id: Release UUID

    **Example curl**:

    .. sourcecode:: shell

        curl -H "Content-Type: application/json" \\
        -X POST http://127.0.0.1/releases/${RELEASE_ID}/deploy
    """
    release = fetch_release(release_id)
    # TODO call deploy Class start Method
    app.logger.info("Release start, release {}".format(release_id))
    release.start()
    db.session.add(release)
    db.session.commit()

    deploy = ShellDeploy(release)
    deploy.start()
    return '', 204
コード例 #3
0
ファイル: releases.py プロジェクト: weargoggles/orlo
def post_packages(release_id):
    """
    Add a package to a release

    :param string release_id: UUID of the release to add the package to
    :<json string name: Name of the package
    :<json string version: Version of the package
    :<json boolean rollback: Whether this package deploy is a rollback
    :>json string id: UUID reference to the created package
    :reqheader Content-Type: Must be application/json
    :status 200: Package was added to the release successfully
    :status 400: Invalid request
    **Example curl**:

    .. sourcecode:: shell

        curl -H "Content-Type: application/json" \\
        -X POST http://127.0.0.1/releases/${RELEASE_ID}/packages \\
        -d '{"name": "test-package", "version": "1.0.1"}'
    """
    validate_package_input(request, release_id)

    release = fetch_release(release_id)
    package = create_package(release.id, request)

    app.logger.info(
        'Create package {}, release {}, name {}, version {}'.format(
            package.id, release.id, request.json['name'],
            request.json['version']))

    db.session.add(package)
    db.session.commit()

    return jsonify(id=package.id)
コード例 #4
0
ファイル: releases.py プロジェクト: weargoggles/orlo
def post_releases_start(release_id):
    """
    Indicate that a release is starting

    :param release_id:
    :return:
    """
    release = fetch_release(release_id)
    app.logger.info("Release start, release {}".format(release_id))
    release.start()

    db.session.add(release)
    db.session.commit()
    return '', 204
コード例 #5
0
def post_releases_start(release_id):
    """
    Indicate that a release is starting

    :param release_id:
    :return:
    """
    release = fetch_release(release_id)
    app.logger.info("Release start, release {}".format(release_id))
    release.start()

    db.session.add(release)
    db.session.commit()
    return '', 204
コード例 #6
0
ファイル: route_api.py プロジェクト: ivancoppa/orlo
def post_releases_stop(release_id):
    """
    Indicate that a release has finished

    This should be called after all packages have also been "stopped".
    In future it may stop any un-stopped packages.

    :param string release_id: Release UUID

    **Example curl**:

    .. sourcecode:: shell

        curl -H "Content-Type: application/json" \\
        -X POST http://127.0.0.1/releases/${RELEASE_ID}/stop
    """
    release = fetch_release(release_id)
    # TODO check that all packages have been finished
    app.logger.info("Release stop, release {}".format(release_id))
    release.stop()

    db.session.add(release)
    db.session.commit()
    return '', 204
コード例 #7
0
ファイル: releases.py プロジェクト: weargoggles/orlo
def post_releases_stop(release_id):
    """
    Indicate that a release has finished

    This should be called after all packages have also been "stopped".
    In future it may stop any un-stopped packages.

    :param string release_id: Release UUID

    **Example curl**:

    .. sourcecode:: shell

        curl -H "Content-Type: application/json" \\
        -X POST http://127.0.0.1/releases/${RELEASE_ID}/stop
    """
    release = fetch_release(release_id)
    # TODO check that all packages have been finished
    app.logger.info("Release stop, release {}".format(release_id))
    release.stop()

    db.session.add(release)
    db.session.commit()
    return '', 204
コード例 #8
0
def post_releases_deploy(release_id):
    """
    Deploy a Release

    :param string release_id: Release UUID

    **Example curl**:

    .. sourcecode:: shell

        curl -H "Content-Type: application/json" \\
        -X POST http://127.0.0.1/releases/${RELEASE_ID}/deploy
    """
    release = fetch_release(release_id)
    app.logger.info("Release start, release {}".format(release_id))

    release.start()
    db.session.add(release)
    db.session.commit()

    # TODO call deploy Class start Method, i.e. pure python rather than shell
    deploy = ShellDeploy(release)
    output = deploy.start()
    return jsonify(output), 200