@docupace/pipeline 1.0.2-3.test6 → 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 +1 -1
- package/src/next/copy.js +22 -0
- package/src/next/deploy.js +7 -2
package/package.json
CHANGED
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
|
+
}
|
package/src/next/deploy.js
CHANGED
|
@@ -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 {
|
|
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
|
|
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
|