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
2af98940
Commit
2af98940
authored
May 16, 2018
by
kalvin
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of git.quantgroup.cn:QA/global-jenkinsfile
parents
715cf42d
7fb612d2
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
25 additions
and
19 deletions
+25
-19
StageBucket.groovy
src/org/qg/ci/StageBucket.groovy
+7
-5
StageBucket.groovy
src/org/qg/docker_new/StageBucket.groovy
+2
-2
qgCiPipeline.groovy
vars/qgCiPipeline.groovy
+1
-0
qgCiSonar.groovy
vars/qgCiSonar.groovy
+14
-11
qgDockerPiplineWithDockerSlave.groovy
vars/qgDockerPiplineWithDockerSlave.groovy
+1
-1
No files found.
src/org/qg/ci/StageBucket.groovy
View file @
2af98940
...
...
@@ -14,10 +14,12 @@ def sonaar_check(GIT_REPO_NAME,GIT_BRANCH,currentPath){
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}"
/* git branch: "${GIT_BRANCH}", credentialsId: 'e1ccb1ac-1282-4fb4-b766-530ca1a2a2db', url: "${GIT_PEPO_SSH_URL}"*/
git
commit:
"${GIT_BRANCH}"
,
credentialsId:
'e1ccb1ac-1282-4fb4-b766-530ca1a2a2db'
,
url:
"${GIT_REPO_SSH_URL}"
sh
"${sonarScanner} -e \
-Dsonar.host.url=http://
172.30.3.42:9000
\
-Dsonar.host.url=http://
sonar.q-gp.com
\
-Dsonar.projectVersion=${GIT_BRANCH} \
-Dsonar.projectKey=${GIT_REPO_NAME} \
-Dsonar.java.binaries=. \
...
...
@@ -27,7 +29,7 @@ def sonaar_check(GIT_REPO_NAME,GIT_BRANCH,currentPath){
}
def
callback_pipes
(
taskId
)
{
def
callback_pipes
(
callbackHost
,
taskId
)
{
sleep
3
sonarInfo
=
sh
(
script:
'cat .sonar/report-task.txt |awk \'{printf $0 "&"}\''
,
returnStdout:
true
).
trim
()
...
...
@@ -47,13 +49,13 @@ def callback_pipes(taskId) {
def
bodyJson
=
JsonOutput
.
toJson
(
body
)
echo
bodyJson
dest_url
=
"http://192.168.28.141:8080/callback/ci/triger"
response
=
httpRequest
httpMode:
"POST"
,
consoleLogResponseBody:
true
,
contentType:
"APPLICATION_JSON"
,
requestBody:
"${bodyJson}"
,
url:
dest_url
url:
callbackHost
/* def res_json = jsonParse(response.content)
return res_json*/
...
...
src/org/qg/docker_new/StageBucket.groovy
View file @
2af98940
...
...
@@ -82,7 +82,7 @@ def prepare_java(systemName, contextDir) {
def
prepare_nodejs
(
systemName
,
contextDir
)
{
sh
"cp -rf /home/quant_group/qg-dockerfiles/templates/nodejs/* ${contextDir}"
sh
"cp -rf /home/quant_group/config_repository/
lua-ui/config
/${systemName}.js ${systemName}.env.config"
sh
"cp -rf /home/quant_group/config_repository/
nodejs
/${systemName}.js ${systemName}.env.config"
sh
"cp -rf /home/quant_group/config_repository/lua-ui/npmrc/common-npmrc /root/.npmrc"
...
...
@@ -305,7 +305,7 @@ def build_nodejs( systemName, contextDir) {
buildCmd
=
projectAttr
[
"buildCmd"
]
configName
=
systemName
sh
"mv -f env.config ${configPath}"
sh
"mv -f
./${systemName}.
env.config ${configPath}"
sh
"tar zcf ${contextDir}/dist.tgz ./* "
}
...
...
vars/qgCiPipeline.groovy
View file @
2af98940
...
...
@@ -2,6 +2,7 @@
def
call
(
body
)
{
def
timeStemp
=
new
Date
().
format
(
"yyyyMMddHHmmss"
)
def
env
=
body
.
env
...
...
vars/qgCiSonar.groovy
View file @
2af98940
...
...
@@ -2,41 +2,44 @@ def call(body) {
def
_stage
=
new
org
.
qg
.
ci
.
StageBucket
()
def
_utils
=
new
org
.
qg
.
docker_new
.
Utils
()
def
env
=
body
.
env
def
GIT_
PEPO_SSH_URL
=
env
.
GIT_P
EPO_SSH_URL
def
GIT_
REPO_SSH_URL
=
env
.
GIT_R
EPO_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
TASK_INDEX
=
env
.
TASK_ID
def
GIT_TRIGGER_USER
=
env
.
GIT_TRIGGER_USER
def
TASK_INDEX
=
env
.
TASK_INDEX
def
callbackHost
def
config
=
[:]
def
currentPath
/*
body.resolveStrategy = Closure.DELEGATE_FIRST
body
.
resolveStrategy
=
Closure
.
DELEGATE_FIRST
body
.
delegate
=
config
body()*/
body
()
callbackHost
=
config
.
callbackHost
ansiColor
(
'xterm'
)
{
echo
"\033[32m############################################\n\
# GIT_
PEPO_SSH_URL:${GIT_P
EPO_SSH_URL}\n\
# GIT_
REPO_SSH_URL:${GIT_R
EPO_SSH_URL}\n\
# GIT_REPO_NAME:${GIT_REPO_NAME}\n\
# GIT_BRANCH:${GIT_BRANCH}\n\
# GIT_BRANCH_HASH:${GIT_BRANCH_HASH}\n\
# GIT_TRIG
ER_USER:${GIT_TRI
GER_USER}\n\
# GIT_TRIG
GER_USER:${GIT_TRIG
GER_USER}\n\
############################################\033[0m"
}
node
{
dir
(
GIT_REPO_NAME
){
urrentPath
=
sh
(
script:
'pwd'
,
returnStdout:
true
).
trim
()
c
urrentPath
=
sh
(
script:
'pwd'
,
returnStdout:
true
).
trim
()
stage
(
"SonarQube Quality Gate"
){
/* _stage.sonaar_check(GIT_REPO_NAME,GIT_BRANCH,currentPath)*/
_stage
.
sonaar_check
(
GIT_REPO_NAME
,
GIT_BRANCH_HASH
,
currentPath
)
}
stage
(
"callback"
){
_stage
.
callback_pipes
(
TASK_INDEX
)
_stage
.
callback_pipes
(
callbackHost
,
TASK_INDEX
)
}
}
...
...
vars/qgDockerPiplineWithDockerSlave.groovy
View file @
2af98940
...
...
@@ -80,7 +80,7 @@ def call(body) {
def
regex
=
"[`,./;\\[\\]&<>?:\"()|-]+"
def
k8sSystemName
=
originSystemName
.
replaceAll
(
"_"
,
"-"
)
def
safeBranchName
=
originBranchName
.
replaceAll
(
regex
,
"_"
)
imageTagInfos
=
_stage
.
imageTag
(
harborGroup
,
k8sSystemName
,
safeBranchName
,
branchHashCode
)
imageTagInfos
=
_stage
.
imageTag
(
harborGroup
,
k8sSystemName
,
safeBranchName
,
timeStemp
)
for
(
imageTagInfo
in
imageTagInfos
){
_stage
.
dockerbuild_and_push
(
imageTagInfo
,
buildNumber
,
_systemName
,
originBranchName
,
cluster
,
timeStemp
,
contextDir
,
branchHashCode
)
...
...
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