Commit 055a4386 authored by 智勇's avatar 智勇

增加仓库不存在的异常捕获

parent 7ae296ce
...@@ -18,7 +18,7 @@ const deploy = async (cluster) => { ...@@ -18,7 +18,7 @@ const deploy = async (cluster) => {
const summary = {} const summary = {}
// // for test // // for test
// const testNamespace = ['test'] // const testNamespace = ['fe']
// const nsTest = ns.namespaces && ns.namespaces.filter(item => testNamespace.includes(item.name)) // const nsTest = ns.namespaces && ns.namespaces.filter(item => testNamespace.includes(item.name))
// for (const namespace of nsTest) { // for (const namespace of nsTest) {
for (const namespace of ns.namespaces) { for (const namespace of ns.namespaces) {
...@@ -30,14 +30,18 @@ const deploy = async (cluster) => { ...@@ -30,14 +30,18 @@ const deploy = async (cluster) => {
const svcs = await getServicesFormat(client.clientInfo, namespace.name) const svcs = await getServicesFormat(client.clientInfo, namespace.name)
for (const svc of svcs) { for (const svc of svcs) {
// 重启latest // 重启latest
if (~svc.image.indexOf('latest')) { if (~svc.image.indexOf('latest') && svc.serviceName === 'admin') {
logger.info('检查项目', namespace.name, svc.serviceName) logger.info('检查项目', namespace.name, svc.serviceName)
const latest = await container.getTagByName(`qa-test/${svc.serviceName}`, 'latest') try {
const latestImageID = _.get(latest.tagInfo, '[0].tagId', '') const latest = await container.getTagByName(`qa-test/${svc.serviceName}`, 'latest')
if (latestImageID && latestImageID !== svc.imageID.split('@')[1]) { const latestImageID = _.get(latest.tagInfo, '[0].tagId', '')
logger.info('latest不一致,部署项目', namespace.name, svc.podName) if (latestImageID && latestImageID !== svc.imageID.split('@')[1]) {
summary[namespace.name].latestArray.push(svc.serviceName) logger.info('latest不一致,部署项目', namespace.name, svc.podName)
await serviceRestart(client.clientInfo, namespace.name, svc.podName) summary[namespace.name].latestArray.push(svc.serviceName)
await serviceRestart(client.clientInfo, namespace.name, svc.podName)
}
} catch (error) {
logger.warn(svc.serviceName, error)
} }
await sleep(5 * 1000) await sleep(5 * 1000)
} }
......
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