当我想要做一些需要sudo privelegies的东西时,构建过程会停滞不前,而且ps aux对于那个命令来说,它会挂在列表中但什么都不做.
例如:
在buildscript中:
# stop nginx
echo "INFO: stopping nginx. pid [$(cat /opt/nginx/logs/nginx.pid)]"
sudo kill $(cat /opt/nginx/logs/nginx.pid)
Run Code Online (Sandbox Code Playgroud)
在gitlab ci输出控制台中:
INFO: stopping nginx. pid [2741]
kill $(cat /opt/nginx/logs/nginx.pid) # with a spinning wheel
Run Code Online (Sandbox Code Playgroud)
在bash中:
> ps aux | grep nginx
root 6698 0.0 0.1 37628 1264 ? Ss 19:25 0:00 nginx: master process /opt/nginx/sbin/nginx
nobody 6700 0.3 0.3 41776 3832 ? S 19:25 0:00 nginx: worker process
kai 7015 0.0 0.0 4176 580 pts/0 S+ 19:27 0:00 …Run Code Online (Sandbox Code Playgroud) 在7.4版本中,gitlab改变了新项目中受保护分支的行为.
在每个新项目中,默认分支(例如master)是受保护的分支,这意味着开发人员无法推送它.在我的公司中,很多开发人员都在默认/主分支上工作,现在在开始一个新项目时就开始蠢蠢欲动了.
我的问题:在ui中还是在gitlab.rb恢复7.4之前的行为并且不保护默认分支?
我想将项目从一个组转移到另一个用户.例如从https://gitlab.local/groupname/projectname到https://gitlab.local/userA/projectname
我该如何实现这一目标?我有gitadmin权限.
我正在使用 GitLab Pages 部署我的 React 应用程序,它运行良好。
这是我的gitlab-ci.yml:
# Using the node alpine image to build the React app
image: node:alpine
# Announce the URL as per CRA docs
# https://github.com/facebook/create-react-app/blob/master/packages/react-scripts/template/README.md#advanced-configuration
variables:
PUBLIC_URL: /
# Cache node modules - speeds up future builds
cache:
paths:
- client/node_modules
# Name the stages involved in the pipeline
stages:
- deploy
# Job name for gitlab to recognise this results in assets for Gitlab Pages
# https://docs.gitlab.com/ee/user/project/pages/introduction.html#gitlab-pages-requirements
pages:
stage: deploy
script:
- …Run Code Online (Sandbox Code Playgroud) 我正在致力于向 gitlab 添加代码质量。其中一个步骤需要更改 config.toml。
我在项目存储库的根级别有 .gitlab-ci.yml。并且管道拾取此文件。
我在哪里定义 config.toml ?在根级别,或者我需要创建一个新文件夹,例如 /etc/gitlab-runner/config.toml
gitlab的容器注册表(https://gitlab.com/help/container_registry/README.md)的文档提供了一个配置示例,其中包含以下指令:
- docker login -u gitlab-ci-token -p $CI_BUILD_TOKEN registry.example.com
而这个解释:
You have to use the credentials of the special gitlab-ci-token user with its password stored in $CI_BUILD_TOKEN in order to push to the Registry connected to your project. This allows you to automated building and deployment of your Docker images.
我找不到关于这个特殊gitlab-ci-token用户的任何文档,也没有关于$CI_BUILD_TOKENvar的文档.
这个特殊用户是什么?它是自动可用的吗?是否必须在某处定义?应该给$CI_BUILD_TOKENvar 什么值?
我正在使用Hosted Gitlab来托管我的Git存储库,最近我一直在使用它来构建/部署PHP和Java应用程序到服务器.
我想要做的是一旦构建完成,使用SSH部署应用程序.有时这可能只是通过SSH将最终构建(PHP文件)的内容上传到服务器,或者有时可能上传已编译的.jar文件,然后在远程服务器上执行命令以重新启动服务.
我已经将自己的Docker容器设置为构建环境,这包括Java,PHP,Composer和Maven等所有构建完成所需的东西.我正在使用此图像来运行构建.
我想知道的是,我如何通过SSH连接外部服务器以执行我可以在gitlab-ci.yaml文件中指定的部署命令?
我是开发社区的新手,特别是DevOps实践的新手,作为项目的一部分,我们正在尝试将SonarQube与Gitlab集成,在SonarQube和Git CI(持续集成)上进行了一些研发,看起来像是为Github和SonarQube发布的插件而不是Gitlab.
使用SonarQube配置GitLab以检查每个拉取请求的代码质量以及集成这两个部分的最佳实践是多么现实.
谢谢
我正在尝试实施GitLab CI Pipelines来构建和部署Angular应用程序.在我们的项目中,我们有两个一般分支:( master仅限生产)和develop.为了开发,我们feature/some-feature从develop分支创建分支.当开发完成后,我们创建合并请求feature/some-feature到develop.当合并请求被批准并合并到develop分支时,我想运行管道以构建应用程序并在某些环境中部署构建.
我在.gitlab-ci.yml中使用以下设置:
image: node:7.5-configured
stages:
- build
- deploy
build_job:
stage: build
only:
- develop
script:
- /bin/bash <some script here>
...
Run Code Online (Sandbox Code Playgroud)
问题是每次我进入任何feature/some-feature分支时都会执行Pipeline .我的设置有什么问题?我怎样才能迫使管道被执行只有当推进行到develop直接分支?
解决方案
这是我的错误 - 我在develop分支和feature/some-feature分支中有两个不同的.gitlab-ci.yml文件.