Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
spring-ci-advanced
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
3
Merge Requests
3
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Bùi Bá Trường
spring-ci-advanced
Commits
04362cb9
Commit
04362cb9
authored
Jul 30, 2019
by
Bùi Bá Trường
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
truongbb - test ci
parent
815face4
Pipeline
#370
failed with stages
in 1 minute and 9 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
4 deletions
+29
-4
.gitlab-ci.yml
.gitlab-ci.yml
+12
-0
build-test.sh
build-test.sh
+17
-4
No files found.
.gitlab-ci.yml
View file @
04362cb9
...
...
@@ -16,6 +16,7 @@ stages:
-
checkout
-
compile
-
sonnar_scanner
-
check_quality_gate
-
build_up
# for merge request
-
send_email
...
...
@@ -55,6 +56,17 @@ sonnar_scanner:
-
chmod +x ./build-test.sh
-
./build-test.sh sonar-scan
check_quality_gate
:
stage
:
check_quality_gate
only
:
-
master
# - merge_requests
script
:
-
cd /root/GitlabRunner/repo/spring-ci-advanced
-
ls
-
chmod +x ./build-test.sh
-
./build-test.sh quality-gate
build_up
:
stage
:
build_up
only
:
...
...
build-test.sh
View file @
04362cb9
...
...
@@ -11,6 +11,7 @@ sub_help(){
echo
" checkout Checkout code from git"
echo
" compile Compile java code"
echo
" sonar-scan Run sonar scanner"
echo
" quality-gate Check quality gate"
echo
" send-email Send email after stage/pipeline"
echo
""
echo
"For help with each sub-command run:"
...
...
@@ -42,6 +43,10 @@ sub_sonar-scan(){
mvn clean
--settings
settings.xml package sonar:sonar
\
-Dsonar
.projectName
=
'SpringCIAdvanced'
\
-Dsonar
.projectKey
=
'spring-ci-advanced'
}
sub_quality-gate
(){
# curl -s -w "\n%{http_code}" 'http://192.168.1.210:9000/api/qualitygates/project_status?projectKey=spring-ci' | {
# echo "1111111111111111111111"
# read body
...
...
@@ -49,6 +54,7 @@ sub_sonar-scan(){
# echo ${code}
# jq .name <<< "$body"
# }
# response=$(curl -s -w "\n%{http_code}" 'http://192.168.1.210:9000/api/qualitygates/project_status?projectKey=spring-ci')
# response=(${response[@]}) # convert to array
# code=${response[-1]} # get last element (last line)
...
...
@@ -56,10 +62,17 @@ sub_sonar-scan(){
# bodyRes=$(echo $body | jq '.bodyRes')
# echo $code
# echo "body: "$bodyRes
res
=
$(
curl
--request
POST
\
--url
http://192.168.1.210:9000/api/qualitygates/project_status?projectKey
=
spring-ci
\
--header
'cache-control: no-cache'
--header
'content-type: application/json'
| jq
'.res'
)
echo
"
${
res
}
"
# res=$( curl --request POST \
# --url http://192.168.1.210:9000/api/qualitygates/project_status?projectKey=spring-ci \
# --header 'cache-control: no-cache' --header 'content-type: application/json' | jq '.res')
# echo "${res}"
content
=
$(
curl
--request
POST
\
# --url http://192.168.1.210:9000/api/qualitygates/project_status?projectKey=spring-ci \
# --header 'cache-control: no-cache' --header 'content-type: application/json')
status
=
$(
echo
jq
-r
'.data.projectStatus.status'
<<<
"
${
content
}
"
)
echo
${
status
}
}
sub_send-email
(){
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment