From 1190a615cbe9d624f41d2cd815c5ae1ff0a11ff2 Mon Sep 17 00:00:00 2001 From: "gao.zhiyuan" Date: Tue, 26 Jul 2022 09:47:07 +0800 Subject: [PATCH] jenkinsfile --- api/jenkinsfile => jenkinsfile_api | 2 +- web/jenkinsfile => jenkinsfile_web | 2 +- scripts/0.0.1/data/3_init_report_pic_data/index.js | 8 +++++--- scripts/0.0.1/data/3_init_report_pic_data/package.json | 1 + 4 files changed, 8 insertions(+), 5 deletions(-) rename api/jenkinsfile => jenkinsfile_api (91%) rename web/jenkinsfile => jenkinsfile_web (91%) diff --git a/api/jenkinsfile b/jenkinsfile_api similarity index 91% rename from api/jenkinsfile rename to jenkinsfile_api index 81e07f74..4edce053 100644 --- a/api/jenkinsfile +++ b/jenkinsfile_api @@ -11,7 +11,7 @@ pipeline { sh 'switch-auth.sh anxinyun' buildName "#${BUILD_NUMBER} ~/fs-cloud/${JOB_NAME}:${IMAGE_VERSION}" buildDescription "registry.cn-hangzhou.aliyuncs.com/${CLOUD}/${JOB_NAME}:${IMAGE_VERSION}" - sh 'docker build -t registry.cn-hangzhou.aliyuncs.com/${CLOUD}/${JOB_NAME}:${IMAGE_VERSION} ./' + sh 'docker build -t registry.cn-hangzhou.aliyuncs.com/${CLOUD}/${JOB_NAME}:${IMAGE_VERSION} ./api' sh 'docker push registry.cn-hangzhou.aliyuncs.com/${CLOUD}/${JOB_NAME}:${IMAGE_VERSION}' } } diff --git a/web/jenkinsfile b/jenkinsfile_web similarity index 91% rename from web/jenkinsfile rename to jenkinsfile_web index c6ec16b5..5e46eca4 100644 --- a/web/jenkinsfile +++ b/jenkinsfile_web @@ -11,7 +11,7 @@ pipeline { sh 'switch-auth.sh anxinyun' buildName "#${BUILD_NUMBER} ~/fs-cloud/${JOB_NAME}:${IMAGE_VERSION}" buildDescription "registry.cn-hangzhou.aliyuncs.com/${CLOUD}/${JOB_NAME}:${IMAGE_VERSION}" - sh 'docker build -t registry.cn-hangzhou.aliyuncs.com/${CLOUD}/${JOB_NAME}:${IMAGE_VERSION} ./' + sh 'docker build -t registry.cn-hangzhou.aliyuncs.com/${CLOUD}/${JOB_NAME}:${IMAGE_VERSION} ./web' sh 'docker push registry.cn-hangzhou.aliyuncs.com/${CLOUD}/${JOB_NAME}:${IMAGE_VERSION}' } } diff --git a/scripts/0.0.1/data/3_init_report_pic_data/index.js b/scripts/0.0.1/data/3_init_report_pic_data/index.js index de69d9ad..3d46b859 100644 --- a/scripts/0.0.1/data/3_init_report_pic_data/index.js +++ b/scripts/0.0.1/data/3_init_report_pic_data/index.js @@ -7,6 +7,7 @@ try { const path = require('path') const fs = require("fs"); const qiniu = require('qiniu'); + const uuidv4 = require('uuid/v4'); // 连接数据库 const pool = new Pool({ @@ -35,6 +36,7 @@ try { async (filePath, filename) => { return new Promise((resolve, reject) => { try { + const uploadPath = 'images' // 7niu 鉴权 const mac = new qiniu.auth.digest.Mac(accessKey, secretKey); const config = { @@ -48,7 +50,7 @@ try { var formUploader = new qiniu.form_up.FormUploader(config); var putExtra = new qiniu.form_up.PutExtra(); let key = path.posix.join(uploadPath, uuidv4(), filename); - formUploader.putFile(uploadToken, key, localFile, putExtra, function (respErr, + formUploader.putFile(uploadToken, key, filePath, putExtra, function (respErr, respBody, respInfo) { if (respErr) { reject(respErr); @@ -57,7 +59,7 @@ try { if (respInfo.statusCode == 200) { console.log(respBody); let qnkey = respBody.key; - resolve({ key: qnkey, url: `${domain}/${qnkey}` }); + resolve({ key: qnkey, url: `/${qnkey}` }); } else { console.log(respInfo.statusCode); console.log(respBody); @@ -86,7 +88,7 @@ try { let pic = []; fs.readdirSync(path.join(__dirname, '/data/图片')).forEach((filename) => { pic.push({ - path: `./data/运政/车辆/出租车/${filename}`, + path: `./data/图片/${filename}`, name: filename }) }); diff --git a/scripts/0.0.1/data/3_init_report_pic_data/package.json b/scripts/0.0.1/data/3_init_report_pic_data/package.json index b1f59042..dece1c8f 100644 --- a/scripts/0.0.1/data/3_init_report_pic_data/package.json +++ b/scripts/0.0.1/data/3_init_report_pic_data/package.json @@ -14,6 +14,7 @@ "pg": "^7.18.2", "qiniu": "^7.7.0", "superagent": "^8.0.0", + "uuid": "3.1.0", "xlsx": "^0.17.1" } }