docker安装gitlab-runner

docker pull gitlab/gitlab-runner:latest安装gitlab-runner

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

运行镜像

docker run -d --name gitlab-runner --restart always -v /var/run/docker.sock:/var/run/docker.sock -v /srv/gitlab-runner/config:/etc/gitlab-runner gitlab/gitlab-runner:latest

注册gitlab-runner

docker exec -it gitlab-runner 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,使用gitlab-runner环境。

重启容器docker restart gitlab-runner

修改配置文件docker exec -it name vim /etc/gitlab-runner/config.toml

pep8检查环境配置

进去docker容器环境docker exec -it name /bin/bashname就是容器的名称,如果没有启动容器,会报错。

安装python-pipapt-get update && apt-get install python-pip -y

使用pip安装flake8pep8pip install pep8 flake8,第一次使用pip可能需要更新pip install --upgrade pip

更改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 = 展示总错误数

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

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

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

  1. docker安装gitlab并部署CICD

    摘要 本文主要实现了在docker下安装gitlab,将gitlab绑定在宿主机的180端口,将gitlab的clone的URL添加指定端口号:部署了CI/CD,并公布了测试项目. 安装docker[ ...

  2. Docker安装Gitlab

    一.Ubuntu16.4上Docker安装Gitlab 1.安装docker 参见:https://docs.docker.com/engine/installation/linux/ubuntuli ...

  3. 解决 Windows Docker 安装 Gitlab Volume 权限问题

    本文首发于我的个人博客,解决 Windows Docker 安装 Gitlab Volume 权限问题 ,欢迎访问! 记录一下 Windows10 下 Docker 安装 Gitlab 的步骤. Ca ...

  4. 利用docker安装gitlab

    安装docker 安装 virtualbox 下载 dockertoolbox并安装 官网的服务器一直连不上, 幸亏还有这个 https://get.daocloud.io/toolbox/ 比 ht ...

  5. docker 安装gitlab

    # docker 安装gitlab # 一.安装镜像(官网文档) export GITLAB_HOME=/srv/gitlab # 必须先设置它,它就是你存储代码仓库的位置.以后要移植的时候直接把这个 ...

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

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

  7. centos7下使用docker安装gitlab

    环境背景: Docker化已经成为一种热门,记录一下使用docker引擎安装gitlab的过程. 测试环境: 系统 软件 依赖 CentOS 7.4 GitLab(latest) docker-ce ...

  8. Debian9 使用 Docker 安装 gitlab完整过程

    一. 安装Docker CE (参考 官网指南) 1. 卸载老版本 sudo apt-get remove docker docker-engine docker.io  2. Update the ...

  9. Ubuntu安装Gitlab Runner

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

  10. Centos7 docker安装GitLab

    *先决条件系统已安装Docker 1.查询GitLab镜像 docker search gitlab 2.现在GitLab镜像 3.创建文件夹 mkdir -p /software/gitlab/co ...

随机推荐

  1. python3批量查询域名是否注册

    #!/usr/local/bin/python3 #coding=utf-8 import re,sys,os,random,time, base64 import urllib.parse, url ...

  2. PowerDesigner模型分类

    原文:PowerDesigner模型分类 版权声明:本文为博主原创文章,未经博主允许不得转载. https://blog.csdn.net/zjws23786/article/details/8005 ...

  3. 获取root权限及破解原理分析

    2012-03-18 17:58:45|  分类: android |字号 订阅 如今Android系统的root破解基本上成为大家的必备技能!网上也有非常多中一键破解的软件,使root破解越来越ea ...

  4. Haroopad 安装到 Mac OSX

    打开Terminal 控制台 粘贴运行代码安装换cask: ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/ ...

  5. 人活着系列Tanya和蔡健雅猪 (floyd)

    人活着系列之芳姐和芳姐的猪 Time Limit: 1000MS Memory limit: 65536K 题目描写叙述 芳姐特别喜欢猪,所以,她特意养了m个猪圈,顺便在k条无向边,每条边有都有起点v ...

  6. sql 循环 随机数创建数据

    --循环 WHILE @i<40 BEGIN …… end --随机数 SET @money=rand()*100000 例子: DECLARE @i INT DECLARE @money MO ...

  7. MVC WebApi的两种访问方法

    //UserInfoController using ClassLibrary; using System;using System.Collections.Generic;using System. ...

  8. Springboot统一配置Jackson

    经常要为接口响应对象设置属性,序列化的时候是不是包含空值,反序列化的时候是否忽略不认识的字段.所以,必须要手动制定ObjectMapper或者在类上声明 @JsonInclude(Include.NO ...

  9. github网页

    GitHub主页 创建仓库 想必大家都有自己的Github账号吧,没有的可以到GitHub官网注册账号,注册完后,我们来下一步,在我们的GitHub上面右上角的New repository来创建一个仓 ...

  10. 微信小程序把玩(二十)slider组件

    原文:微信小程序把玩(二十)slider组件 slider滑动组件用的不太多,在其他平台反正我是用的不多 主要属性: wxml <slider max="100" step= ...