Commit 2260fdab authored by daidekun's avatar daidekun

fixbugs

parent faf1b432
// src/org/foo/Stage.groovy // src/org/foo/Stage.groovy
package org.qg; package org.qg;
def debug() { class StageBucket {
def debug() {
print "123" print "123"
} }
def checkout(branchName, contextDir, gitRepo) { def checkout(branchName, contextDir, gitRepo) {
sh "cp -r /home/quant_group/qg-dockerfiles/templates/ui ${contextDir}" sh "cp -r /home/quant_group/qg-dockerfiles/templates/ui ${contextDir}"
git branch: branchName, credentialsId: 'e1ccb1ac-1282-4fb4-b766-530ca1a2a2db', url: "git@gitabc.xyqb.com:${gitRepo}.git" git branch: branchName, credentialsId: 'e1ccb1ac-1282-4fb4-b766-530ca1a2a2db', url: "git@gitabc.xyqb.com:${gitRepo}.git"
sh "git pull origin master" sh "git pull origin master"
} }
def build(namespace, systemName, contextDir) { def build(namespace, systemName, contextDir) {
sh "ansible-playbook /etc/ansible/build.yml -e prefix=${namespace} -e project_name=pre.${systemName} -e workspace=${contextDir} -vv" sh "ansible-playbook /etc/ansible/build.yml -e prefix=${namespace} -e project_name=pre.${systemName} -e workspace=${contextDir} -vv"
} }
def docker_build_and_push(buildNumber, branchName, harborGroup, systemName, contextDir) { def docker_build_and_push(buildNumber, branchName, harborGroup, systemName, contextDir) {
/*分支名中非法字符统一替换为下划线*/ /*分支名中非法字符统一替换为下划线*/
regex = "[`,./;\\[\\]&<>?:\"()|-]+" regex = "[`,./;\\[\\]&<>?:\"()|-]+"
safeBranchName = branchName.replaceAll(regex,"_") safeBranchName = branchName.replaceAll(regex,"_")
...@@ -34,9 +35,9 @@ def docker_build_and_push(buildNumber, branchName, harborGroup, systemName, cont ...@@ -34,9 +35,9 @@ def docker_build_and_push(buildNumber, branchName, harborGroup, systemName, cont
echo "=========================================" echo "========================================="
return imageTag return imageTag
} }
def deploy(namespace, systemName, imageTag, tier, isDeploy) { def deploy(namespace, systemName, imageTag, tier, isDeploy) {
if (isDeploy) { if (isDeploy) {
echo ("将镜像更新到到Namespace:" + namespace) echo ("将镜像更新到到Namespace:" + namespace)
build job: 'deployer.Updater', parameters: [ build job: 'deployer.Updater', parameters: [
...@@ -48,12 +49,12 @@ def deploy(namespace, systemName, imageTag, tier, isDeploy) { ...@@ -48,12 +49,12 @@ def deploy(namespace, systemName, imageTag, tier, isDeploy) {
echo "namespace不存在,不执行deploy" echo "namespace不存在,不执行deploy"
echo namespace echo namespace
} }
} }
def clean(contextDir) { def clean(contextDir) {
sh "rm -rf ./${contextDir}" sh "rm -rf ./${contextDir}"
}
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment