标签: gitlab-ci

GitLab CI构建仍处于待定状态

我们最近开始在gitlab.com免费服务上使用GitLab-CI .起初一切都很好,但现在,似乎我们不能再建立我们的项目了.构建显示为pending并且不执行任何操作.

这是我们的构建列表中的内容:

建立

如果我们检查构建的详细信息:

细节

您可能会注意到,在列表中,每个构建都分配给一个运行者ID,但在详细信息页面中,runner部分为空.

起初,我们认为这只是由基础gitlab.com设施引起的延迟,但它真的只是停留在那里......

编辑

这是超过1年前,但我一直有关于这个问题的通知.如果我没记错的话,问题是由于GitLab本身.遵循GitLab文档并确保您的设置有效,并希望最好!

gitlab gitlab-ci gitlab-ci-runner

16
推荐指数
4
解决办法
9935
查看次数

从GitLab CI运行器连接到docker-in-docker

我有一个我想要的GitLab管道:

  1. 构建Java应用程序
  2. 使用docker-compose进行测试
  3. 推送到我的Docker存储库

我遇到的主要问题是这是有效的:

services:
  - docker:dind

docker_test:
  stage: docker_test
  image: docker:latest
  script:
  - docker version
Run Code Online (Sandbox Code Playgroud)

输出按预期打印:

> gitlab-ci-multi-runner exec docker --docker-privileged docker_test
...
$ docker version
Client:
 Version:      17.06.0-ce
...
Server:
 Version:      17.06.0-ce
...
Build succeeded
Run Code Online (Sandbox Code Playgroud)

虽然这没有(安装步骤docker-ce省略):

services:
  - docker:dind

docker_test:
  stage: docker_test
  image: ubuntu:latest       << note change
  script:
  - docker version
Run Code Online (Sandbox Code Playgroud)

它失败了:

$ docker version
Client:
 Version:      17.06.0-ce
 API version:  1.30
 Go version:   go1.8.3
 Git commit:   02c1d87
 Built:        Fri Jun 23 …
Run Code Online (Sandbox Code Playgroud)

gitlab docker gitlab-ci docker-in-docker

16
推荐指数
1
解决办法
5935
查看次数

如何通过 UI 在 GitLab 中重试管道(不是单个作业)?

基本上,我正在寻找触发的管道的重试按钮,但我看到的只是该管道的各个作业的重试按钮。我不想仅仅为了重试管道而推送提交。 参考截图

gitlab gitlab-ci

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

被拒绝:将映像推送到 gitlab 注册表时,请求的资源访问被拒绝

我正在尝试将图像推送到 gitlab 注册表。

我已经做过很多次了,所以我想知道为什么会出现这个错误。

我使用最新标签构建图像:

Successfully tagged registry.gitlab.com/mycompany/rgpd_api:latest
Run Code Online (Sandbox Code Playgroud)

然后我登录并推送:

docker login registry.gitlab.com -u gitlab+deploy-token-91931 
docker push registry.gitlab.com/mycompany/rgpd_api:latest
Run Code Online (Sandbox Code Playgroud)

但我得到:

The push refers to repository [registry.gitlab.com/mycompany/rgpd_api]
be679cc302b9: Preparing 
denied: requested access to the resource is denied
Run Code Online (Sandbox Code Playgroud)

我给了gitlab+deploy-token-91931代币read_repositoryread_registry权利。

我的仓库是:

https://gitlab.com/mycompany/rgpd_api
Run Code Online (Sandbox Code Playgroud)

我检查了文档页面:https://docs.gitlab.com/ee/user/project/container_registry.html

但是当我通过 Gitlab CI 执行此操作时,gitlab-ci-token

我可以正常推。

我也尝试重新生成一个新的令牌,但仍然是同样的问题。

我该如何解决它?

registry gitlab docker gitlab-ci

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

如何使用 GitLab CI/CD 中的规则在特定分支上运行作业

它似乎rules 取代了 only/except最新 GitLab 版本中的功能。

例如,以前,指定作业必须仅针对 master 分支执行是非常简单的。

如果按照规则来实现的话,该怎么办呢?

我猜测 GitLab 提供了一些指定当前分支名称的变量,但我找不到它。我看到的唯一例子是关于合并请求的。

换句话说,如果我有以下工作,如何限制它只在potato分支中运行?

