def add_project(project): # https://docs.gitlab.com/ee/api/projects.html#get-single-project print("add_project") print(project) uuid = uuid4() name = project['path_with_namespace'] id = project['id'] get_cursor().execute(INSERT_PROJECT_SQL, (str(uuid), int(id), name, dumps(project))) commit_db()
def update_job_step(uuid, step, status): job = get_job_by_uuid(uuid) info = job['info'] or [] step['status'] = status info.append(step) # steps & env already stringified get_cursor().execute(" UPDATE jobs set steps = ? where uuid=? ", (json.dumps(info), str(uuid))) commit_db()
def update_project_pipeline(id, branch, steps, env): # steps & env already stringified get_cursor().execute(" UPDATE projects set build_branch= ?, pipeline_steps= ?, pipeline_envs= ? where id=? ", (branch, steps, env, id)) commit_db()
def update_job_status(uuid, status): # steps & env already stringified get_cursor().execute(" UPDATE jobs set status= ? where uuid=? ", (status, uuid)) commit_db()
def create_job(project_id): # https://docs.gitlab.com/ee/api/projects.html#get-single-project uuid = uuid4() get_cursor().execute(INSERT_JOB_SQL, (str(uuid), int(project_id))) commit_db()