Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
global-jenkinsfile
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
QA
global-jenkinsfile
Commits
87bfa29e
Commit
87bfa29e
authored
Apr 28, 2018
by
wentao.suo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add sonar check pipeline
parent
c2fb22f8
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
100 additions
and
0 deletions
+100
-0
StageBucket.groovy
src/org/qg/ci/StageBucket.groovy
+48
-0
qgCiSonar.groovy
vars/qgCiSonar.groovy
+52
-0
No files found.
src/org/qg/ci/StageBucket.groovy
0 → 100644
View file @
87bfa29e
// src/org/foo/Stage.groovy
package
org.qg.docker_new
;
import
org.qg.docker_new.Utils
;
import
groovy.json.JsonSlurperClassic
;
def
_utils
()
{
return
new
org
.
qg
.
docker_new
.
Utils
();
}
def
sonaar_check
(){
_utils
().
beautyEcho
(
"sonar check +++"
,
"info"
)
/*
sonarScanner = "/home/quant_group/jenkins_home/tools/hudson.plugins.sonar.SonarRunnerInstallation/sonar/bin/sonar-scanner"
currentPath = sh (script: 'pwd',returnStdout: true).trim()
git branch: "${GIT_BRANCH}", credentialsId: 'e1ccb1ac-1282-4fb4-b766-530ca1a2a2db', url: "${GIT_PEPO_SSH_URL}"
sh "${sonarScanner} -e \
-Dsonar.host.url=http://172.30.3.42:9000 \
-Dsonar.projectVersion=${GIT_BRANCH} \
-Dsonar.projectKey=${GIT_BRANCH} \
-Dsonar.java.binaries=. \
-Dsonar.sources=. \
-Dsonar.projectBaseDir=${currentPath}"
*/
}
def
callback_pipes
(
info
)
{
sleep
3
sonarInfo
=
sh
(
script:
'cat .sonar/report-task.txt |awk \`{printf $0 "&"}\''
,
returnStdout:
true
).
trim
()
items
=
sonarInfo
.
split
(
"&"
)
for
(
def
item
:
items
){
echo
item
}
/*callbackData = "${sonarReportTask}pipelineEntityId=aaa&taskNum=1"
echo "==========================="
echo callbackData
echo "==========================="
// def props = new Properties()
// props.load(sonarReportTask)
sh "curl --data ${callbackData} http://mock.q-gp.com"*/
}
vars/qgCiSonar.groovy
0 → 100644
View file @
87bfa29e
def
call
(
body
)
{
def
_stage
=
new
org
.
qg
.
ci
.
StageBucket
()
def
_utils
=
new
org
.
qg
.
docker_new
.
Utils
()
def
GIT_PEPO_SSH_URL
=
env
.
GIT_PEPO_SSH_URL
def
GIT_REPO_NAME
=
env
.
GIT_REPO_NAME
def
GIT_BRANCH
=
env
.
GIT_BRANCH
def
GIT_BRANCH_HASH
=
env
.
GIT_BRANCH_HASH
def
GIT_TRIGER_USER
=
env
.
GIT_TRIGER_USER
def
PIPELINE_ID
=
env
.
PIPELINE_ID
def
STAGE_INDEX
=
env
.
STAGE_INDEX
def
TASK_INDEX
=
env
.
TASK_INDEX
def
info
=
[
pipline_id
:
PIPELINE_ID
,
stage_index:
STAGE_INDEX
,
task_index:
TASK_INDEX
,
context:
[]
]
ansiColor
(
'xterm'
)
{
echo
"\033[32m############################################\n\
# GIT_PEPO_SSH_URL:${GIT_PEPO_SSH_URL}\n\
# GIT_REPO_NAME:${GIT_REPO_NAME}\n\
# GIT_BRANCH:${GIT_BRANCH}\n\
# GIT_BRANCH_HASH:${GIT_BRANCH_HASH}\n\
# GIT_TRIGER_USER:${GIT_TRIGER_USER}\n\
############################################\033[0m"
}
dir
(
gitRepoName
){
node
{
stage
(
"SonarQube Quality Gate"
){
def
gitRepoName
=
"${GIT_REPO_NAME}"
}
stage
(
"callback"
){
_stage
.
callback_pipes
(
info
)
}
}
}
}
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