unit_tests:
  stage: test
  script: dotnet vstest test/*UnitTests/bin/Release/**/*UnitTests.dll --Blame
  rules:
    - exists:
      - test/*UnitTests/*UnitTests.csproj
Run Code Online (Sandbox Code Playgroud)

gitlab-ci

16
推荐指数
2
解决办法
3万
查看次数

如何使用 GitLab CI/CD 获取整个存储库?

我目前正在设置 GitLab CI/CD。我们在项目中使用GitVersion,会抛出以下错误:

/root/.nuget/packages/gitversiontask/5.3.7/build/GitVersionTask.targets(46,9): error : InvalidOperationException: Could not find a 'develop' or 'master' branch, neither locally nor remotely.

根据这篇博客,当 CI 服务器没有获取完整的存储库时(我们有一个开发分支和一个主分支,但我正在开发另一个分支),就会发生这种情况。对于 Jenkins,我们通过扩展结账阶段解决了这个问题:

stage("Checkout") { gitlabCommitStatus(name: "Checkout") {
    
    // These are the normal checkout instructions
    cleanWs()
    checkout scm
    
    // This is the additional checkout to get all branches
    checkout([
      $class: 'GitSCM',
      branches: [[name: 'refs/heads/'+env.BRANCH_NAME]],
      extensions: [[$class: 'CloneOption', noTags: false, shallow: false, depth: 0, reference: '']],
      userRemoteConfigs: scm.userRemoteConfigs,
    ])

    sh "git checkout ${env.BRANCH_NAME}"
    sh "git reset --hard origin/${env.BRANCH_NAME}"
}} …
Run Code Online (Sandbox Code Playgroud)

git continuous-integration gitlab gitlab-ci

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

如何在 gitlab ci/cd 中使用自定义变量?

我正在与 gitlab ci/cd 变量作斗争。我看到很多相互矛盾的例子。无论如何,我想知道的是如何在脚本外部和内部使用变量。

例如,在作业配置中,我可以使用 bash 命令在脚本部分分配变量吗?

some-job:
   variables:
      SOME_VAR: ''
   script:
      - SOME_VAR = $(<file_with_a_line_of_text.txt)
Run Code Online (Sandbox Code Playgroud)

在上述情况下,我不确定我是否可以做到这一点。但我需要用文件内容(即工件)填充变量。另外,什么时候在变量前面使用“$”?我看到使用这些格式的一些示例:

"SOME_VAR" #in quotes, no dollar sign
"${SOME_VAR}" #in quotes, with dollar sign and wrapped with curly braces
${SOME_VAR} #no quotes, with dollar sign and wrapped with curly braces
$SOME_VAR #i.e. without the double quotes or curly braces
SOME_VAR #i.e. without the double quotes, dollar sign, and curly braces
Run Code Online (Sandbox Code Playgroud)

我可以在示例中看到如此多的用法变化,但实际上不知道何时使用每种样式。我无法在网上找到使用 bash 命令在脚本中设置自定义变量的示例。

bash shell gitlab gitlab-ci

16
推荐指数
2
解决办法
3万
查看次数

如何尽早退出 gitlab 管道而不失败?

我有一个gitlab.gitlab-ci.yml管道,其中第一个作业决定是否执行其余作业。这两种选择都不是 \xe2\x80\x9cfailure\xe2\x80\x9d 在 \xe2\x80\x9c 发送电子邮件并提醒每个人\xe2\x80\x9d 意义上。它只是当时需要或不需要\xe2\x80\x99t 完成。

\n

I\xe2\x80\x99m 寻找相反的allow_failure: true允许管道继续运行,无论作业的退出状态如何。相反,我想确定继续状态。

\n

有没有一种简单或常见的方法可以做到这一点?或者我是否再次陷入生成 yaml 文件的困境?

\n

gitlab gitlab-ci

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

无法加载配置“airbnb”以扩展 - gitlab ci

我尝试以各种方式进行和重做 Airbnb eslint 安装,但我总是在 GitLab-ci 中遇到此构建错误。它适用于我当地的环境。

我使用 create-react-app 创建了项目,单独安装了依赖项,以免覆盖 eslint 版本。但我尝试使用npx install-peerdeps --dev eslint-config-airbnb并重新安装通过创建 React 应用程序创建的 eslint 版本来安装所有依赖项。

我还尝试直接在 package.json 中设置依赖项,而不是创建配置文件

我的package.json:

{
  "name": "assinatura",
  "version": "0.1.0",
  "private": true,
  "dependencies": {
    "@emotion/react": "^11.4.1",
    "@emotion/styled": "^11.3.0",
    "@mui/material": "^5.0.2",
    "@react-pdf-viewer/core": "^2.9.1",
    "@react-pdf-viewer/page-navigation": "^2.9.1",
    "@react-pdf-viewer/zoom": "^2.9.1",
    "axios": "^0.21.4",
    "bootstrap": "^5.0.2",
    "enzyme-to-json": "^3.6.2",
    "pdfjs-dist": "2.6.347",
    "progress-bar": "^0.1.1",
    "prop-types": "^15.7.2",
    "query-string": "^7.0.1",
    "react": "^17.0.2",
    "react-bootstrap": "^2.0.0-rc.0",
    "react-dom": "^17.0.2",
    "react-icons": "^4.2.0",
    "react-meta-tags": "^1.0.1",
    "react-router-dom": "^5.2.0",
    "react-scripts": "4.0.3",
    "react-signature-canvas": "^1.0.3",
    "styled-components": "^5.3.1",
    "web-vitals": "^1.0.1"
  }, …
Run Code Online (Sandbox Code Playgroud)

eslint gitlab-ci eslint-config-airbnb

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

与名为 com.apple.fonts 的服务的连接在 xcodebuild -resolvePackageDependencies 上无效

我正在使用 fastlane 来构建我的 Unity iPhone 应用程序。\n它工作得很好,直到突然我在构建过程中开始收到以下错误/警告:

\n
[10:13:48]: $ xcodebuild -resolvePackageDependencies -scheme Unity-iPhone -project ./Unity-iPhone.xcodeproj\n[10:13:48]: \xe2\x96\xb8 2021-11-16 10:13:48.903 xcodebuild[59318:1348378] XType: failed to connect - Error Domain=NSCocoaErrorDomain Code=4099 "The connection to service named com.apple.fonts was invalidated: failed at lookup with error 3 - No such process." UserInfo={NSDebugDescription=The connection to service named com.apple.fonts was invalidated: failed at lookup with error 3 - No such process.}\n[10:13:48]: \xe2\x96\xb8 2021-11-16 10:13:48.904 xcodebuild[59318:1348378] Font server protocol version mismatch (expected:5 got:0), falling back to local fonts\n[10:13:48]: \xe2\x96\xb8 …
Run Code Online (Sandbox Code Playgroud)

xcode xcodebuild unity-game-engine gitlab-ci fastlane

16
推荐指数
1
解决办法
7207
查看次数