From f478974fece8fc91494c7dc8d531ad7558a4cbe8 Mon Sep 17 00:00:00 2001 From: Daya Adianto <dayaadianto@cs.ui.ac.id> Date: Fri, 13 Sep 2019 17:02:26 +0700 Subject: [PATCH] Revert "Fix GitLab CI job that runs SonarScanner" This reverts commit da2657b1adc901dfc2905281fd299f15d1083b06. --- .gitlab-ci.yml | 7 ++----- Dockerfile | 3 +-- README.md | 17 ++++++++--------- 3 files changed, 11 insertions(+), 16 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 20469e6..6693dd9 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -5,10 +5,7 @@ stages: - deploy SonarScanner Analysis: - image: - name: addianto/sonar-scanner-cli:latest - entrypoint: - - "/bin/bash" + image: addianto/sonar-scanner-cli:latest stage: test script: - sonar-scanner @@ -30,4 +27,4 @@ Publish to Docker Hub: tags: - docker only: - - master + - master \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index 98c25ea..5c31d06 100644 --- a/Dockerfile +++ b/Dockerfile @@ -43,8 +43,7 @@ ENV DEBIAN_FRONTEND='' ## the value of USERNAME above USER sonar WORKDIR /home/sonar/workspace - -ENTRYPOINT ["sonar-scanner"] +CMD ["sonar-scanner"] # Container image metadata ## Note to editors: metadata values for `created`, `version`, and `revision` diff --git a/README.md b/README.md index 258a999..35b1c4b 100644 --- a/README.md +++ b/README.md @@ -13,26 +13,25 @@ into SonarScanner via CLI prompt. To run the container image locally using Docker: ```bash -docker run -v $(pwd):/home/sonar/workspace addianto/sonar-scanner-cli:latest [sonar-scanner options] +docker run -it -v $(pwd):/home/sonar/workspace addianto/sonar-scanner-cli:latest bash +sonar-scanner [sonar-scanner options] ``` +> Note: The above example creates a local interactive shell within the running +> container where you can invoke `sonar-scanner` with the desired CLI options. + Example: ```bash -docker run -v $(pwd):/home/sonar/workspace addianto/sonar-scanner-cli:latest -Dsonar.host.url=https://pmpl.cs.ui.ac.id/sonarqube -Dsonar.login=[REDACTED] +docker run -it -v $(pwd):/home/sonar/workspace addianto/sonar-scanner-cli:latest bash +sonar-scanner -Dsonar.host.url=https://pmpl.cs.ui.ac.id/sonarqube -Dsonar.login=[YOUR TOKEN] ``` -> Note: It is also possible to pass all possible SonarScanner's properties -> via CLI options. YMMV. - To use the container image as a base image for a CI job on GitLab CI/CD: ```yaml SonarScanner Analysis: - image: - name: addianto/sonar-scanner-cli:latest - entrypoint: - - "/bin/bash" + image: addianto/sonar-scanner-cli:latest # Ideally you want to run SonarScanner after the test suite has generated # test & coverage report. The following is only an example to run # SonarScanner concurrently with CI job(s) in `test` stage. -- GitLab