标签: gitlab-ci-runner

Git:获取分支中最新推送中所有提交的列表

我正在尝试在 gitlab-runner 中创建一个自动管道,它将应用最新git push. 它正在获取推送中的最新提交(使用 gitlab-runner 中的 $CI_COMMIT_SHA 变量)。但是,如果一次推送有多个提交,它会忽略较旧的提交。因此,所有更改都不会应用到应用程序中。

我有以下疑问:

  1. 是否为每个 git Push 分配了任何 Id?基本上给定一个 git Push Id,有没有办法找到所有底层提交?
  2. gitlab-runner 有没有办法找到最新 git 推送中提交的所有文件?另外,我更愿意保持它们提交的顺序。
  3. 我看到这git cherry可以给我未推送的提交列表。有没有办法,我可以通过变量将信息传递给 gitlab-runner ?

提前致谢

git runner git-push git-cherry gitlab-ci-runner

5
推荐指数
1
解决办法
1120
查看次数

警告:将工件作为“存档”上传到协调器...失败 id=1515 responseStatus=500 内部服务器错误状态=500

我正在使用Gitlab自助服务器社区版ci/cd功能,一直运行良好,但是突然有一天,gitlab/cicd中的所有项目都失败了,它提到以下错误:

Uploading artifacts for successful job
Uploading artifacts...
promotion-api/my-boot-module-system/target/*.jar: found 1 matching files and directories 
WARNING: Uploading artifacts as "archive" to coordinator... failed  id=1515 responseStatus=500 Internal Server Error status=500 token=xrDFnLeB
WARNING: Retrying...                                context=artifacts-uploader error=invalid argument
WARNING: Uploading artifacts as "archive" to coordinator... failed  id=1515 responseStatus=500 Internal Server Error status=500 token=xrDFnLeB
WARNING: Retrying...                                context=artifacts-uploader error=invalid argument
WARNING: Uploading artifacts as "archive" to coordinator... failed  id=1515 responseStatus=500 Internal Server Error status=500 token=xrDFnLeB
FATAL: invalid argument                            
ERROR: Job failed: exit code 1
Run Code Online (Sandbox Code Playgroud)

以下是.gitlab-ci.yml中的代码 …

gitlab gitlab-ci gitlab-ci-runner

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

使用 Shell Executor 在 CI-CD 的 GitLab Config yml 文件中激活 Conda 环境

我想在我的 Gitlab CI-CD 进程中激活 conda 环境。我在与我的工作笔记本电脑不同的本地计算机(UNIX)上使用 Shell Executor 注册了 Gitlab 运行程序(v13.10) 我试图通过我的存储库中存在的环境 yml 文件激活 conda 环境,但它失败并显示 conda 命令未找到!

我编辑了 .gitlab-ci.yml 文件,如下所示:

stages:
  - build
build stage:
    stage: build
    before_script:
        - which python
        - export PIP_CACHE_DIR="/opt/cache/pip"
        - conda env create -f environment.yml
        - source activate env_work
    script:
        - echo "Building"
        - cd parent_dir
        - python main.py new_studies/first_study
    artifacts:
        paths:
            - out/
    only:
        - master
Run Code Online (Sandbox Code Playgroud)

我面临的问题是它抛出一个错误:CONDA Command NOT FOUND

Running with gitlab-runner 13.10.0 (5421146)
  on rig ci runner gZzdceA
Preparing the …
Run Code Online (Sandbox Code Playgroud)

python gitlab anaconda conda gitlab-ci-runner

5
推荐指数
1
解决办法
1924
查看次数

如何使用 gitlab-ci.yml 进行简单的拉取?

git pull每次我从本地项目向 gitlab 存储库进行 git 推送时,在服务器项目中执行 a 的正确形式是什么?

这是我的 gitlab-ci.yml:

stages:
  - test
  - deploy

test:
  stage: test
  only:
    - develop
    - production
  script:
    - git checkout develop
    - git pull

step-deploy-prod:
  stage: deploy
  only:
    - production
  script:
    - git checkout production
    - git pull
  environment: production
  when: manual
Run Code Online (Sandbox Code Playgroud)

这是来自 Gitlab CI/CD 作业的消息:

Running with gitlab-runner 13.9.0-rc2 (69c049fd)
  on docker-auto-scale 72989761
  feature flags: FF_GITLAB_REGISTRY_HELPER_IMAGE:true
Preparing the "docker+machine" executor
00:36
Using Docker executor with image ruby:2.5 ...
Pulling docker image …
Run Code Online (Sandbox Code Playgroud)

git gitlab gitlab-ci gitlab-ci-runner

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

GitLab 作业允许某些退出代码失败

我有一份 GitLab CI/CD 工作,做一些事情。

我希望某些执行的命令能够失败并导致此作业发出警告,但我也希望其他命令在失败时导致管道中出现错误。

我已经在 .yaml 文件中进行了设置allow_failure: true,无论出现什么错误,这都会导致此作业出现警告。

我可以告诉 GitLab 作业输出特定退出代码的错误和另一个退出代码的警告吗?

yaml gitlab gitlab-ci gitlab-ci-runner

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

gitlab-ci 运行程序需要很长时间才能从 S3 缓存下载/上传(没有“ServerAddress”)

我们有一个 gitlab 运行器在 AWS 上的 kubernetes 集群中运行。测试工作:

test-job:
  image: centos
  stage: build
  cache:
    paths:
     - output
  script:
    - mkdir -p output
    - date +"%Y-%m-%d" > output/date.txt
  tags:
    - docker
  when: always
takes about 4 minutes to run - but only 4s if i remove the "cache" section.
Run Code Online (Sandbox Code Playgroud)

我的跑步者的 config.toml 看起来像这样

[[runners]]
  name = "gitlab-runner..."
  url = "https://gitlab...."
  token = "....."
  executor = "docker"
  [runners.custom_build_dir]
  [runners.cache]
    Type = "s3"
    Shared = true
    [runners.cache.s3]
      AccessKey = "...."
      SecretKey = "...."
      BucketName = …
Run Code Online (Sandbox Code Playgroud)

gitlab gitlab-ci-runner gitlab-runner

5
推荐指数
1
解决办法
2219
查看次数

Gitlab-Runner Windows 服务:使用管理权限构建

问题

  • 如果在本地终端中以“以管理员身份运行”启动运行,则构建服务器上 Powershell 中的 gitlab-runner 会成功完成(vb6.exe、devenv.com、msbuild.exe),而在作为配置为本地管理员的 Windows 服务运行时会出现错误

期望的行为

  • 通过 gitlab-runner 作为独立构建服务器上的 Windows 服务,以管理权限构建项目(vb6.exe、devenv.com、msbuild.exe)

配置

  • Windows Server 2019,Gitlab-Runner v.14.3.2 64位,powershell模式,使用本地管理员帐户运行的服务
  • Visual Studio (VS) 构建需要管理员权限才能实现 VB6 UI (VS VB98) 和 VB6/C# (VS 2019) 项目之间的互操作性。在构建 VS 期间,如果在 VS 解决方案的子项目中选择了互操作模式,则会在 Windows 注册表中写入内容(因此必须具有管理员权限)。

尝试一下

  • 安装 gitlab-runner 作为https://docs.gitlab.com/runner/install/windows.html推荐的服务

  • 暂时停用用户帐户控制但没有成功

  • 修改了 gitlab-ci.yml 以使用 Powershell 命令调用 vb6.exe、devenv.com 和 msbuild.exe Start-Process -Verb runAs -Wait devenv.com ...,但最终出现错误,devenv.com因为Start-Process似乎只接受以*.exeas 文件结尾的应用程序。devenv.exe正在工作,但未通过 Start-Process 返回/关闭新的终端会话,最终导致挂起的 gitlab-ci-build-script 。此外,构建脚本的终端消息不再可见,因为它们正在由 . 创建的新终端会话中运行Start-Process

  • 停用 gitlab-runner 服务并通过 …

windows-services administrator gitlab-ci gitlab-ci-runner

5
推荐指数
1
解决办法
5559
查看次数

gitlab不扩展并行/矩阵中使用的变量

我试图将变量传递给并行/矩阵,但没有看到变量被扩展并且作业失败。这是通过环境变量在作业中设置的。我试图回显脚本中的变量并查看它显示正确的值,但不会在并行/矩阵中被替换。我错过了什么吗?

.common_deploy:
  script:
    - |
      echo "showing the regions from environment"
      echo $qa_regions
      echo "showing the regions from job variable"
      echo $REGIONS
  parallel:
    matrix:
      - REGION: "${REGIONS}"
      
DeployToQA:
  variables:
    ENVIRONMENT: qa
    REGIONS: $qa_regions
  extends:
    - .common_deploy
  stage: deploy
  rules:
    - if: '$CI_PIPELINE_SOURCE == "push" && $CI_COMMIT_BRANCH == "master"'
      allow_failure: true
Run Code Online (Sandbox Code Playgroud)

这里变量$qa_regions的值为“us-west-2,us-east-1”,我希望看到这些地区的 2 个工作,但我看到的工作是DeployToQA: [${REGIONS}]

gitlab gitlab-ci gitlab-ci-runner gitlab-api

5
推荐指数
1
解决办法
9002
查看次数

在 ecs fargate 上使用 docker dind 和 GitLab runner

我在 EC2 上设置了一个 GitLab 运行程序,它会触发 Fargate ECS 集群上的作业。我一步步遵循本教程:https ://docs.gitlab.com/runner/configuration/runner_autoscale_aws_fargate

在 CI/CD 期间,我构建了 docker 映像,然后我想在 CI/CD 的其他阶段重用它们。所以当我使用共享运行器时,我使用了 docker dind:

  image: docker:stable
  services:
    - docker:dind
Run Code Online (Sandbox Code Playgroud)

我的config.toml看起来像这样:

concurrent = 1
check_interval = 0

[session_server]
  session_timeout = 1800

[[runners]]
  name = "fargate-runner"
  url = "https://gitlab.com/"
  token = "KRGVsYCF-V-D1u7UvCjq"
  executor = "custom"
  builds_dir = "/opt/gitlab-runner/builds"
  cache_dir = "/opt/gitlab-runner/cache"
  [runners.custom]
    config_exec = "/opt/gitlab-runner/fargate"
    config_args = ["--config", "/etc/gitlab-runner/fargate.toml", "custom", "config"]
    prepare_exec = "/opt/gitlab-runner/fargate"
    prepare_args = ["--config", "/etc/gitlab-runner/fargate.toml", "custom", "prepare"]
    run_exec = "/opt/gitlab-runner/fargate"
    run_args = …
Run Code Online (Sandbox Code Playgroud)

gitlab docker gitlab-ci gitlab-ci-runner aws-fargate

5
推荐指数
1
解决办法
2104
查看次数

Gitlab CI 准备环境:来自守护进程的错误响应:hcssshim::CreateComputeSystem

我创建了一个 Windows 映像,并将其推送到自定义注册表。图像构建没有任何错误。它也可以在任何使用该命令的机器上完美运行docker run

我在 Windows 主机上使用配置为使用 docker-windows 的 gitlab 运行程序。docker run在 shell 中使用该命令时,该映像在 Windows 主机上也运行得非常好。

但是,当 gitlab CI 触发管道时,我收到以下包含错误的日志:

Running with gitlab-runner 14.9.0 (d1f69508)
  on Test windows docker runner daSVobYW
Preparing the "docker-windows" executor 00:01
Using Docker executor with image someaddress:someport/windows_msvc2019_qt-desktop-6.2.3:v1.0.0 ...
Pulling docker image someaddress:someport/windows_msvc2019_qt-desktop-6.2.3:v1.0.0 ...
Using docker image sha256:XXX for someaddress:someport/windows_msvc2019_qt-desktop-6.2.3:v1.0.0 with digest someaddress:someport/windows_msvc2019_qt-desktop-6.2.3@sha256:XXX ...
Preparing environment
ERROR: Job failed (system failure): prepare environment: Error response from daemon: hcsshim::CreateComputeSystem 2f20866e4110118edc3274945d93d6138a16a67f9865d325e8b81c572ce08b96: Access denied. (exec.go:73:0s). …
Run Code Online (Sandbox Code Playgroud)

gitlab docker gitlab-ci gitlab-ci-runner docker-for-windows

5
推荐指数
1
解决办法
2106
查看次数