@docupace/pipeline 1.1.2 → 1.1.4

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/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @docupace/pipeline
2
2
 
3
+ ## 1.1.4
4
+
5
+ ### Patch Changes
6
+
7
+ - b501e15: Release the CONNECT environment-defaults copy fix with the corrected merge-helper formatting.
8
+
9
+ ## 1.1.3
10
+
11
+ ### Patch Changes
12
+
13
+ - 43d3a6f: Resolve CONNECT template values using environment defaults before site overrides, preserving target environment inheritance when copying a site.
14
+
3
15
  ## 1.1.1
4
16
 
5
17
  ### Patch Changes
File without changes
File without changes
File without changes
File without changes
package/next/changeset.sh CHANGED
File without changes
package/next/copy.sh CHANGED
File without changes
package/next/deploy.sh CHANGED
File without changes
package/next/execute.sh CHANGED
File without changes
package/next/sonar.sh CHANGED
File without changes
package/package.json CHANGED
@@ -1,9 +1,19 @@
1
1
  {
2
2
  "name": "@docupace/pipeline",
3
- "version": "1.1.2",
3
+ "version": "1.1.4",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "type": "module",
7
+ "scripts": {
8
+ "prepublishOnly": "pnpm test",
9
+ "test": "node --experimental-vm-modules node_modules/jest/bin/jest.js --coverage --testPathIgnorePatterns='src/next/test\\.js'",
10
+ "test-deploy-core": "dp-next-cli deploy-core-pipeline dev template",
11
+ "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",
12
+ "test-run-pipline": "dp-next-cli run-pipeline -r docupace-next-e2e -b master -p run-tests-qa",
13
+ "test-validate": "dp-changset-cli validate",
14
+ "test-create": "dp-changset-cli create-changeset",
15
+ "lint:fix": "eslint --fix \"src/**/*.{js,jsx,ts,tsx}\""
16
+ },
7
17
  "exports": {
8
18
  "./changelogCanny": "./src/changeset/changelog-module.cjs"
9
19
  },
@@ -53,14 +63,5 @@
53
63
  "globals": "^15.14.0",
54
64
  "jest": "^30.4.2",
55
65
  "prettier": "^3.4.2"
56
- },
57
- "scripts": {
58
- "test": "node --experimental-vm-modules node_modules/jest/bin/jest.js --coverage --testPathIgnorePatterns='src/next/test\\.js'",
59
- "test-deploy-core": "dp-next-cli deploy-core-pipeline dev template",
60
- "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",
61
- "test-run-pipline": "dp-next-cli run-pipeline -r docupace-next-e2e -b master -p run-tests-qa",
62
- "test-validate": "dp-changset-cli validate",
63
- "test-create": "dp-changset-cli create-changeset",
64
- "lint:fix": "eslint --fix \"src/**/*.{js,jsx,ts,tsx}\""
65
66
  }
66
- }
67
+ }
package/src/auth0/cli.js CHANGED
File without changes
File without changes
package/src/merge/cli.js CHANGED
File without changes
package/src/micro/cli.js CHANGED
File without changes
File without changes
File without changes
package/src/next/cli.js CHANGED
File without changes
@@ -1012,6 +1012,24 @@ async function assertPlainTree(root) {
1012
1012
  }
1013
1013
  }
1014
1014
 
1015
+ function mergeConnectValues(defaults, overrides) {
1016
+ const isMap = (value) =>
1017
+ value !== null && typeof value === 'object' && !Array.isArray(value);
1018
+ const merged = isMap(defaults) ? { ...defaults } : {};
1019
+ for (const [key, value] of Object.entries(overrides)) {
1020
+ merged[key] = isMap(value) ? mergeConnectValues(merged[key], value) : value;
1021
+ }
1022
+ return merged;
1023
+ }
1024
+
1025
+ async function readConnectEnvironmentValues(repo, env) {
1026
+ const file = path.join(repo, 'envs', env, 'values.yaml');
1027
+ // Older GitOps checkouts keep every setting in the site values file.
1028
+ if (!(await fs.pathExists(file))) return {};
1029
+ const values = yaml.load(await fs.readFile(file, 'utf8'));
1030
+ return values?.['dp-connect-ui'] || {};
1031
+ }
1032
+
1015
1033
  // Works in an existing checkout. Git push, review branches and AWS authentication
