Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
sample-jee9-1
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
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
Emmanuel Bruno
sample-jee9-1
Commits
5258de6c
Commit
5258de6c
authored
3 years ago
by
Emmanuel Bruno
Browse files
Options
Downloads
Patches
Plain Diff
initial sonar.
parent
f5b5b58a
No related branches found
No related tags found
No related merge requests found
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
.github/workflows/docker-image.yml
+7
-11
7 additions, 11 deletions
.github/workflows/docker-image.yml
docker-compose.yml
+5
-0
5 additions, 0 deletions
docker-compose.yml
docker/Dockerfile
+17
-3
17 additions, 3 deletions
docker/Dockerfile
docker/settings-docker.xml
+1
-1
1 addition, 1 deletion
docker/settings-docker.xml
with
30 additions
and
15 deletions
.github/workflows/docker-image.yml
+
7
−
11
View file @
5258de6c
...
@@ -18,14 +18,10 @@ jobs:
...
@@ -18,14 +18,10 @@ jobs:
steps
:
steps
:
-
uses
:
actions/checkout@v2
-
uses
:
actions/checkout@v2
-
name
:
Build the Docker image for branch ${GITHUB_REF##*/}
-
name
:
Build the Docker image for branch ${GITHUB_REF##*/}
run
:
DOCKER_BUILDKIT=1 docker build . --file ./docker/Dockerfile --tag brunoe/samplejee91::${GITHUB_REF##*/}
run
:
DOCKER_BUILDKIT=1 docker build . \
--env GITHUBLOGIN="$GITHUBLOGIN" \
--env GITHUBPASSWORD="$GITHUBPASSWORD" \
maven-sonar
:
--env SONAR_HOST="$SONAR_HOST" \
runs-on
:
[
self-hosted
,
Linux
]
--env SONAR_TOKEN="$SONAR_TOKEN" \
needs
:
maven-build
--file ./docker/Dockerfile \
# Develop branch only
--tag brunoe/samplejee91:${GITHUB_REF##*/}
# if: github.ref == 'refs/heads/develop'
steps
:
-
name
:
Launch a sonar analysis
run
:
./mvn.sh -D sonar.branch.name=${GITHUB_REF#refs/heads/} --activate-profiles sonar sonar:sonar && mvn --activate-profiles sonar -pl . sonar-quality-gate:check
This diff is collapsed.
Click to expand it.
docker-compose.yml
+
5
−
0
View file @
5258de6c
...
@@ -2,6 +2,11 @@ version: '3'
...
@@ -2,6 +2,11 @@ version: '3'
services
:
services
:
jakartaEE
:
jakartaEE
:
build
:
build
:
args
:
-
GITHUBLOGIN
-
GITHUBPASSWORD
-
SONAR_HOST
-
SONAR_TOKEN
context
:
.
context
:
.
dockerfile
:
docker/Dockerfile
dockerfile
:
docker/Dockerfile
image
:
brunoe/samplejee91
image
:
brunoe/samplejee91
...
...
This diff is collapsed.
Click to expand it.
docker/Dockerfile
+
17
−
3
View file @
5258de6c
# syntax=docker/dockerfile:1.3
### First we build the application in docker in a controlled env
### First we build the application in docker in a controlled env
FROM
maven:3.8.4-eclipse-temurin-11
as
build
FROM
maven:3.8.4-eclipse-temurin-11
as
build
WORKDIR
/app
WORKDIR
/app
#see https://www.jrebel.com/blog/how-to-speed-up-your-maven-build
# see https://www.baeldung.com/jvm-tiered-compilation
ENV
MAVEN_OPTS="-XX:+TieredCompilation -XX:TieredStopAtLevel=1"
#ENV MAVEN_CLI_OPTS="-T 1C --settings /usr/share/maven/ref/settings-docker.xml -B"
ENV
MAVEN_CLI_OPTS="--settings /usr/share/maven/ref/settings-docker.xml -B"
COPY
docker/settings-docker.xml /usr/share/maven/ref/
# COPY pom.xml /app/pom.xml
# COPY pom.xml /app/pom.xml
COPY
. /app/
COPY
. /app/
RUN
--mount
=
type
=
cache,id
=
mvncache,target
=
/root/.m2/repository,rw
\
RUN
--mount
=
type
=
cache,id
=
mvncache,target
=
/root/.m2/repository,rw
\
mvn
-B
verify
mvn
$MAVEN_CLI_OPTS
-Dmaven
.test.skip
=
true
verify
RUN
--mount
=
type
=
cache,id
=
mvncache,target
=
/root/.m2/repository,rw
\
if
[
"
$SONAR_TOKEN
"
]
;
then
\
mvn
$MAVEN_CLI_OPTS
-D
sonar.branch.name
=
${
GITHUB_REF
#refs/heads/
}
\
--activate-profiles
sonar sonar:sonar
&&
\
mvn
$MAVEN_CLI_OPTS
--activate-profiles
sonar
-pl
.
sonar-quality-gate:check
;
\
fi
### Then we add the builded war to a JEE server.
### Then we add the builded war to a JEE server.
#FROM payara/server-full:5.2021.9-jdk11 as server
#FROM payara/server-full:5.2021.9-jdk11 as server
...
...
This diff is collapsed.
Click to expand it.
.github/ci-
settings.xml
→
docker/
settings
-docker
.xml
+
1
−
1
View file @
5258de6c
...
@@ -28,7 +28,7 @@
...
@@ -28,7 +28,7 @@
<profile>
<profile>
<id>
sonar
</id>
<id>
sonar
</id>
<properties>
<properties>
<sonar.host.url>
http://compute-lsis-2:9000
</sonar.host.url>
<sonar.host.url>
${env.SONAR_HOST}
</sonar.host.url>
<sonar.login>
${env.SONAR_TOKEN}
</sonar.login>
<sonar.login>
${env.SONAR_TOKEN}
</sonar.login>
</properties>
</properties>
</profile>
</profile>
...
...
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