@docupace/pipeline 1.0.7-7.micro-cli9 → 1.0.7-7.micro-cli10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/micro/ms-deploy.js +8 -9
package/package.json
CHANGED
package/src/micro/ms-deploy.js
CHANGED
|
@@ -287,26 +287,20 @@ export async function microserviceBuildPushImage(repoName, options = {}) {
|
|
|
287
287
|
'Image name is required. Set IMAGE_NAME or APP_NAME environment variable.',
|
|
288
288
|
);
|
|
289
289
|
}
|
|
290
|
-
const gitSha = (
|
|
291
|
-
await $`git log ${options.tag} --pretty=format:'%h' -n 1 `
|
|
292
|
-
).stdout.trim();
|
|
293
290
|
console.log('=== Docker Image Publishing Configuration ===');
|
|
294
|
-
console.log(`Image Name: ${config.imageName}`);
|
|
295
|
-
console.log(`Git SHA: ${gitSha}`);
|
|
296
|
-
console.log(`Build Number: ${config.buildNumber}`);
|
|
297
291
|
console.log(`Version Tag: ${config.tag || 'none'}`);
|
|
298
292
|
console.log(`Registry: ${config.registryUrl}/${repoName}`);
|
|
299
293
|
console.log('==========================================');
|
|
300
294
|
|
|
301
295
|
const registryPath = `${config.registryUrl}/${repoName}`;
|
|
302
|
-
const SHA_IMAGE_NAME = `${config.imageName}:sha-${gitSha}`;
|
|
303
|
-
|
|
304
296
|
// Docker login
|
|
305
297
|
await $`echo ${config.password} | docker login --username ${config.username} --password-stdin ${config.registryUrl}`;
|
|
306
298
|
|
|
307
299
|
try {
|
|
308
300
|
// Build the image if it doesn't exist locally
|
|
309
|
-
const
|
|
301
|
+
const TAG_IMAGE_NAME = `${config.imageName}:${options.tag}`;
|
|
302
|
+
const imageExists = await checkLocalImage(TAG_IMAGE_NAME);
|
|
303
|
+
|
|
310
304
|
if (!imageExists) {
|
|
311
305
|
const repoUrl = `https://${process.env.BITBUCKET_USERNAME}:${process.env.BITBUCKET_APP_PASSWORD}@bitbucket.org/dp-cloud/${repoName}.git`;
|
|
312
306
|
await $`git clone --depth 1 ${repoUrl} ${repoName}`;
|
|
@@ -323,6 +317,11 @@ export async function microserviceBuildPushImage(repoName, options = {}) {
|
|
|
323
317
|
console.log(`Attempting to checkout branch: ${options.tag}`);
|
|
324
318
|
await $`cd ${repoName} && git checkout ${options.tag}`;
|
|
325
319
|
|
|
320
|
+
const gitSha = (
|
|
321
|
+
await $`cd ${repoName} && git log ${options.tag} --pretty=format:'%h' -n 1 `
|
|
322
|
+
).stdout.trim();
|
|
323
|
+
const SHA_IMAGE_NAME = `${config.imageName}:sha-${gitSha}`;
|
|
324
|
+
|
|
326
325
|
console.log(`Building Docker image ${SHA_IMAGE_NAME}...`);
|
|
327
326
|
await $`cd ${repoName} && docker build -t ${SHA_IMAGE_NAME} .`;
|
|
328
327
|
}
|