标签: gitlab-ci-runner

修改 gitlab-runner 的 PATH

我想在我的 Windows 10 机器上安装一个gitlab-runner(executor shaell)。我在 gitlab 服务器上开始工作,它总是以消息结束the command "git" cannot be found(大致翻译成英文)。事实上,git这不是我的道路的一部分。如何PATHgitlab-runner启动时修改shell 的变量?

To use git on the command line in windows I usually set it with the statement: PATH %PATH%C:\Program Files\Git\bin.

Is it documented somewhere, git has to be available to the runner? How can I see the command line the runner invokes (i.e. the call to git)?

gitlab gitlab-ci-runner

6
推荐指数
2
解决办法
9077
查看次数

自动注册 GitLab runner

我有一个docker-compose.yml设置 Gitlab、Container Registry 和 Gitlab Runner 的文件。

version: '2'

services:
  redis:
    restart: always
    image: sameersbn/redis:latest
    command:
    - --loglevel warning
    volumes:
    - redis:/var/lib/redis:Z

  postgresql:
    restart: always
    image: sameersbn/postgresql:9.5-3
    volumes:
    - postgresql:/var/lib/postgresql:Z
    environment:
    - DB_USER=gitlab
    - DB_PASS=password
    - DB_NAME=gitlabhq_production
    - DB_EXTENSION=pg_trgm

  gitlab:
    restart: always
    image: sameersbn/gitlab:10.1.1
    volumes:
    - gitlab-data:/home/git/data:Z
    - gitlab-logs:/var/log/gitlab
    - ./certs:/certs
    depends_on:
    - redis
    - postgresql
    ports:
    - "80:80"
    - "2222:22"
    external_links:
    - "registry:registry"
    environment:
    - DEBUG=false

    - DB_ADAPTER=postgresql
    - DB_HOST=postgresql
    - DB_PORT=5432
    - DB_USER=gitlab
    - DB_PASS=password
    - …
Run Code Online (Sandbox Code Playgroud)

gitlab gitlab-ci-runner docker-compose

6
推荐指数
1
解决办法
2653
查看次数

是否可以在没有 CI/CD 的情况下部署 GItLab Pages?

我们有一个本地部署的 Gitlab 实例,当时我们无法负担一个 GitLab Runner 来运行 CI/CD 管道。

是否可以在没有 CI/CD 的情况下使用 GitLab Pages?例如,是否可以手动准备 HTML 内容,将其放在public根目录中的文件夹中并使其可访问?

gitlab gitlab-ci gitlab-ci-runner gitlab-pages

6
推荐指数
1
解决办法
191
查看次数

如何在运行程序中设置具有写入存储库权限的 gitlab CI 令牌

我想标记一个构建,当尝试推送标签时,我在 CI 中收到以下错误

如何创建 CI 令牌并在构建环境中设置它可以将标签推送到存储库。

[01:59:14]: Exit status of command 'git push origin --tags' was 128 instead of 0.
remote: You are not allowed to upload code.
fatal: unable to access 'https://gitlab-ci-token:[MASKED]@gxx.yy.zz.git/': The requested URL returned error: 403
Run Code Online (Sandbox Code Playgroud)

gitlab gitlab-ci gitlab-ci-runner

6
推荐指数
1
解决办法
6557
查看次数

Gitlab:对等方的证书颁发者已被标记为不受用户信任

我有一个本地 gitlab,我正在尝试运行一些构建/管道,但出现以下错误 -

fatal: unable to access 'https://gitlab-ci-token:[MASKED]@gitlab.systems/testing/test-project-poc.git/': Peer's certificate issuer has been marked as not trusted by the user.
Run Code Online (Sandbox Code Playgroud)

我已经研究过这个 - Gitlab:Peer's Certificate Issuer is not recognize.pem并按照通过合并 来获取文件的步骤进行操作server certificateintermediate certificateroot certificate我仍然收到以下错误,并且确实很难找到根本原因。

/etc/gitlab/gitlab.rb config

##! enable/disable 2-way SSL client authentication
#nginx['ssl_verify_client'] = "off"

##! if ssl_verify_client on, verification depth in the client certificates chain
#nginx['ssl_verify_depth'] = "1"

nginx['ssl_certificate'] = "/etc/gitlab/ssl/gitlab.systems.pem"
nginx['ssl_certificate_key'] = "/etc/gitlab/ssl/gitlab.systems.key"
Run Code Online (Sandbox Code Playgroud)

是否还有其他配置需要更新/修改?非常感谢任何指导。

gitlab gitlab-ci-runner gitlab-omnibus

6
推荐指数
1
解决办法
2万
查看次数

GitLab 运行程序没有携带 node_modules 和缓存到下一个作业?

我遇到一个问题,我的 e2e 测试在 GitLab 中失败,但正常通过。我将问题范围缩小到了 node_modules,并且 cypress 缓存没有延续到下一个作业。这就是WARN Local package.json exists, but node_modules missing, did you mean to install出现错误的原因,因为 node_modules 不存在。

我认为缓存没有保留的原因是因为它被保存在一个运行器上,但是如果下一个作业在另一个运行器上,则缓存将不存在并且最终会失败。我可以将所有内容都放在一项工作中,但如果我要添加另一项工作进行部署,那么我仍然会遇到同样的问题。

这是我的 gitlab-ci.yml 文件:

image: cypress/base:12.18.4

