Fakultas Ilmu Komputer UI
Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
Sonar Scanner CLI Image for Flutter
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Ichlasul Affan
Sonar Scanner CLI Image for Flutter
Commits
8d0208dd
Commit
8d0208dd
authored
5 years ago
by
Daya Adianto
Browse files
Options
Downloads
Patches
Plain Diff
Fix shellcheck installation (#7)
parent
972aed06
No related branches found
No related tags found
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
.devcontainer/Dockerfile
+8
-4
8 additions, 4 deletions
.devcontainer/Dockerfile
.hadolint.yaml
+1
-0
1 addition, 0 deletions
.hadolint.yaml
Dockerfile
+9
-5
9 additions, 5 deletions
Dockerfile
README.md
+48
-2
48 additions, 2 deletions
README.md
with
66 additions
and
11 deletions
.devcontainer/Dockerfile
+
8
−
4
View file @
8d0208dd
...
...
@@ -20,7 +20,7 @@ RUN apt-get update \
&& apt-get -y install --no-install-recommends git procps lsb-release \
#
# Install project-specific tools
&& apt-get -y install --no-install-recommends ca-certificates wget \
&& apt-get -y install --no-install-recommends ca-certificates wget
xz-utils
\
#
# Create a non-root user to use if preferred - see https://aka.ms/vscode-remote/containers/non-root-user.
&& groupadd --gid $USER_GID $USERNAME \
...
...
@@ -36,14 +36,18 @@ RUN apt-get update \
&& rm -rf /var/lib/apt/lists/*
# Configure hadolint
ARG
HADOLINT_VERSION=v1.17.
1
ARG
HADOLINT_VERSION=v1.17.
2
RUN
wget
-O
/usr/local/bin/hadolint https://github.com/hadolint/hadolint/releases/download/
${
HADOLINT_VERSION
}
/hadolint-Linux-x86_64
\
&&
chmod
+x /usr/local/bin/hadolint
# Configure shellcheck
ARG
SHELLCHECK_VERSION=latest
RUN
wget
-O
/usr/local/bin/shellcheck https://shellcheck.storage.googleapis.com/shellcheck-
${
SHELLCHECK_VERSION
}
.linux.x86_64.tar.xz
\
&&
chmod
+x /usr/local/bin/shellcheck
RUN
wget
-O
/opt/shellcheck-
${
SHELLCHECK_VERSION
}
.tar.xz https://shellcheck.storage.googleapis.com/shellcheck-
${
SHELLCHECK_VERSION
}
.linux.x86_64.tar.xz
\
&&
cd
/opt
\
&&
tar
-xf
shellcheck-
${
SHELLCHECK_VERSION
}
.tar.xz
\
&&
rm
shellcheck-
${
SHELLCHECK_VERSION
}
.tar.xz
\
&&
chmod
+x /opt/shellcheck-
${
SHELLCHECK_VERSION
}
/shellcheck
\
&&
ln
-s
/opt/shellcheck-
${
SHELLCHECK_VERSION
}
/shellcheck /usr/local/bin/shellcheck
# Switch back to dialog for any ad-hoc use of apt-get
ENV
DEBIAN_FRONTEND=''
This diff is collapsed.
Click to expand it.
.hadolint.yaml
+
1
−
0
View file @
8d0208dd
---
ignored
:
-
DL3003
-
DL3008
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Dockerfile
+
9
−
5
View file @
8d0208dd
...
...
@@ -10,7 +10,7 @@ ARG USER_GID=$USER_UID
# Install packages
RUN
apt-get update
\
&&
apt-get
-y
install
--no-install-recommends
ca-certificates git nodejs unzip wget
\
&&
apt-get
-y
install
--no-install-recommends
ca-certificates git nodejs unzip wget
xz-utils
\
# Create a non-root user to use if preferred - see https://aka.ms/vscode-remote/containers/non-root-user.
&& groupadd --gid $USER_GID $USERNAME \
&& useradd -s /bin/bash --uid $USER_UID --gid $USER_GID -m $USERNAME \
...
...
@@ -29,8 +29,12 @@ RUN wget -O sonar-scanner-cli.zip https://binaries.sonarsource.com/Distribution/
# Configure shellcheck
ARG
SHELLCHECK_VERSION=latest
RUN
wget
-O
/usr/local/bin/shellcheck https://shellcheck.storage.googleapis.com/shellcheck-
${
SHELLCHECK_VERSION
}
.linux.x86_64.tar.xz
\
&&
chmod
+x /usr/local/bin/shellcheck
RUN
wget
-O
/opt/shellcheck-
${
SHELLCHECK_VERSION
}
.tar.xz https://shellcheck.storage.googleapis.com/shellcheck-
${
SHELLCHECK_VERSION
}
.linux.x86_64.tar.xz
\
&&
cd
/opt
\
&&
tar
-xf
shellcheck-
${
SHELLCHECK_VERSION
}
.tar.xz
\
&&
rm
shellcheck-
${
SHELLCHECK_VERSION
}
.tar.xz
\
&&
chmod
+x /opt/shellcheck-
${
SHELLCHECK_VERSION
}
/shellcheck
\
&&
ln
-s
/opt/shellcheck-
${
SHELLCHECK_VERSION
}
/shellcheck /usr/local/bin/shellcheck
# Switch back to dialog for any ad-hoc use of apt-get
ENV
DEBIAN_FRONTEND=''
...
...
@@ -38,9 +42,9 @@ ENV DEBIAN_FRONTEND=''
## Note to editors: Make sure name of USER and its WORKDIR path matches with
## the value of USERNAME above
USER
sonar
WORKDIR
/home/sonar
WORKDIR
/home/sonar
/workspace
CMD
["/bin/bash
"]
ENTRYPOINT
["sonar-scanner
"]
# Container image metadata
## Note to editors: metadata values for `created`, `version`, and `revision`
...
...
This diff is collapsed.
Click to expand it.
README.md
+
48
−
2
View file @
8d0208dd
...
...
@@ -2,11 +2,57 @@
> Sonar Scanner CLI bundled in a container image.
## Usage
First, you need to have a SonarScanner properties file (e.g.
[
`sonar-project.properties`
](
sonar-project.properties
)
)
in current working directory. Make sure to avoid putting sensitive information
or values that might change over time in the properties file such as SonarQube's
authentication token. Those kind of values and configuration can be passed
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]
```
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]
```
> 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
:
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.
stage
:
test
script
:
# Obtain the host and token from GitLab CI environment variables
-
sonar-scanner
-Dsonar.host.url=$SONARQUBE_HOST
-Dsonar.login=$SONARQUBE_TOKEN
only
:
# Perform SonarScanner analysis only on `master` branch
-
master
```
## Maintainers
-
[
Daya Adianto
](
https://gitlab.com/addianto
)
## License
Copyright (c) 2019 Faculty of Computer Science Universitas Indonesia. Licensed
under the
[
GNU Lesser General Public, Version 3.0
](
LICENSE
)
.
[
SonarScanner CLI
](
https://github.com/Sonarsource/sonar-scanner-cli
)
is a
product of
[
SonarSource
](
https://www.sonarsource.com
)
and licensed under the
[
GNU Lesser General Public License, Version 3.0
](
http://www.gnu.org/licenses/lgpl.txt
)
.
The Dockerfiles and associated scripts found in this project are licensed under
the
[
GNU Lesser General Public License, Version 3.0
](
LICENSE
)
.
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment