我已经通过码头映像将SonarQube安装在一台ubuntu机器上。一切正常,我可以在没有问题的情况下登录。
已经连接到我们的GitLab安装并查看了所有可用的项目,当我尝试用以下方式配置现有管道时,我被卡住了。
我正在使用以下pipeline.yml (部分显示在这里):
sonarqube-check:
stage: sonarqube-check
image: mcr.microsoft.com/dotnet/core/sdk:latest
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:
- "apt-get update"
- "apt-get install --yes openjdk-11-jre"
- "dotnet tool install --global dotnet-sonarscanner"
- "export PATH=\"$PATH:$HOME/.dotnet/tools\""
- "dotnet sonarscanner begin /k:\"my_project_location_AYDMUbUQodVNV6NM7qxd\" /d:sonar.login=\"$SONAR_TOKEN\" /d:\"sonar.host.url=$SONAR_HOST_URL\" "
- "dotnet build"
- "dotnet sonarscanner end /d:sonar.login=\"$SONAR_TOKEN\""
allow_failure: true
only:
- master一切看起来都很好,但是当它运行时,它给了我这个错误:
$ apt-get update
bash: apt-get: command not found我只是不知道怎么解决这个问题,在互联网上找不到解决办法
发布于 2022-05-24 11:40:13
dotnet/core/sdk图像具有apt (而不是apt-get):
$ docker run -ti --rm mcr.microsoft.com/dotnet/core/sdk:latest sh
# apt update在SonarCube文档之后,您可以在已经安装的CLI中使用它们的停靠映像:
image:
name: sonarsource/sonar-scanner-cli:latest
variables:
SONAR_TOKEN: "your-sonarqube-token"
SONAR_HOST_URL: "http://your-sonarqube-instance.org"
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
sonarqube-check:
stage: test
script:
- sonar-scanner -Dsonar.qualitygate.wait=true
allow_failure: true
only:
- master发布于 2022-05-26 02:51:31
Apt /apt-get命令未找到-问题修复:
我认为在您的/usr/bin中没有apt和apt-get,您可以下载它并在https://packages.debian.org/stretch/apt上安装它,如下所示
wget http://ftp.cn.debian.org/debian/pool/main/a/apt/apt_1.4.9_amd64.deb
dpkg -i apt_1.4.9_amd64.debhttps://stackoverflow.com/questions/72258282
复制相似问题