我正在尝试在 gitlab-runner 中创建一个自动管道,它将应用最新git push. 它正在获取推送中的最新提交(使用 gitlab-runner 中的 $CI_COMMIT_SHA 变量)。但是,如果一次推送有多个提交,它会忽略较旧的提交。因此,所有更改都不会应用到应用程序中。
我有以下疑问:
git cherry可以给我未推送的提交列表。有没有办法,我可以通过变量将信息传递给 gitlab-runner ?提前致谢
我正在使用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 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) 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) 我有一份 GitLab CI/CD 工作,做一些事情。
我希望某些执行的命令能够失败并导致此作业发出警告,但我也希望其他命令在失败时导致管道中出现错误。
我已经在 .yaml 文件中进行了设置allow_failure: true,无论出现什么错误,这都会导致此作业出现警告。
我可以告诉 GitLab 作业输出特定退出代码的错误和另一个退出代码的警告吗?
我们有一个 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-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 服务并通过 …
我试图将变量传递给并行/矩阵,但没有看到变量被扩展并且作业失败。这是通过环境变量在作业中设置的。我试图回显脚本中的变量并查看它显示正确的值,但不会在并行/矩阵中被替换。我错过了什么吗?
.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}]
我在 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) 我创建了一个 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-ci-runner ×10
gitlab ×8
gitlab-ci ×7
docker ×2
git ×2
anaconda ×1
aws-fargate ×1
conda ×1
git-cherry ×1
git-push ×1
gitlab-api ×1
python ×1
runner ×1
yaml ×1