コード例 #1
0
ファイル: api.py プロジェクト: strodew/release-services
def sync_releases(releases):
    session = g.db.session
    for release in releases:
        try:
            session.query(Release).filter(
                Release.name == release['name']).one()
            # nothing todo
        except NoResultFound:
            status = 'shipped'
            if not release['shippedAt']:
                status = 'aborted'
            r = Release(
                product=release['product'],
                version=release['version'],
                branch=release['branch'],
                revision=release['mozillaRevision'],
                build_number=release['buildNumber'],
                release_eta=release.get('release_eta'),
                partial_updates=release.get('partials'),
                status=status,
            )
            r.created = release['submittedAt']
            r.completed = release['shippedAt']
            session.add(r)
            session.commit()
    return jsonify({'ok': 'ok'})
コード例 #2
0
def shipit_import(api_from):
    session = flask.current_app.db.session

    click.echo('Fetching release list...', nl=False)
    req = requests.get(f'{api_from}/releases?status=shipped,aborted,scheduled')
    req.raise_for_status()
    releases = req.json()

    for release in releases:
        r = Release(
            product=release['product'],
            version=release['version'],
            branch=release['branch'],
            revision=release['revision'],
            build_number=release['build_number'],
            release_eta=release.get('release_eta'),
            partial_updates=release.get('partials'),
            status=release['status'],
        )
        r.created = release['created']
        r.completed = release['completed'] or release['created']
        session.add(r)
        session.commit()
コード例 #3
0
def shipit_import(api_from):
    session = flask.current_app.db.session

    click.echo("Fetching release list...", nl=False)
    req = requests.get(f"{api_from}/releases?status=shipped,aborted,scheduled")
    req.raise_for_status()
    releases = req.json()

    for release in releases:
        r = Release(
            product=release["product"],
            version=release["version"],
            branch=release["branch"],
            revision=release["revision"],
            build_number=release["build_number"],
            release_eta=release.get("release_eta"),
            partial_updates=release.get("partials"),
            status=release["status"],
        )
        r.created = release["created"]
        r.completed = release["completed"] or release["created"]
        session.add(r)
        session.commit()