I have installed SonarQube on a ubuntu machine via a docker image. All working fine and I’m able to log in without issues.
Have connected to our GitLab installation and see all available projects, when I try to configure the existing pipeline with the following, I got stuck.
I have the following pipeline.yml in use (partially shown here):
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
All looking good, but when it runs it gives me this error:
$ apt-get update
bash: apt-get: command not found
I just don’t know how to fix this and can’t find a solution on the internet somewhere
2
Answers
dotnet/core/sdk
image hasapt
(notapt-get
):Following SonarCube documentation, you can use their docker image with the
CLI
already installed:Apt /apt-get command not found – Problem fixed:
I think in your /usr/bin have no the apt and apt-get, you can download it and install it on that https://packages.debian.org/stretch/apt, like this