@docupace/pipeline 1.0.7-7.micro-cli9 → 1.0.7-7.micro-cli11
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 +9 -11
package/package.json
CHANGED
package/src/micro/ms-deploy.js
CHANGED
|
@@ -287,29 +287,23 @@ 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
|
+
let SHA_IMAGE_NAME = '';
|
|
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
|
-
await $`git clone --depth 1 ${repoUrl} ${repoName}`;
|
|
306
|
+
await $`git clone --branch ${options.tag} --depth 1 ${repoUrl} ${repoName}`;
|
|
313
307
|
|
|
314
308
|
console.log('Checking if directory exists...');
|
|
315
309
|
await $`ls -la ${repoName}`;
|
|
@@ -321,7 +315,11 @@ export async function microserviceBuildPushImage(repoName, options = {}) {
|
|
|
321
315
|
await $`cd ${repoName} && git config user.name "Bitbucket Pipeline"`;
|
|
322
316
|
|
|
323
317
|
console.log(`Attempting to checkout branch: ${options.tag}`);
|
|
324
|
-
|
|
318
|
+
|
|
319
|
+
const gitSha = (
|
|
320
|
+
await $`cd ${repoName} && git log ${options.tag} --pretty=format:'%h' -n 1 `
|
|
321
|
+
).stdout.trim();
|
|
322
|
+
SHA_IMAGE_NAME = `${config.imageName}:sha-${gitSha}`;
|
|
325
323
|
|
|
326
324
|
console.log(`Building Docker image ${SHA_IMAGE_NAME}...`);
|
|
327
325
|
await $`cd ${repoName} && docker build -t ${SHA_IMAGE_NAME} .`;
|