Commit 7ae296ce authored by 智勇's avatar 智勇

qa-xxx -> qa-test

parent e33841ec
......@@ -12,13 +12,13 @@ const APP_CONFIG = require('../config')
const makeResouce = require('./../resource/makeResouce')
const deploy = async (cluster) => {
logger.info('deployLatest start')
logger.info('deployLatest job start')
const client = await getClient(cluster)
const ns = await getAllNamespace(client.clientInfo)
const summary = {}
// // for test
// const testNamespace = ['ai2', 'xjfq']
// const testNamespace = ['test']
// const nsTest = ns.namespaces && ns.namespaces.filter(item => testNamespace.includes(item.name))
// for (const namespace of nsTest) {
for (const namespace of ns.namespaces) {
......@@ -32,8 +32,7 @@ const deploy = async (cluster) => {
// 重启latest
if (~svc.image.indexOf('latest')) {
logger.info('检查项目', namespace.name, svc.serviceName)
const repoName = svc.image.split(':')[0].split('/').slice(1).join('/')
const latest = await container.getTagByName(repoName, 'latest')
const latest = await container.getTagByName(`qa-test/${svc.serviceName}`, 'latest')
const latestImageID = _.get(latest.tagInfo, '[0].tagId', '')
if (latestImageID && latestImageID !== svc.imageID.split('@')[1]) {
logger.info('latest不一致,部署项目', namespace.name, svc.podName)
......@@ -42,16 +41,16 @@ const deploy = async (cluster) => {
}
await sleep(5 * 1000)
}
// 把master更新部署成lastet
if (~svc.image.search(':master-')) {
logger.info('将master分支', svc.image, '部署成latest')
const repoName = svc.image.split(':')[0].split('/').slice(1).join('/')
let mock
if (svc.labels.mock) {
mock = `'${svc.labels.mock}'`
}
const data = {
image: `${repoName}:latest`,
image: `qa-test/${svc.serviceName}:latest`,
namespace: namespace.name,
serviceName: svc.serviceName,
type: svc.labels.type,
......@@ -64,6 +63,29 @@ const deploy = async (cluster) => {
summary[namespace.name].masterArray.push(svc.serviceName)
await sleep(5 * 1000)
}
// // for op
// if (svc.labels.type !== 'base') {
// logger.info('将qa-xxx', svc.image, '部署成qa-test')
// let mock
// if (svc.labels.mock) {
// mock = `'${svc.labels.mock}'`
// }
// const image = svc.image.split(':')[1]
// const data = {
// image: `qa-test/${svc.serviceName}:${image}`,
// namespace: namespace.name,
// serviceName: svc.serviceName,
// type: svc.labels.type,
// label: svc.labels.type,
// mock,
// }
// const resources = await makeResouce(data.serviceName, data.label)
// data.resources = resources
// await deployUpdate(client.clusterInfo, client.clientInfo, data)
// summary[namespace.name].masterArray.push(svc.serviceName)
// await sleep(5 * 1000)
// }
}
logger.info('ns:', namespace.name, '检查完毕')
......@@ -81,7 +103,7 @@ const deploy = async (cluster) => {
}
}
dingTalk('daily latest 部署结果', text, APP_CONFIG.latestDingRobot)
logger.info('deployLatest end')
logger.info('deployLatest job end')
}
module.exports = () => {
......
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