@docupace/pipeline 1.0.7-7.micro-cli10 → 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 +3 -4
package/package.json
CHANGED
package/src/micro/ms-deploy.js
CHANGED
|
@@ -300,10 +300,10 @@ export async function microserviceBuildPushImage(repoName, options = {}) {
|
|
|
300
300
|
// Build the image if it doesn't exist locally
|
|
301
301
|
const TAG_IMAGE_NAME = `${config.imageName}:${options.tag}`;
|
|
302
302
|
const imageExists = await checkLocalImage(TAG_IMAGE_NAME);
|
|
303
|
-
|
|
303
|
+
let SHA_IMAGE_NAME = '';
|
|
304
304
|
if (!imageExists) {
|
|
305
305
|
const repoUrl = `https://${process.env.BITBUCKET_USERNAME}:${process.env.BITBUCKET_APP_PASSWORD}@bitbucket.org/dp-cloud/${repoName}.git`;
|
|
306
|
-
await $`git clone --depth 1 ${repoUrl} ${repoName}`;
|
|
306
|
+
await $`git clone --branch ${options.tag} --depth 1 ${repoUrl} ${repoName}`;
|
|
307
307
|
|
|
308
308
|
console.log('Checking if directory exists...');
|
|
309
309
|
await $`ls -la ${repoName}`;
|
|
@@ -315,12 +315,11 @@ export async function microserviceBuildPushImage(repoName, options = {}) {
|
|
|
315
315
|
await $`cd ${repoName} && git config user.name "Bitbucket Pipeline"`;
|
|
316
316
|
|
|
317
317
|
console.log(`Attempting to checkout branch: ${options.tag}`);
|
|
318
|
-
await $`cd ${repoName} && git checkout ${options.tag}`;
|
|
319
318
|
|
|
320
319
|
const gitSha = (
|
|
321
320
|
await $`cd ${repoName} && git log ${options.tag} --pretty=format:'%h' -n 1 `
|
|
322
321
|
).stdout.trim();
|
|
323
|
-
|
|
322
|
+
SHA_IMAGE_NAME = `${config.imageName}:sha-${gitSha}`;
|
|
324
323
|
|
|
325
324
|
console.log(`Building Docker image ${SHA_IMAGE_NAME}...`);
|
|
326
325
|
await $`cd ${repoName} && docker build -t ${SHA_IMAGE_NAME} .`;
|