好吧,我在我的 Digital Ocean VPS 中创建了一个私人跑步者。这个私人跑步者正在使用shell executor,这是我的 gitlab-ci.yml 文件:
variables:
VERSION_NAME: ${CI_COMMIT_REF_NAME}-${CI_CONCURRENT_ID}
before_script:
- docker info
stages:
- test
- build
- deploy
- delivery
test_project:
tags:
- safepark
stage: test
image: mcr.microsoft.com/dotnet/core/sdk:2.1
script:
- dotnet test
build_image:
tags:
- safepark
only:
- master
stage: build
script:
- docker build -f WebApi/Dockerfile -t myuser/myimage
- docker tag -t myuser/myimage myuser/myimage:${VERSION_NAME}
push_image:
tags:
- safepark
only:
- master
stage: deploy
script:
- docker push myuser/myimage
- docker push myuser/myimage:${VERSION_NAME}
Run Code Online (Sandbox Code Playgroud)
但在“测试”阶段,图像永远不会被拉出,我得到“dotnet …
Not uploading cache {name of branch} due to policy我的 gitlab 运行程序出现错误。我的.yaml文件如下所示:
stages:
- test
- staging
- publish
- deploy
# cache using branch name
# https://gitlab.com/help/ci/caching/index.md
cache:
key: ${CI_COMMIT_REF_SLUG}
paths:
- .yarn
- node_modules/
policy: pull
before_script:
- yarn install --cache-folder .yarn
test:
stage: test
image: node:14
script:
- yarn install
- yarn test
pages:
stage: staging
image: alekzonder/puppeteer
except:
- master
script:
- yarn install
- yarn compile
- yarn build
publish:
stage: publish
image: …Run Code Online (Sandbox Code Playgroud) 我正在使用 GitLab CI/CD,并且有一个管道,其中包含来自单独配置文件的作业,该管道似乎工作正常。它看起来像这样:
.gitlab-ci.yml:
stages:
- triggers
- build
- test
- deploy
trigger_infra:
stage: triggers
trigger:
include: src/infra/.gitlab-ci.yml
rules:
- changes:
- src/infra/lib/spa-stack.ts
Run Code Online (Sandbox Code Playgroud)
src/infra/.gitlab-ci.yml:
deploy_spa:
stage: deploy
script:
- cd src/spa
Run Code Online (Sandbox Code Playgroud)
然而,我最近遇到了以下场景:
spa-stack.ts文件的代码;构建已触发并通过合并构建的错误消息是“无法创建下游管道,管道不会为选定的触发器运行。规则配置阻止将任何作业添加到管道中。”
我在这里缺少什么?下游作业没有规则配置,所以我觉得它应该总是运行,不问任何问题。
continuous-integration continuous-deployment gitlab gitlab-ci gitlab-ci-runner
我正在尝试在容器内使用docker命令。我使用此命令挂载/var/run/docker.sock并运行容器
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
Run Code Online (Sandbox Code Playgroud)
但是当我尝试在容器内使用docker(gitlab-runner)时出现错误
docker: not found
Run Code Online (Sandbox Code Playgroud)
主办:
srw-rw---- 1 root docker 0 Mar 23 15:13 docker.sock
Run Code Online (Sandbox Code Playgroud)
容器:
0 srw-rw---- 1 root gitlab-runner 0 Mar 23 15:13 docker.sock
Run Code Online (Sandbox Code Playgroud)
在我删除旧容器并创建新容器之前,此方法工作正常,现在我无法在容器中运行docker。请帮忙。
我面临着一个非常奇怪的问题。
首先我的设置:
我有一个私有的 Gitlab 服务器,它使用 Kubernetes 上的 Gitlab CI Runners 来构建 Docker 镜像。为此,我使用 Kaniko 图像。Runners 由 Gitlab 本身通过内置的 Kubernetes 管理进行配置。所有这些都在 PFSense 服务器后面运行。
现在我的问题是:
有时 Kaniko Pod 无法解析 GitLab 服务器的主机名。这会导致 git pull 失败,从而导致构建失败。我认为失败的几率为 60%,这对我们来说太高了。重试构建几次后,它将运行没有任何问题。
运行 Gitlab CI 的 Kubernetes 集群在 CentOS 7 上设置。SELinux 和 FirewallD 被禁用。所有主机都可以解析 GitLab 服务器。它也与导致问题的特定主机服务器无关。我发现它在所有 5 台服务器(包括 Manager 服务器)上都失败了。而且我还没有看到这个问题出现在其他 Pod 中。但集群中的其他部署实际上并不通过 DNS 进行连接。我确信 Runner 能够访问 DNS,因为它正在从 gcr.io 提取 Kaniko 映像。
有没有人见过这个问题或知道解决方法?
这是我的 CI 配置:
build:
stage: …Run Code Online (Sandbox Code Playgroud) 我是 docker 和 jenkins 的新手。但是最终我在 jenkins 中创建了一个作业,以便我可以删除存储在我们的 linux 机器(CentOS7)中的 gitlab-runner 的卷缓存
为了实现这一点,我每 6 小时在 jenkins 中使用以下命令创建一个定期作业:
docker volume prune -f
Run Code Online (Sandbox Code Playgroud)
但是它根本不清理空间。这是詹金斯工作的输出:
Started by timer
Running as SYSTEM
Building remotely on buildbng17 (gitlab) in workspace /mnt/data0/jenkins/workspace/gitlab-cleanup
[WS-CLEANUP] Deleting project workspace...
[WS-CLEANUP] Deferred wipeout is used...
[WS-CLEANUP] Done
[gitlab-cleanup] $ /bin/sh -xe /tmp/jenkins3799570002967825583.sh
+ find /mnt/data0/gitlab/data/backups/ -name '*.tgz' -mtime +30
/mnt/data0/gitlab/data/backups/etc-gitlab-1611415968.tgz
Started calculate disk usage of build
Finished Calculation of disk usage of build in 0 seconds
Started calculate disk usage of …Run Code Online (Sandbox Code Playgroud) 我有 .gitlab-ci.yml 文件,其中包含作业(使用 Win Runner,但在我的问题中并不重要):
runWin:
stage: runOnWin
tags: ['WinRunner']
rules:
- if: $CI_COMMIT_BRANCH == $jobbranch
script: |
echo "WinRunner job started %CI_JOB_NAME%"
dir
Run Code Online (Sandbox Code Playgroud)
它工作正常,但是 gitlab-runner 从 git 下载源代码,但实际上我根本不需要它。我可以写一些命令或关键字来阻止它吗?
我正在尝试在 GitLab 中为项目存储库中包含 Git 子模块的项目创建构建管道。当管道构建作业运行时,它会尝试克隆子模块,但失败并出现以下错误:could not read Username for 'https://gitlab.com': No such device or address
Git 子模块位于同一实例上的同一 GitLab 组中。我已经将这些环境变量添加到 .gitlab-ci.yml 中,如下所示:
---
stages:
- lint
- build
- deploy
variables:
GIT_SUBMODULE_STRATEGY: recursive
GIT_SUBMODULE_FORCE_HTTPS: "true"
Run Code Online (Sandbox Code Playgroud)
这是我运行管道的项目中的 .gitmodules 文件:
[submodule "build-tools"]
path = build-tools
url = https://gitlab.com/core/frontend-dev/build-tools.git
Run Code Online (Sandbox Code Playgroud)
这是该项目的网址:https://gitlab.com/core/frontend-dev/api-service.git
我是否需要将子模块 url 转换为相对 url,因为它们都位于同一个 GitLab 实例中?