@docupace/pipeline 1.0.8 → 1.0.9

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.
Files changed (2) hide show
  1. package/package.json +2 -2
  2. package/src/next/deploy.js +20 -8
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@docupace/pipeline",
3
- "version": "1.0.8",
3
+ "version": "1.0.9",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -35,7 +35,7 @@
35
35
  },
36
36
  "scripts": {
37
37
  "test-deploy-core": "dp-next-cli deploy-core-pipeline dev template",
38
- "test-deploy-from-site": "dp-next-cli deploy-from-site --from-env qa --to-env qa --from-site rockefeller --to-site rockefeller --deploy-core true",
38
+ "test-deploy-from-site": "dp-next-cli deploy-from-site --from-env dev --to-env dev --from-site financialdev --to-site template --deploy-core true",
39
39
  "test-run-pipline": "dp-next-cli run-pipeline -r docupace-next-e2e -b master -p run-tests-qa"
40
40
  }
41
41
  }
@@ -31,18 +31,18 @@ async function cloneEnvRepository(env) {
31
31
  return repoPath;
32
32
  }
33
33
 
34
- function getConfigPath(application, env, site) {
34
+ function getConfigPath(application, env, site, name) {
35
35
  const { repoPath } = getRepoLocalPath(env);
36
36
  const deployConfigFilePath = path.join(
37
37
  repoPath,
38
- `dp/${site}/${application}.values.yaml`,
38
+ `dp/${site}/${application}.${name}.yaml`,
39
39
  );
40
40
 
41
41
  return { repoPath, deployConfigFilePath };
42
42
  }
43
43
 
44
- async function readDeployConfig(application, env, site) {
45
- const { deployConfigFilePath } = getConfigPath(application, env, site);
44
+ async function readDeployConfig(application, env, site, name) {
45
+ const { deployConfigFilePath } = getConfigPath(application, env, site, name);
46
46
 
47
47
  let deployConfig;
48
48
  try {
@@ -63,6 +63,7 @@ export async function cloneAndReadDeployConfig(application, env, site) {
63
63
  application,
64
64
  env,
65
65
  site,
66
+ 'values',
66
67
  );
67
68
 
68
69
  return { repoPath, deployConfigFilePath, deployConfig };
@@ -118,7 +119,7 @@ export async function pushDeployConfig(repoPath, commitMessage) {
118
119
  console.log('✅ Cleanup complete.');
119
120
  }
120
121
 
121
- function writeDeployConfig(repPath, deployConfigFilePath, deployConfig) {
122
+ function writeDeployConfig(deployConfigFilePath, deployConfig) {
122
123
  try {
123
124
  fs.writeFileSync(deployConfigFilePath, yaml.dump(deployConfig), 'utf8');
124
125
  console.log(`✅ Updated YAML file saved at: ${deployConfigFilePath}`);
@@ -134,7 +135,7 @@ export async function writeAndPushDeployConfig(
134
135
  deployConfig,
135
136
  commitMessage,
136
137
  ) {
137
- writeDeployConfig(repoPath, deployConfigFilePath, deployConfig);
138
+ writeDeployConfig(deployConfigFilePath, deployConfig);
138
139
  await pushDeployConfig(repoPath, commitMessage);
139
140
  }
140
141
 
@@ -274,6 +275,7 @@ export async function deployFromSite(
274
275
  application,
275
276
  fromEnv,
276
277
  fromSite,
278
+ 'values',
277
279
  );
278
280
 
279
281
  if (fromEnv !== toEnv) {
@@ -284,7 +286,7 @@ export async function deployFromSite(
284
286
  const {
285
287
  deployConfig: toDeployConfig,
286
288
  deployConfigFilePath: toDeployConfigFilePath,
287
- } = await readDeployConfig(application, toEnv, toSite);
289
+ } = await readDeployConfig(application, toEnv, toSite, 'values');
288
290
 
289
291
  // Update target configuration using attributes specified in appInfo
290
292
  for (const attribute of appDetails.deployAttributes) {
@@ -297,8 +299,18 @@ export async function deployFromSite(
297
299
  }
298
300
  }
299
301
 
302
+ const {
303
+ deployConfig: toDeployAppConfig,
304
+ deployConfigFilePath: toDeployAppConfigFilePath,
305
+ } = await readDeployConfig(application, toEnv, toSite, 'app');
306
+
307
+ toDeployAppConfig.revision = fromDeployConfig.image.tag;
308
+
300
309
  // Write updated configuration to the target YAML file
301
- writeDeployConfig(toRepoPath, toDeployConfigFilePath, toDeployConfig);
310
+ writeDeployConfig(toDeployConfigFilePath, toDeployConfig);
311
+
312
+ writeDeployConfig(toDeployAppConfigFilePath, toDeployAppConfig);
313
+
302
314
  }
303
315
 
304
316
  // Push all changes if any updates were made