安装gitlab-runner

Posted xiongyungang

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了安装gitlab-runner相关的知识,希望对你有一定的参考价值。

 

# 下载 $sudo wget -O /usr/local/bin/gitlab-runner https://gitlab-runner-downloads.s3.amazonaws.com/latest/binaries/gitlab-runner-linux-amd64 # 修改权限 $chmod +x /usr/local/bin/gitlab-runner # 添加gitlab-runner用户 $useradd --comment ‘GitLab Runner‘ --create-home gitlab-runner --shell /bin/bash # 将gitlab-runner用户添加到docker组 $sudo usermod -aG docker gitlab-runner # 安装 $gitlab-runner install --user=gitlab-runner --working-directory=/home/gitlab-runner # 验证 $sudo -u gitlab-runner -H docker info 如图

技术分享图片

注册

$sudo gitlab-runner register

技术分享图片

查看配置信息

$cat /etc/gitlab-runner/config.toml concurrent = 1 check_interval = 0 [session_server] session_timeout = 1800 [[runners]] name = "my-runner" url = "https://gitlab.com/" token = "XXXXXXXXXXXXXXX" executor = "shell" [runners.cache] [runners.cache.s3] [runners.cache.gcs]

重启

# 重启gitlab-runner $gitlab-runner restart

配置项目

stages: - build before_script: - docker login -u "$DOCKER_USER" -p "$DOCKER_PASS" $DOCKER_ADDRESS build_image: stage: build script: - docker build -f Dockerfile -t "$DOCKER_ADDRESS/workspace/myimage" . - docker push "$DOCKER_ADDRESS/workspace/myimage"

参考

https://docs.gitlab.com/ce/ci/docker/using_docker_build.html
http://answ.me/post/build-docker-images-automatically-via-gitlab-ci/


以上是关于安装gitlab-runner的主要内容,如果未能解决你的问题,请参考以下文章

gitlab-runner:管道无限等待

安装gitlab-runner

Gitlab-runner 安装和配置

如何使用包管理器在 Debian 11 上安装 gitlab-runner

linux 安装 gitlab-runner 失败

另一台服务器上的Gitlab-runner