Advertisement

使用Python-GitLab模块执行CI实践以管理项目

阅读量:

安装与引入

复制代码
    $ conda activate env
    $ (env) pip install python-gitlab
    
    # test.py
    import gitlab

入门

gitlab.Gitlab主要负责处理HTTP请求。该类维护GitLab URL以及相关的认证信息。
在调用API之前,请确保熟悉以下核心概念:项目(project)、组(group)、用户(user)、提交(commit)以及持续集成与交付(CICD)。

从demo开始

复制代码
    # git账户的token
    private_token = "onlyidiotwilltrythistoken"  # https://my.oschina.net/u/4308934/blog/3365888
    # git地址
    private_host = 'https://gitlab.com'
    
    class Projects:
    # 获取基本信息
    def __init__(self, private_token):
        self.gl = gitlab.Gitlab(private_host, private_token=private_token)

全部评论 (0)

还没有任何评论哟~