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
Daya Adianto
Sonar Scanner CLI Image for Flutter
Commits
86420325
Commit
86420325
authored
5 years ago
by
Ichlasul Affan
Browse files
Options
Downloads
Patches
Plain Diff
Add Flutter dependencies on SonarScanner CLI Image
parent
46a77bb3
No related branches found
No related tags found
No related merge requests found
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
.gitlab-ci.yml
+20
-3
20 additions, 3 deletions
.gitlab-ci.yml
.gitlab/CODEOWNERS
+1
-0
1 addition, 0 deletions
.gitlab/CODEOWNERS
Dockerfile
+17
-7
17 additions, 7 deletions
Dockerfile
README.md
+36
-8
36 additions, 8 deletions
README.md
sonar-project.properties
+2
-3
2 additions, 3 deletions
sonar-project.properties
with
76 additions
and
21 deletions
.gitlab-ci.yml
+
20
−
3
View file @
86420325
...
...
@@ -15,15 +15,32 @@ stages:
-
test
-
deploy
SonarScanner Analysis Dev
:
image
:
ichlaffterlalu/sonar-scanner-flutter-cli:latest
stage
:
test
script
:
-
sonar-scanner
-Dsonar.host.url=$SONARQUBE_HOST
-Dsonar.login=$SONARQUBE_TOKEN
-Dsonar.projectKey=$SONARQUBE_PROJECT_KEY
-Dsonar.branch.name=$CI_COMMIT_REF_NAME
-Dsonar.branch.target=staging
except
:
-
master
-
staging
SonarScanner Analysis
:
image
:
addianto
/sonar-scanner-cli:latest
image
:
ichlaffterlalu
/sonar-scanner-
flutter-
cli:latest
stage
:
test
script
:
-
sonar-scanner
-Dsonar.host.url=$SONARQUBE_HOST
-Dsonar.login=$SONARQUBE_TOKEN
-Dsonar.projectKey=$SONARQUBE_PROJECT_KEY
-Dsonar.branch.name=$CI_COMMIT_REF_NAME
only
:
-
master
-
staging
Publish to Docker Hub
:
stage
:
deploy
...
...
@@ -32,8 +49,8 @@ Publish to Docker Hub:
-
docker build
--build-arg=IMAGE_CREATED="$(date --utc -Iseconds)"
--build-arg=IMAGE_REVISION="$(git show --pretty=oneline | tac | tail -n 1 | awk '{print $1}')"
--tag $IMAGE_NAMESPACE/sonar-scanner-cli:latest .
-
docker push $IMAGE_NAMESPACE/sonar-scanner-cli:latest
--tag $IMAGE_NAMESPACE/sonar-scanner-
flutter-
cli:latest .
-
docker push $IMAGE_NAMESPACE/sonar-scanner-
flutter-
cli:latest
when
:
manual
allow_failure
:
true
tags
:
...
...
This diff is collapsed.
Click to expand it.
.gitlab/CODEOWNERS
+
1
−
0
View file @
86420325
...
...
@@ -2,3 +2,4 @@
## Default owners
*
@addianto
*
@ichlasul.affan
This diff is collapsed.
Click to expand it.
Dockerfile
+
17
−
7
View file @
86420325
FROM
debian:10-slim
FROM
runmymind/docker-android-sdk:latest
# Avoid warnings by switching to noninteractive
ENV
DEBIAN_FRONTEND=noninteractive
...
...
@@ -36,13 +36,23 @@ RUN wget -qO /opt/shellcheck-${SHELLCHECK_VERSION}.tar.xz https://shellcheck.sto
&&
chmod
+x /opt/shellcheck-
${
SHELLCHECK_VERSION
}
/shellcheck
\
&&
ln
-s
/opt/shellcheck-
${
SHELLCHECK_VERSION
}
/shellcheck /usr/local/bin/shellcheck
# Install Flutter
ARG
FLUTTER_VERSION="https://storage.googleapis.com/flutter_infra/releases/stable/linux/flutter_linux_v1.12.13+hotfix.8-stable.tar.xz"
ENV
PATH="$PATH:/usr/lib/dart/bin:/flutter/bin"
RUN
wget
--quiet
--output-document
=
flutter.tar.xz
$FLUTTER_VERSION
&&
tar
xf flutter.tar.xz
-C
/
\
&&
apt-get
install
apt-transport-https
\
&&
sh
-c
'wget -qO- https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add -'
\
&&
sh
-c
'wget -qO- https://storage.googleapis.com/download.dartlang.org/linux/debian/dart_stable.list > /etc/apt/sources.list.d/dart_stable.list'
\
&&
apt-get update
\
&&
apt-get
install
-y
dart
# Switch back to dialog for any ad-hoc use of apt-get
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
/workspace
USER
$USERNAME
WORKDIR
/home/
$USERNAME
/workspace
CMD
["sonar-scanner"]
# Container image metadata
...
...
@@ -50,14 +60,14 @@ CMD ["sonar-scanner"]
## keys must be provided during build process, i.e. `docker build` invocation.
## It is also possible to pass other metadata values via build arguments.
ARG
IMAGE_CREATED=""
ARG
IMAGE_SOURCE="https://gitlab.cs.ui.ac.id/
pmpl/sonar-scanner-cli-image
"
ARG
IMAGE_SOURCE="https://gitlab.cs.ui.ac.id/
ichlasul.affan/
"
ARG
IMAGE_VERSION=${SONAR_SCANNER_CLI_VERSION}
ARG
IMAGE_REVISION=""
ARG
IMAGE_VENDOR="Faculty of Computer Science Universitas Indonesia"
ARG
IMAGE_TITLE="Sonar Scanner CLI Image"
ARG
IMAGE_DESCRIPTION="Sonar Scanner CLI bundled in a container image."
ARG
IMAGE_TITLE="Sonar Scanner CLI Image
for Flutter
"
ARG
IMAGE_DESCRIPTION="Sonar Scanner CLI
with Flutter dependencies
bundled in a container image."
LABEL
org.opencontainers.image.created=${IMAGE_CREATED} \
org.opencontainers.image.authors=
"Daya Adianto <dayaadianto@cs.ui.ac.id>"
\
org.opencontainers.image.authors=
${IMAGE_AUTHOR}
\
org.opencontainers.image.source=${IMAGE_SOURCE} \
org.opencontainers.image.version=${IMAGE_VERSION} \
org.opencontainers.image.revision=${IMAGE_REVISION} \
...
...
This diff is collapsed.
Click to expand it.
README.md
+
36
−
8
View file @
86420325
# Sonar Scanner CLI Image
# Sonar Scanner CLI Image
for Flutter
> Sonar Scanner CLI bundled in a container image.
> Sonar Scanner CLI
with Flutter dependencies
bundled in a container image.
## Usage
...
...
@@ -13,7 +13,7 @@ into SonarScanner via CLI prompt.
To run the container image locally using Docker:
```
bash
docker run
-it
-v
$(
pwd
)
:/home/sonar/workspace
addianto
/sonar-scanner-cli:latest bash
docker run
-it
-v
$(
pwd
)
:/home/sonar/workspace
ichlaffterlalu
/sonar-scanner-
flutter-
cli:latest bash
sonar-scanner
[
sonar-scanner options]
```
...
...
@@ -23,15 +23,38 @@ sonar-scanner [sonar-scanner options]
Example:
```
bash
docker run
-it
-v
$(
pwd
)
:/home/sonar/workspace
addianto
/sonar-scanner-cli:latest bash
docker run
-it
-v
$(
pwd
)
:/home/sonar/workspace
ichlaffterlalu
/sonar-scanner-
flutter-
cli:latest bash
sonar-scanner
-Dsonar
.host.url
=
https://pmpl.cs.ui.ac.id/sonarqube
-Dsonar
.login
=[
YOUR TOKEN]
```
To use the container image as a base image for a CI job on GitLab CI/CD:
To use the container image as a base image for a CI job on GitLab CI/CD (sample includes multi-branch
analysis support):
```
yaml
SonarScanner Analysis Dev
:
image
:
ichlaffterlalu/sonar-scanner-flutter-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
# Short-lived branches has a target (parent) branch, which in this case
# is `staging`.
-
sonar-scanner
-Dsonar.host.url=$SONARQUBE_HOST
-Dsonar.login=$SONARQUBE_TOKEN
-Dsonar.projectKey=$SONARQUBE_PROJECT_KEY
-Dsonar.branch.name=$CI_COMMIT_REF_NAME
-Dsonar.branch.target=staging
except
:
# Perform SonarScanner analysis for short-lived branches
# (exclude `master` and `staging`)
-
master
-
staging
SonarScanner Analysis
:
image
:
addianto
/sonar-scanner-cli:latest
image
:
ichlaffterlalu
/sonar-scanner-
flutter-
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.
...
...
@@ -41,14 +64,19 @@ SonarScanner Analysis:
-
sonar-scanner
-Dsonar.host.url=$SONARQUBE_HOST
-Dsonar.login=$SONARQUBE_TOKEN
-Dsonar.projectKey=$SONARQUBE_PROJECT_KEY
-Dsonar.branch.name=$CI_COMMIT_REF_NAME
only
:
# Perform SonarScanner analysis only on `master` branch
# Perform SonarScanner analysis for long-lived branches only on
# `master` and `staging` branch
-
master
-
staging
```
## Maintainers
-
[
Daya Adianto
](
https://gitlab.com/addianto
)
-
[
Daya Adianto
](
https://gitlab.com/addianto
)
: Original maintainer of SonarScanner CLI Image
-
[
Ichlasul Affan
](
https://gitlab.com/ichlasul.affan
)
## License
...
...
This diff is collapsed.
Click to expand it.
sonar-project.properties
+
2
−
3
View file @
86420325
...
...
@@ -4,13 +4,12 @@
### sonar.host.url=[pass URL via CLI]
## Project Configuration
sonar.projectKey
=
to.adian:sonar-scanner-cli-image
sonar.exclusions
=
/.devcontainer/,/.gitlab/
sonar.scm.provider
=
git
## Project Identity
sonar.projectName
=
SonarQube Scanner CLI Image
sonar.projectName
=
SonarQube Scanner CLI Image
for Flutter
sonar.projectVersion
=
latest
## Authentication
###
sonar.login
=
[pass token via CLI]
\ No newline at end of file
### sonar.login=[pass token via CLI]
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