variables:
  NPM_REGISTRY: https://registry.npmjs.org/
  npm_config_cache: $CI_PROJECT_DIR/.npm
  CYPRESS_CACHE_FOLDER: $CI_PROJECT_DIR/cache/Cypress

stages:
  - build
  - test:unit
  - test:e2e
  - lint

cache:
  key: ${CI_COMMIT_REF_SLUG}
  paths:
    - cache/Cypress
    - node_modules/

build:
  stage: build
  script:
    # set the npm registry if different from the default
    - npm config set registry $NPM_REGISTRY
    - npm i
    - npx cypress verify …
Run Code Online (Sandbox Code Playgroud)

npm node-modules gitlab gitlab-ci-runner cypress

6
推荐指数
1
解决办法
6503
查看次数

GitLab Runner:无法注册运行器。您可能遇到网络问题

我正在尝试创建一个 kubernetes gitlab 运行程序,并且遇到了Failed to register the runner. You may be having network problems.我知道gitlab.com可以从我的主机访问的非常普遍的错误,但我需要更多信息来调试此问题的根本原因。

请注意,该错误确实会持续 30 次尝试,每次尝试与以下情况相同:

Registration attempt 8 of 30                                                                                                                   
Runtime platform                                    arch=amd64 os=linux pid=107 revision=775dd39d version=13.8.0                               
WARNING: Running in user-mode.                                                                                                                 
WARNING: The user-mode requires you to manually start builds processing:                                                                       
WARNING: $ gitlab-runner run                                                                                                                   
WARNING: Use sudo for system-mode:                                                                                                             
WARNING: $ sudo gitlab-runner...                                                                                                               
                                                                                                                                               
ERROR: Registering runner... failed                 runner=dh5qxNxL status=couldn't execute POST against https://gitlab.com/api/v4/runners: Post https://gitlab.com/api/v4/runners: EOF
PANIC: Failed to register the runner. You …
Run Code Online (Sandbox Code Playgroud)

gitlab gitlab-ci kubernetes gitlab-ci-runner

6
推荐指数
1
解决办法
5558
查看次数

如何在同一实例中运行 Gitlab CI 作业

AWS我已经在现场实例上自动缩放了 gitlab-runner 。而且效果很好。

我在运行作业时遇到问题。下面是我的.gitlab-ci.yml,它有两个阶段。

stages:
 - build
 - dev1:build

build:
 stage: build
 script: 
  - docker build --rm -t broker-connect-dev1-${CI_COMMIT_SHORT_SHA} -f BrokerConnect/Dockerfile .
 only:
  - dev1/release
 tags:
  - itela-spot-runner     

build-dev1:
 stage: dev1:build
 script: 
  - docker tag broker-connect-dev1-${CI_COMMIT_SHORT_SHA}:latest 19950818/broker-connect:${DEV1_TAG} 
 only:
  - dev1/release
 tags:
  - itela-spot-runner  
Run Code Online (Sandbox Code Playgroud)

问题来了,因为我使用竞价实例来运行作业,有时该build阶段发生在一个竞价实例中,而该dev1:build阶段发生在另一个竞价实例中。当这种情况发生时,dev1:build它会失败,因为它无法找到图像,broker-connect-dev1-${CI_COMMIT_SHORT_SHA}因为它是在单独的 Spot 实例中构建的。在 gitlab 或 gitlab-runner 中,有没有办法控制这种行为并在同一个现场实例中运行这两个build作业dev1:build

gitlab gitlab-ci gitlab-ci-runner

6
推荐指数
1
解决办法
6451
查看次数

在为 GitLab Runner 拉取镜像之前登录 Docker

我已经设置了一个 docker 运行程序,我想在其中运行存储在本地存储库上的映像。我的 /etc/gitlab-runner/config.toml 是

concurrent = 1
check_interval = 0

[session_server]
  session_timeout = 1800


[[runners]]
  name = "Docker runner"
  url = "https://gitlab.str.corp/"
  token = "*secret*"
  executor = "docker"
  [runners.custom_build_dir]
  [runners.cache]
    [runners.cache.s3]
    [runners.cache.gcs]
    [runners.cache.azure]
  [runners.docker]
    tls_verify = false
    image = "gitlab.example.com:4443/docker:19.03.1-dind"
    privileged = true
    disable_entrypoint_overwrite = false
    oom_kill_disable = false
    disable_cache = false
    volumes = ["/certs/client", "/cache"]
    shm_size = 0
Run Code Online (Sandbox Code Playgroud)

当我提交作业时,它在运行器上启动,但无法拉取图像:

Running with gitlab-runner 13.4.0 (4e1f20da)
  on Docker runner abcde123

Preparing the "docker" executor
Using Docker executor with image gitlab.example.com:4443/docker:19.03.8-git …
Run Code Online (Sandbox Code Playgroud)

gitlab docker gitlab-ci gitlab-ci-runner

6
推荐指数
1
解决办法
1万
查看次数

gitlab-runner:准备环境无法在 Windows 中启动进程 pwsh

在新的 WIN10 机器上安装带有 shell 执行器(即 powershell)的 gitlab-runner 并启动 CI 构建会引发以下错误:

Preparing environment
ERROR: Job failed (system failure): prepare environment: failed to start process: exec: "pwsh": executable file not found in %PATH%. Check https://docs.gitlab.com/runner/shells/index.html#shell-profile-loading for more information
Run Code Online (Sandbox Code Playgroud)

gitlab-ci gitlab-ci-runner

6
推荐指数
1
解决办法
1915
查看次数