1016
1034
  // belong to the calling pipeline. Replacement requires explicit forceOverwrite.
1017
1035
  export async function copyConnectSite({
@@ -1158,21 +1176,30 @@ export async function copyConnectSite({
1158
1176
  await fs.readFile(path.join(source, 'values.yaml'), 'utf8'),
1159
1177
  );
1160
1178
  const app = values?.['dp-connect-ui'];
1179
+ if (!app || typeof app !== 'object' || Array.isArray(app)) {
1180
+ throw new Error('Template values require a dp-connect-ui mapping.');
1181
+ }
1182
+ const sourceDefaults = await readConnectEnvironmentValues(repo, templateEnv);
1183
+ const effectiveApp = mergeConnectValues(sourceDefaults, app);
1161
1184
  if (
1162
- !app?.image?.repository ||
1163
- !app?.image?.tag ||
1164
- !app?.initContainer?.s3Bucket
1185
+ !effectiveApp.image?.repository ||
1186
+ !effectiveApp.image?.tag ||
1187
+ !effectiveApp.initContainer?.s3Bucket
1165
1188
  ) {
1166
1189
  throw new Error(
1167
- 'Template values require dp-connect-ui.image.repository, image.tag and initContainer.s3Bucket.',
1190
+ 'Template values and environment defaults require dp-connect-ui.image.repository, image.tag and initContainer.s3Bucket.',
1168
1191
  );
1169
1192
  }
1170
1193
  if (
1171
- app.initContainer.s3Bucket !==
1194
+ effectiveApp.initContainer.s3Bucket !==
1172
1195
  `docupace-${templateEnv}-connect-ui-configs-usw2`
1173
1196
  ) {
1174
1197
  throw new Error('Source S3 bucket does not match the source environment.');
1175
1198
  }
1199
+ const targetDefaults =
1200
+ env === templateEnv
1201
+ ? sourceDefaults
1202
+ : await readConnectEnvironmentValues(repo, env);
1176
1203
  const config = setConfigValues(sourceConfig, {
1177
1204
  'application.context': JSON.stringify(contextPath),
1178
1205
  'application.hostUrl': JSON.stringify(origin.origin),
@@ -1215,7 +1242,11 @@ export async function copyConnectSite({
1215
1242
  app.clientName = coreSchema.trim();
1216
1243
  app.envName = env;
1217
1244
  // Inherit the selected source image; shared-image migration is a separate action.
1218
- if (imageTag) app.image.tag = imageTag;
1245
+ app.image = {
1246
+ ...app.image,
1247
+ repository: effectiveApp.image.repository,
1248
+ tag: imageTag || effectiveApp.image.tag,
1249
+ };
1219
1250
  app.gateway = { ...app.gateway, hostnames: [origin.hostname], contextPath };
1220
1251
  app.serviceAccount = {
1221
1252
  ...app.serviceAccount,
@@ -1247,8 +1278,20 @@ export async function copyConnectSite({
1247
1278
  targetSecretName: 'artifactory-connect',
1248
1279
  awsSecretKey: 'docupace/eks/artifactory-ms',
1249
1280
  };
1250
- app.initContainer.s3Bucket = `docupace-${env}-connect-ui-configs-usw2`;
1251
- app.initContainer.s3Prefix = 'main';
1281
+ // Keep environment settings inherited; never flatten source environment
1282
+ // defaults (resources, replicas, etc.) into the new site's overrides.
1283
+ app.initContainer = { ...app.initContainer };
1284
+ for (const [key, value] of Object.entries({
1285
+ s3Bucket: `docupace-${env}-connect-ui-configs-usw2`,
1286
+ s3Prefix: 'main',
1287
+ })) {
1288
+ if (targetDefaults.initContainer?.[key] === value) {
1289
+ delete app.initContainer[key];
1290
+ } else {
1291
+ app.initContainer[key] = value;
1292
+ }
1293
+ }
1294
+ if (Object.keys(app.initContainer).length === 0) delete app.initContainer;
1252
1295
  delete app.configVersion;
1253
1296
  delete app.fullnameOverride;
1254
1297
  delete app.imagePullSecrets;
File without changes
File without changes
package/src/xray/cli.js CHANGED
File without changes
package/terraform/init.sh CHANGED
File without changes