Commit 02cf102a authored by tywldx's avatar tywldx

add guildTime

parent 0fa3af76
......@@ -210,7 +210,7 @@ def build_luaui(namespace, systemNames, contextDir) {
}
}
def dockerbuild_and_push(buildNumber, branchName, harborGroup, systemName, contextDir) {
def dockerbuild_and_push(timeNow, buildNumber, branchName, harborGroup, systemName, contextDir) {
regex = "[`,./;\\[\\]&<>?:\"()|-]+"
safeBranchName = branchName.replaceAll(regex,"_")
safeSystemName = "project"
......@@ -219,7 +219,7 @@ def dockerbuild_and_push(buildNumber, branchName, harborGroup, systemName, conte
withDockerServer([uri: "tcp://192.168.4.96:2375/"]) {
withDockerRegistry([credentialsId: 'harbor-qajenkins', url: "http://192.168.4.36"]) {
def image = docker.build(imageTag, "--build-arg BUILD_NUMBER=${buildNumber} --build-arg SYSTEM_NAME=${systemName} --build-arg BRANCH_NAME=${branchName} --build-arg SAFE_SYSTEM_NAME=${safeSystemName} ${contextDir}")
def image = docker.build(imageTag, "--build-arg BUILD_TIME=${timeNow} --build-arg BUILD_NUMBER=${buildNumber} --build-arg SYSTEM_NAME=${systemName} --build-arg BRANCH_NAME=${branchName} --build-arg SAFE_SYSTEM_NAME=${safeSystemName} ${contextDir}")
image.push()
if (branchName == "master" || branchName == "master--master") {
......
import org.qg.docker.*
import java.time.*
def getTime(){
LocalDateTime t = LocalDateTime.now();
return t as String
}
def call(body) {
......@@ -20,6 +26,7 @@ def call(body) {
def workspace = "/home/quant_group/jenkins_home/workspace/${env.JOB_NAME}"
def imageTag
def timeNow = getTime()
def contextDir
def _stage = new org.qg.docker.StageBucket()
def _utils = new org.qg.docker.Utils()
......@@ -102,7 +109,8 @@ def call(body) {
if (config.buildType == "java") {
_stage.copy_files_java(systemName, contextDir)
}
imageTag = _stage.dockerbuild_and_push(buildNumber, branchName, harborGroup, systemName, contextDir)
imageTag = _stage.dockerbuild_and_push(timeNow, buildNumber, branchName, harborGroup, systemName, contextDir)
}
stage('Deploy To K8s Cluster') {
......
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