Пример #1
0
def api_build_image():
    name = request.form['project']
    app = eru.get_app(name)

    p = Project.get_by_name(name)
    if not p.is_accessible(g.user):
        return {'reason': '你没有操作这个项目的权限'}, 403

    revision = request.form['revision']
    _register_app(app['git'], revision)
    _get_project(app['git'])

    pod = request.form['pod']
    image = 'docker-registry.intra.hunantv.com/nbeimage/%s' % request.form['image']
    eru.build_image(g.user.group, pod, app['name'], image, revision)

    log = OPLog.create(g.user.id, OPLOG_ACTION.build_image)
    log.project_name = name
    log.image = '%s:%s' % (name, revision)
Пример #2
0
 def get_by_name(cls, name):
     try:
         p = eru.get_app(name)
         return p and cls(**p) or None
     except:
         return None
Пример #3
0
def revision_list_entrypoints_for_latest_ver():
    p = request.args['project']
    project = _get_project(eru.get_app(p)['git'])
    y = _get_rev_appyaml(project['id'], _lastest_version_sha(p))
    return y['entrypoints'].keys()
Пример #4
0
def revision_list_entrypoints():
    project = _get_project(eru.get_app(request.args['project'])['git'])
    y = _get_rev_appyaml(project['id'], request.args['commit'])
    return y['entrypoints'].keys()