[英]Which Gitlab runner do I need to use?
I am making my yml file, but I keep struggeling with an error that I get.我正在制作我的 yml 文件,但我一直在为遇到的错误而苦苦挣扎。 The error is:错误是:
apt-get: The term 'apt-get' is not recognized as the name of a cmdlet, function, script file, or operable program. apt-get:术语“apt-get”未被识别为 cmdlet、function、脚本文件或可运行程序的名称。 Check the spelling of the name, or if a path was included, verify that the path is correct and try again.检查名称的拼写,或者如果包含路径,请验证路径是否正确并重试。 At C:\Windows\TEMP\build_script267802092\script.ps1:217 char:1在 C:\Windows\TEMP\build_script267802092\script.ps1:217 char:1
I think the problem is that I do not have the correct runner to run this.我认为问题在于我没有正确的跑步者来运行它。 The problem is that I do not know which runner is the correct runner for me.问题是我不知道哪个跑步者对我来说是正确的跑步者。
I have tried using the shell runner, but that one gives me the error above.我试过使用 shell 跑步者,但那个给了我上面的错误。
My yml file:我的 yml 文件:
image: node:latest
stages:
# - build
# - sonarqube-check
# - test
- deploy
cache:
paths:
- .gradle/wrapper
- .gradle/caches
build:
stage: build
script:
- ./gradlew assemble
artifacts:
paths:
- build/libs/*.jar
expire_in: 1 week
only:
- master
sonarqube-check:
stage: test
image: gradle:jre11-slim
variables:
SONAR_USER_HOME: "${CI_PROJECT_DIR}/.sonar" # Defines the location of the analysis task cache
GIT_DEPTH: "0" # Tells git to fetch all the branches of the project, required by the analysis task
cache:
key: "${CI_JOB_NAME}"
paths:
- .sonar/cache
script: ./gradlew sonarqube
allow_failure: true
only:
- master
test:
stage: test
script:
- ./gradlew check
deploy:
stage: deploy
image: ruby:latest
script:
- apt-get update -qy
- apt-get install -y ruby-dev
- gem install dpl
- dpl --provider=heroku --app=heroku-coalition --api-key=$HEROKU_API_KEY
- echo "This job deploys something from the $CI_COMMIT_BRANCH branch."
only:
- master
after_script:
- echo "End CI"
I am using a windows machine with windows 10 (if that information is needed) Can anyone help me?我正在使用 windows 10 的 windows 机器(如果需要该信息)有人可以帮助我吗? Thanks in advance!提前致谢!
Since you are defining which image
to use in your yml, you should be using a docker executor.由于您正在定义要在 yml 中使用的image
,因此您应该使用 docker 执行器。
Assuming you've already installed GitLab Runner following the docs , you can then add a runner with "docker" as the executor.假设您已经按照文档安装了 GitLab Runner,那么您可以添加一个带有“docker”的运行器作为执行器。 Here's a link to the docs这是文档的链接
Docker should already be installed on your server as well. Docker 也应该已经安装在您的服务器上。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.