我正在学习 CI/CD,目标是优化开发。
在工作中我们使用 Windows 11 机器,并且我们有自己的 Gitlab 服务器(我们不使用公共 Gitlab)。
下载 Gitlab 运行程序后,我按照 Gitlab 存储库 -> 设置 -> CI/CD -> 运行程序下提供的简单说明启动运行程序
我的跑步者配置:
[[runners]]
name = "Runner for ESP32 test application"
url = "https://xxx.xxx.xxxxxxxx.lt/"
id = 5
token = "xxxxxxxxxxxxxxxxxxx"
token_obtained_at = 2023-12-11T09:30:58Z
token_expires_at = 0001-01-01T00:00:00Z
executor = "shell"
shell = "pwsh"
[runners.cache]
MaxUploadedArchiveSize = 0
创建跑步者后,我创建了一个 .gitlab-ci.yml 文件:
stages: # List of stages for jobs, and their order of execution
- release
release_job:
stage: release
image: registry.gitlab.com/gitlab-org/release-cli:latest
rules:
- if: $CI_COMMIT_TAG # Run this job when a tag is created
script:
- echo "running release_job"
release: # See https://docs.gitlab.com/ee/ci/yaml/#release for available properties
tag_name: '$CI_COMMIT_TAG'
description: '$CI_COMMIT_TAG'
每当我创建标签并向其推送提交时,上面的文件应该创建一个版本。我尝试执行该作业并收到以下错误:
Running with gitlab-runner 16.6.1 (f5da3c5a)
on Runner for ESP32 test application Pxa89piW, system ID: s_91faad35eb22
Preparing the "shell" executor
00:00
Using Shell (pwsh) executor...
Preparing environment
00:01
Running on EMS-PETRIKASLU...
Getting source from Git repository
00:04
Fetching changes with git depth set to 20...
Initialized empty Git repository in C:/Users/petrikas.lu/Desktop/WORK/Gitlab-runner/builds/Pxa89piW/0/ci_cd/esp32_application/.git/
Created fresh repository.
Checking out c921d049 as detached HEAD (ref is v1.1.0)...
git-lfs/3.4.0 (GitHub; windows amd64; go 1.20.6; git d06d6e9e)
Skipping Git submodules setup
Executing "step_script" stage of the job script
00:01
$ echo "running release_job"
running release_job
Executing "step_release" stage of the job script
00:02
$ release-cli create --description "v1.1.0" --tag-name "v1.1.0"
release-cli:
Line |
279 | release-cli create --description "v1.1.0" --tag-name "v1.1.0"
| ~~~~~~~~~~~
| The term 'release-cli' is not recognized as a name of a cmdlet, function, script file, or executable program.
Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
Cleaning up project directory and file based variables
00:00
ERROR: Job failed: exit status 1
我无法完全理解为什么它会抱怨release-cli。我已经安装了release-cli工具并将其添加到我的环境变量路径中。我可以执行命令:
release-cli -v
在 cmd、powershell 和 pwsh 中,它都能正常工作。返回的版本:
release-cli version 0.16.0
我已经在 Gitlab 社区上发布了这个问题,但被忽略了。
我真的非常感谢有人知道可能出现什么问题以及我该如何解决这个问题。预先感谢。
使用 Shell (pwsh) 执行器...
您正在使用 shell 执行器,而且在 Windows 上。该管道是为 docker 容器
registry.gitlab.com/gitlab-org/release-cli:latest
编写的。使用 docker 执行器。