手动安装gitlab-runner

在终端使用命令curl -L https://packages.gitlab.com/install/repositories/runner/gitlab-runner/script.rpm.sh | sudo bash,输入sudo密码,导入指纹秘钥。速度有点慢。

安装sudo yum install gitlab-runner

打开自己搭建的GitLab网站,点击顶栏的Snippets后面的小扳手,再点击左侧列表中Overview中的Runners,在打开的网页下面,可以看到How to setup a shared Runner for a new project行,2是Runners设置时需要指定的URL,3是在设置是的Runners

注册gitlab-runner

sudo gitlab-runner register

Please enter the gitlab-ci coordinator URL (e.g. https://gitlab.com/):输入域名或者服务器ip地址,格式为https://gitlab.com。和token Please enter the gitlab-ci token for this runner:

Please enter the gitlab-ci description for this runner:输入runner描述。

Please enter the gitlab-ci tags for this runner (comma separated):给这个Runner指定tags,稍后也可以在GitLab's UI中修改。

Whether to run untagged builds [true/false]:选择Runner是否接受未指定tags的任务,稍后可修改。默认值为false

Whether to lock the Runner to current project [true/false]: 选择是否为当前项目锁定Runner,可修改。通常用于被指定为某个项目的Runner,默认值为true

Please enter the executor: docker, shell, virtualbox, kubernetes, docker-ssh, parallels, ssh, docker+machine, docker-ssh+machine: 选择Runner executor(Runner执行器),使用shell,使用默认本地环境。

pep8检查环境配置

在runner运行的服务器上配置python环境,基本上各大Linux发行版都默认带有python2版本。

CentOS安装pip的方法,使用命令sudo yum install python-pip安装,如果没有python-pip包,name先安装epel仓库sudo yum install epel-release,接受指纹。之后再执行一次命令安装。

使用pip安装flake8pep8,推荐使用pipenv安装。直接安装的方式sudo pip install pep8 flake8,第一次使用pip可能需要更新sudo pip install --upgrade pip,如果不使用sudo会报权限不足

更改pip源,提高下载速度。编辑$HOME/.pip/pip.conf,添加内容:

[global] index-url = https://mirrors.ustc.edu.cn/pypi/web/simple format = columns

如果文件不存在,创建新文件或目录。

在项目中使用flake8进行风格检查

需要在项目根目录下添加两个文件.flake8.gitlab-ci.yml,提交到gitlab上。

添加.flake8配置文件

[flake8]
ignore = W292
exclude =
*migrations*,
# python related
*.pyc,
.git,
__pycache__,
max-line-length=120
max-complexity=12
format=pylint
show_source = True
statistics = True
count = True

说明

注意, .flake8里面不要带中文
ignore = 忽略错误类型
exclude = 不检查的文件正则列表
max-line-length = 单行最大字符数120
max-complexity = 代码复杂度等级
format = 展示格式
show_source = 显示源代码
statistics = 展示统计
count = 展示总错误数

本地运行检测测试$ flake8 .

添加.gitlab-ci.yml配置文件

before_script:
- echo "Python静态代码检查..." pep8:
script:
- flake8 .

手动安装gitlab-runner的更多相关文章

  1. Ubuntu安装Gitlab Runner

    第一步: 添加GitLab的官方存储库:    curl -L https://packages.gitlab.com/install/repositories/runner/gitlab-runne ...

  2. 在 Kubernetes 上安装 Gitlab CI Runner Gitlab CI 基本概念以及 Runner 的安装

    简介 从 Gitlab 8.0 开始,Gitlab CI 就已经集成在 Gitlab 中,我们只要在项目中添加一个.gitlab-ci.yml文件,然后添加一个Runner,即可进行持续集成.在介绍 ...

  3. 3.在 Kubernetes 上安装 Gitlab CI Runner

    结合文章:1. 在 Kubernetes 上安装 Gitlab ,地址:https://www.cnblogs.com/sanduzxcvbnm/p/13852854.html 总结: 结合开头的文章 ...

  4. Gitlab + Gitlab runner + Window powershell

    需求说明 根据领导要求,要把python 项目移到Gitlab 进行管理,并利用Gitlab CI/CD 进行自动化测试,打包,部署.(听起来很简单吧) 比较头大,完全没有经验,python 也是刚上 ...

  5. Docker安装GitLab与Runner(网关),常规设置,自动化用到k8s+token

    [转]图文详解k8s自动化持续集成之GitLab CI/CD Windows里面使用Debian命令行工具完成 和Docker网络相关的命令 查看某一个容器的网络 docker inspect 容器I ...

  6. ubuntu 16.04.2 源码安装gitlab并且利用runner持续集成

    参考原档:https://gitlab.com/gitlab-org/gitlab-ce/blob/master/doc/install/installation.md#using-https 本章只 ...

  7. gitlab runner安装与使用

    今天来讲一下如何使用gitlab-runner 下载runner,根据自己对应服务器的型号自行选择下载: # Linux x86- sudo wget -O /usr/local/bin/gitlab ...

  8. Gitlab CI持续集成 - GitLab Runner 安装与注册

    GitLab Runner安装 需要添加gitlab官方库: # For Debian/Ubuntu/Mint curl -L https://packages.gitlab.com/install/ ...

  9. docker-Gitlab、GitLab Runner安装

    以下操作均在CentOs下操作 1.Gitlab install ① 启动gitlab docker run --detach \ --hostname 115.30.149.35 \ --publi ...

  10. 使用gitlab runner 进行CI(二):gitlab runner的安装与配置

    参考 https://docs.gitlab.com/runner/install/index.html,可以选择与gitlab相同的版本. gitlab runner可以通过安装binary包或do ...

随机推荐

  1. Opencv决策树分类器应用

    机器学习在数据挖掘.计算机视觉.搜索引擎.医学诊断.证券市场分析.语言与手写识别等领域有着十分广泛的应用,特别是在数据分析挥着越来越重要的作用.在机器学习中,决策树是最基础且应用最广泛的归纳推理算法之 ...

  2. duilib拖动控制功能的实现(源代码)

    转载请注明原始出处.谢谢~~:http://blog.csdn.net/zhuhongshu/article/details/41144283 duilib库中原本没有显示的对控件添加拖拽的功能.而实 ...

  3. [WPF疑难]ErrorTemplate显示与隐藏问题

    原文:[WPF疑难]ErrorTemplate显示与隐藏问题 [WPF疑难]ErrorTemplate显示与隐藏问题                                         周 ...

  4. 二叉树C语言

    几乎报价http://blog.csdn.net/hopeyouknow/article/details/6740616.为了这细微的地方进行了修改.他能够执行. bitree.h typedef i ...

  5. jquery 复选框操作-prop()的使用

    <!DOCTYPE html><html><head><meta http-equiv="Content-Type" content=&q ...

  6. 字符串、数组操作函数 Copy Concat Delete Insert High MidStr Pos SetLength StrPCopy TrimLeft

    对字符串及数组的操作,是每个程序员必须要掌握的.熟练的使用这些函数,在编程时能更加得心应手. 1.Copy 功能说明:该函数用于从字符串中复制指定范围中的字符.该函数有3个参数.第一个参数是数据源(即 ...

  7. HTML5离线缓存攻击测试

    本实验采用局域网模拟,通过修改本地HOSTS文件来模拟域名以及DNS欺骗.合法网站使用Linux CentOS7的apache服务器搭建,IP为192.168.1.113,HOSTS文件中加入192. ...

  8. c#代码安装字体文件

    public class FontOperate { [DllImport("kernel32.dll", SetLastError = true)] static extern ...

  9. Win10《芒果TV》更新v3.8.40青春版:优化推送策略、新增缓存清理

    芒果TV暑期重磅活动-青春芒果节拉开帷幕,炫酷的3D视觉大秀.王牌IP互动体验馆.众星云集的青春炙燥夜晚会.神秘的芒果吉祥物发布,Win10版<芒果TV>全平台同步更新青春版v3.8.40 ...

  10. Win10版《芒果TV》获评2016年度Windows Store最佳官方/休闲娱乐应用(LiveSino和微软信仰中心联合评选)

    微软信仰中心于2016年12月9日联合了 LiveSino 进行了最佳 Windows Store 应用特辑的投票评选,通过为期20天的海量用户投票,Win10版<芒果TV>荣获最佳官方应 ...