@docupace/pipeline 1.0.7-7.micro-cli8 → 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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@docupace/pipeline",
3
- "version": "1.0.77.micro-cli8",
3
+ "version": "1.0.77.micro-cli10",
4
4
  "main": "index.js",
5
5
  "type": "module",
6
6
  "bin": {
@@ -271,7 +271,6 @@ export async function microserviceBuildPushImage(repoName, options = {}) {
271
271
  .split('-')
272
272
  .pop()
273
273
  .trim();
274
- config.repoName = repoName;
275
274
  const config = {
276
275
  imageName: serviceName,
277
276
  registryUrl: options.registryUrl || process.env.JF_REGISTRY_URL,
@@ -288,26 +287,20 @@ export async function microserviceBuildPushImage(repoName, options = {}) {
288
287
  'Image name is required. Set IMAGE_NAME or APP_NAME environment variable.',
289
288
  );
290
289
  }
291
- const gitSha = (
292
- await $`git log ${options.tag} --pretty=format:'%h' -n 1 `
293
- ).stdout.trim();
294
290
  console.log('=== Docker Image Publishing Configuration ===');
295
- console.log(`Image Name: ${config.imageName}`);
296
- console.log(`Git SHA: ${gitSha}`);
297
- console.log(`Build Number: ${config.buildNumber}`);
298
291
  console.log(`Version Tag: ${config.tag || 'none'}`);
299
292
  console.log(`Registry: ${config.registryUrl}/${repoName}`);
300
293
  console.log('==========================================');
301
294
 
302
295
  const registryPath = `${config.registryUrl}/${repoName}`;
303
- const SHA_IMAGE_NAME = `${config.imageName}:sha-${gitSha}`;
304
-
305
296
  // Docker login
306
297
  await $`echo ${config.password} | docker login --username ${config.username} --password-stdin ${config.registryUrl}`;
307
298
 
308
299
  try {
309
300
  // Build the image if it doesn't exist locally
310
- const imageExists = await checkLocalImage(SHA_IMAGE_NAME);
301
+ const TAG_IMAGE_NAME = `${config.imageName}:${options.tag}`;
302
+ const imageExists = await checkLocalImage(TAG_IMAGE_NAME);
303
+
311
304
  if (!imageExists) {
312
305
  const repoUrl = `https://${process.env.BITBUCKET_USERNAME}:${process.env.BITBUCKET_APP_PASSWORD}@bitbucket.org/dp-cloud/${repoName}.git`;
313
306
  await $`git clone --depth 1 ${repoUrl} ${repoName}`;
@@ -324,6 +317,11 @@ export async function microserviceBuildPushImage(repoName, options = {}) {
324
317
  console.log(`Attempting to checkout branch: ${options.tag}`);
325
318
  await $`cd ${repoName} && git checkout ${options.tag}`;
326
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
+
327
325
  console.log(`Building Docker image ${SHA_IMAGE_NAME}...`);
328
326
  await $`cd ${repoName} && docker build -t ${SHA_IMAGE_NAME} .`;
329
327
  }