@docupace/pipeline 1.0.2-3.test5 → 1.0.2-3.test7

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.23.test5",
3
+ "version": "1.0.23.test7",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "type": "module",
package/src/next/copy.js CHANGED
@@ -28,3 +28,25 @@ export async function copy(application, fromEnv, toEnv, tag) {
28
28
  await $`echo ${envInfo[toEnv].jfrog.password} | docker login --username ${envInfo[toEnv].jfrog.username} --password-stdin ${jfRegistryUrl}`;
29
29
  await $`docker push ${toFullImageName}`;
30
30
  }
31
+
32
+ export async function copy2(repositoryName, fromEnv, toEnv, tag) {
33
+ const envInfo = getEnvInfo();
34
+ const fromRegistry = `${jfRegistryUrl}/${repositoryName}-${fromEnv}-docker-local`;
35
+ const toRegistry = `${jfRegistryUrl}/${repositoryName}-${toEnv}-docker-local`;
36
+ const imageName = `${repositoryName}:${tag}`;
37
+ const fromFullImageName = `${fromRegistry}/${imageName}`;
38
+ const toFullImageName = `${toRegistry}/${imageName}`;
39
+
40
+ console.log(
41
+ `Copying Docker image: ${fromFullImageName} -> ${toFullImageName}`,
42
+ );
43
+
44
+ // Login to source registry
45
+ await $`echo ${envInfo[fromEnv].jfrog.password} | docker login --username ${envInfo[fromEnv].jfrog.username} --password-stdin ${jfRegistryUrl}`;
46
+ await $`docker pull ${fromFullImageName}`;
47
+ await $`docker tag ${fromFullImageName} ${toFullImageName}`;
48
+
49
+ // Login to target registry
50
+ await $`echo ${envInfo[toEnv].jfrog.password} | docker login --username ${envInfo[toEnv].jfrog.username} --password-stdin ${jfRegistryUrl}`;
51
+ await $`docker push ${toFullImageName}`;
52
+ }
@@ -4,7 +4,7 @@ import yaml from 'js-yaml';
4
4
  import { $ } from 'zx';
5
5
  import lodash from 'lodash';
6
6
  import { appInfo, environmentConfig, getRepUrl } from './config.js';
7
- import { copy } from './copy.js';
7
+ import { copy2 } from './copy.js';
8
8
  import axios from 'axios';
9
9
  import { deployCore } from './jenkins.js';
10
10
 
@@ -302,7 +302,12 @@ export async function deployApp(
302
302
  );
303
303
 
304
304
  if (fromEnv !== toEnv) {
305
- await copy(application, fromEnv, toEnv, fromDeployConfig.image.tag);
305
+ await copy2(
306
+ appDetails.repositoryName,
307
+ fromEnv,
308
+ toEnv,
309
+ fromDeployConfig.image.tag,
310
+ );
306
311
  }
307
312
 
308
313
  // Read the deployment configuration for the target environment and site
@@ -400,7 +405,7 @@ export async function deployFromSite(
400
405
 
401
406
  console.log('appinfoLocal', appInfoLocal);
402
407
 
403
- for (const [application, appDetails] of Object.entries(appInfo)) {
408
+ for (const [application, appDetails] of Object.entries(appInfoLocal)) {
404
409
  let cm = await deployApp(
405
410
  application,
406
411
  appDetails,