Authored by jimi.ji

docker images build

... ... @@ -23,7 +23,7 @@
<entry file="file://$PROJECT_DIR$/Docker-Node-Build/Jenkinsfile">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="216">
<caret line="55" column="22" lean-forward="false" selection-start-line="55" selection-start-column="22" selection-end-line="55" selection-end-column="22" />
<caret line="107" column="24" lean-forward="false" selection-start-line="107" selection-start-column="24" selection-end-line="107" selection-end-column="24" />
<folding />
</state>
</provider>
... ... @@ -51,6 +51,11 @@
</file>
</leaf>
</component>
<component name="FindInProjectRecents">
<findStrings>
<find>workdir</find>
</findStrings>
</component>
<component name="Git.Settings">
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
</component>
... ... @@ -528,12 +533,12 @@
<option name="number" value="Default" />
<option name="presentableId" value="Default" />
<updated>1545890692513</updated>
<workItem from="1545890694011" duration="1022000" />
<workItem from="1545890694011" duration="3156000" />
</task>
<servers />
</component>
<component name="TimeTrackingManager">
<option name="totallyTimeSpent" value="1022000" />
<option name="totallyTimeSpent" value="3156000" />
</component>
<component name="ToolWindowManager">
<frame x="-8" y="-8" width="1382" height="744" extended-state="6" />
... ... @@ -550,7 +555,7 @@
<window_info id="Run" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
<window_info id="Version Control" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="-1" side_tool="false" content_ui="tabs" />
<window_info id="Properties" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="-1" side_tool="false" content_ui="tabs" />
<window_info id="Terminal" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.3295082" sideWeight="0.5" order="-1" side_tool="false" content_ui="tabs" />
<window_info id="Terminal" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.3295082" sideWeight="0.5" order="-1" side_tool="false" content_ui="tabs" />
<window_info id="Capture Tool" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="-1" side_tool="false" content_ui="tabs" />
<window_info id="Designer" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="-1" side_tool="false" content_ui="tabs" />
<window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.24962178" sideWeight="0.5" order="0" side_tool="false" content_ui="combo" />
... ... @@ -592,8 +597,8 @@
<window_info id="Inspection" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="8" side_tool="false" content_ui="tabs" />
<window_info id="Run" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="5" side_tool="false" content_ui="tabs" />
<window_info id="Version Control" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
<window_info id="Terminal" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
<window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.24962178" sideWeight="0.5" order="6" side_tool="false" content_ui="combo" />
<window_info id="Terminal" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.3295082" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
<window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.24962178" sideWeight="0.5" order="6" side_tool="false" content_ui="combo" />
<window_info id="Find" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="4" side_tool="false" content_ui="tabs" />
<window_info id="Theme Preview" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="6" side_tool="false" content_ui="tabs" />
<window_info id="Favorites" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="5" side_tool="true" content_ui="tabs" />
... ... @@ -629,7 +634,7 @@
<entry file="file://$PROJECT_DIR$/Docker-Node-Build/Jenkinsfile">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="216">
<caret line="55" column="22" lean-forward="false" selection-start-line="55" selection-start-column="22" selection-end-line="55" selection-end-column="22" />
<caret line="107" column="24" lean-forward="false" selection-start-line="107" selection-start-column="24" selection-end-line="107" selection-end-column="24" />
<folding />
</state>
</provider>
... ...
... ... @@ -16,7 +16,9 @@ pipeline {
//常量参数,初始确定后一般不需更改
environment{
CRED_ID='2cb1761b-b258-4e3b-843f-8f0dab16d770'
QA_EMAIL='jimi.ji@yoho.cn'
QA_EMAIL='jimi.ji@yoho.cn'
AWS_IMAGE='860721417875.dkr.ecr.cn-north-1.amazonaws.com.cn'
QCLOUD_IMAGE='ccr.ccs.tencentyun.com'
}
options {
... ... @@ -25,7 +27,6 @@ pipeline {
}
stages {
stage('Define para && clean workdir'){
steps{
script {
... ... @@ -39,8 +40,7 @@ pipeline {
echo "print the para imageSource is : ${params.imageSource}......"
echo "print the para imageVersion is : ${params.imageVersion}......"
def localdir = "${workdir}/docker.sh"
def qcloudimage = "ccr.ccs.tencentyun.com/${params.imageSource}/${params.deployName}:${params.imageVersion}"
def awsimage = "860721417875.dkr.ecr.cn-north-1.amazonaws.com.cn/${params.imageSource}/${params.deployName}:${params.imageVersion}"
if(fileExists("$localdir")){
echo "starting delete the dir ${workdir}"
sh "rm -rf ${workdir}"
... ... @@ -52,8 +52,8 @@ pipeline {
stage('git clone project'){
steps{
script {
println workdir
//sh "git clone -b ${params.projectBranch} git@git.yoho.cn:${params.projectGitGroup}/${params.projectName}.git ${workdir}"
def workdir="${env.WORKSPACE}/$params.projectName"
sh "git clone -b ${params.projectBranch} git@git.yoho.cn:${params.projectGitGroup}/${params.projectName}.git ${workdir}"
}
}
}
... ... @@ -62,6 +62,7 @@ pipeline {
stage('build project'){
steps{
script {
def workdir="${env.WORKSPACE}/$params.projectName"
sh "cd ${workdir} && sh ${workdir}/docker.sh ${params.isNeedCdn} ${workdir}"
}
}
... ... @@ -71,13 +72,15 @@ pipeline {
stage('upload to CDN and nfs'){
steps{
script {
println "begin upload to cdn"
if(params.isNeedCdn=='YES'){
def workdir="${env.WORKSPACE}/$params.projectName"
def olddir = "/data/var-lib/jenkins/workspace/replace"
def repalceDir = "${workdir}/public/dist"
println repalceDir
sh "sed -i 's?${olddir}?${repalceDir}?g' ${env.WORKSPACE}/Docker-Node-Build/LocalUploadConfig"
// sh "/home/soft/qshell qupload 3 ${env.WORKSPACE}/Docker-Node-Build/LocalUploadConfig"
// sh "cp -r ${repalceDir} /nfs-ops/Data/app/node-ci/data"
//sh "/home/soft/qshell qupload 3 ${env.WORKSPACE}/Docker-Node-Build/LocalUploadConfig"
//sh "cp -r ${repalceDir} /nfs-ops/Data/app/node-ci/data"
}else {
println "params.isNeedCdn is not yes,no upload"
}
... ... @@ -89,6 +92,8 @@ pipeline {
steps {
script {
echo "begin bake image......"
def workdir="${env.WORKSPACE}/$params.projectName"
def qcloudimage = "${env.QCLOUD_IMAGE}/${params.imageSource}/${params.deployName}:${params.imageVersion}"
sh "docker build -t ${qcloudimage} ${workdir}"
sh "docker push ${qcloudimage}"
echo "end bake qcloud image......"
... ... @@ -100,6 +105,8 @@ pipeline {
steps {
script {
if(check_push_aws_images(params.projectName)){
def qcloudimage = "${env.QCLOUD_IMAGE}/${params.imageSource}/${params.deployName}:${params.imageVersion}"
def awsimage = "${env.AWS_IMAGE}/${params.imageSource}/${params.deployName}:${params.imageVersion}"
sh "docker tag ${qcloudimage} ${awsimage} "
sh "docker push ${awsimage}"
echo "upload images to aws : ${params.projectName}"
... ... @@ -126,4 +133,3 @@ def check_push_aws_images(project_name){
lst.add("yohobuy-node");
return lst.contains(project_name);
}
... ...