@docupace/pipeline 1.0.112 โ†’ 1.0.113-test

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.
@@ -0,0 +1,5 @@
1
+ ---
2
+ "@docupace/pipeline": patch
3
+ ---
4
+
5
+ feat: sync image tag to eks-migration branch after deploy
package/README.md CHANGED
@@ -48,8 +48,15 @@ dp-next-cli [command] [options]
48
48
  - `-t, --to-env <toEnv>`: Target environment
49
49
  - `-F, --from-site <fromSite>`: Source site
50
50
  - `-T, --to-site <toSite>`: Target site
51
+ - `-j, --jira-ticket [jiraTicket]`: JIRA ticket (optional)
51
52
  - `-c, --deploy-core <deployCore>`: Deploy Core (default: "false")
52
53
  - `-C, --deploy-connect <deployConnect>`: Deploy Connect (default: "false")
54
+ - `update-site-version <env> <site>`: Update specific version components for a site
55
+ - `-u, --ui-version <uiVersion>`: UI image tag
56
+ - `-g, --graph-version <graphVersion>`: GraphQL-server image tag
57
+ - `-S, --standard-config <standardConfig>`: Standard config remote branch
58
+ - `-s, --site-config <siteConfig>`: Site config remote branch
59
+ - `-j, --jira-ticket [jiraTicket]`: JIRA ticket (required for prod)
53
60
  - `deploy-template`: Deploy an application for a specific site
54
61
  - `deploy-app <application>`: Deploy an application for a specific site
55
62
  - `deploy-core <env> <site>`: Deploy Core
package/package.json CHANGED
@@ -1,9 +1,18 @@
1
1
  {
2
2
  "name": "@docupace/pipeline",
3
- "version": "1.0.112",
3
+ "version": "1.0.113-test",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "type": "module",
7
+ "scripts": {
8
+ "test": "node --experimental-vm-modules node_modules/jest/bin/jest.js --coverage --testPathIgnorePatterns='src/next/test\\.js'",
9
+ "test-deploy-core": "dp-next-cli deploy-core-pipeline dev template",
10
+ "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",
11
+ "test-run-pipline": "dp-next-cli run-pipeline -r docupace-next-e2e -b master -p run-tests-qa",
12
+ "test-validate": "dp-changset-cli validate",
13
+ "test-create": "dp-changset-cli create-changeset",
14
+ "lint:fix": "eslint --fix \"src/**/*.{js,jsx,ts,tsx}\""
15
+ },
7
16
  "exports": {
8
17
  "./changelogCanny": "./src/changeset/changelog-module.cjs"
9
18
  },
@@ -49,14 +58,5 @@
49
58
  "globals": "^15.14.0",
50
59
  "jest": "^30.1.3",
51
60
  "prettier": "^3.4.2"
52
- },
53
- "scripts": {
54
- "test": "node --experimental-vm-modules node_modules/jest/bin/jest.js --coverage --testPathIgnorePatterns='src/next/test\\.js'",
55
- "test-deploy-core": "dp-next-cli deploy-core-pipeline dev template",
56
- "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",
57
- "test-run-pipline": "dp-next-cli run-pipeline -r docupace-next-e2e -b master -p run-tests-qa",
58
- "test-validate": "dp-changset-cli validate",
59
- "test-create": "dp-changset-cli create-changeset",
60
- "lint:fix": "eslint --fix \"src/**/*.{js,jsx,ts,tsx}\""
61
61
  }
62
- }
62
+ }
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
package/src/next/cli.js CHANGED
File without changes
@@ -136,7 +136,7 @@ export async function cloneEnvRepository(env) {
136
136
  const repoUrl = getRepUrl(repoName);
137
137
  console.log(`Cloning repository: ${repoName}`);
138
138
  await cleanUpRepoPath(repoPath);
139
- await $`git clone --depth 1 ${repoUrl}`;
139
+ await $`git clone --no-single-branch --depth 10 ${repoUrl}`;
140
140
  console.log(`Repository cloned to: ${repoPath}`);
141
141
  return repoPath;
142
142
  }
@@ -239,7 +239,7 @@ export function setTag(deployConfig, tag) {
239
239
  * @param {object} deployConfig - The updated YAML data.
240
240
  */
241
241
 
242
- export async function pushDeployConfig(repoPath, commitMessage) {
242
+ export async function pushDeployConfig(repoPath, commitMessage, env) {
243
243
  console.log('๐Ÿ“Œ Checking for updates to commit...');
244
244
  // Check if there are any changes to commit
245
245
  const status = (
@@ -273,11 +273,63 @@ export async function pushDeployConfig(repoPath, commitMessage) {
273
273
  await $`cd ${repoPath} && git push`;
274
274
  console.log('Changes pushed to the remote repository.');
275
275
 
276
+ await syncTagToMigrationBranch(repoPath, commitMessage, env);
277
+
276
278
  console.log('๐Ÿงน Cleaning up...');
277
279
  await $`rm -rf ${repoPath}`;
278
280
  console.log('Cleanup complete.');
279
281
  }
280
282
 
283
+ async function syncTagToMigrationBranch(repoPath, commitMessage, env) {
284
+ const migrationBranch = `eks-migration-${env}`;
285
+ try {
286
+ const branchExists = (
287
+ await $`cd ${repoPath} && git branch -r --list origin/${migrationBranch}`
288
+ ).stdout.trim();
289
+ if (!branchExists) return;
290
+
291
+ const changedFiles = (
292
+ await $`cd ${repoPath} && git diff --name-only HEAD~1 HEAD`
293
+ ).stdout
294
+ .trim()
295
+ .split('\n')
296
+ .filter(Boolean);
297
+
298
+ await $`cd ${repoPath} && git checkout ${migrationBranch}`;
299
+
300
+ let updated = false;
301
+ for (const file of changedFiles) {
302
+ if (!file.endsWith('.values.yaml')) continue;
303
+ const filePath = path.join(repoPath, file);
304
+ if (!fs.existsSync(filePath)) continue;
305
+
306
+ const masterContent = (await $`cd ${repoPath} && git show master:${file}`)
307
+ .stdout;
308
+ const masterConfig = yaml.load(masterContent);
309
+ const masterTag = masterConfig?.image?.tag;
310
+ if (!masterTag) continue;
311
+
312
+ const migrationConfig = yaml.load(fs.readFileSync(filePath, 'utf8'));
313
+ if (!migrationConfig?.image?.tag) continue;
314
+ if (migrationConfig.image.tag === masterTag) continue;
315
+
316
+ console.log(`Syncing tag ${masterTag} to ${migrationBranch}:${file}`);
317
+ migrationConfig.image.tag = masterTag;
318
+ fs.writeFileSync(filePath, yaml.dump(migrationConfig, { lineWidth: -1 }));
319
+ updated = true;
320
+ }
321
+
322
+ if (updated) {
323
+ await $`cd ${repoPath} && git add .`;
324
+ await $`cd ${repoPath} && git commit -m ${commitMessage}`;
325
+ await $`cd ${repoPath} && git push origin ${migrationBranch}`;
326
+ console.log(`Tag synced to ${migrationBranch} branch.`);
327
+ }
328
+ } catch (error) {
329
+ console.warn(`Failed to sync to ${migrationBranch}: ${error.message}`);
330
+ }
331
+ }
332
+
281
333
  function writeDeployConfig(deployConfigFilePath, deployConfig) {
282
334
  try {
283
335
  fs.writeFileSync(deployConfigFilePath, yaml.dump(deployConfig), 'utf8');
@@ -293,9 +345,10 @@ export async function writeAndPushDeployConfig(
293
345
  deployConfigFilePath,
294
346
  deployConfig,
295
347
  commitMessage,
348
+ env,
296
349
  ) {
297
350
  writeDeployConfig(deployConfigFilePath, deployConfig);
298
- await pushDeployConfig(repoPath, commitMessage);
351
+ await pushDeployConfig(repoPath, commitMessage, env);
299
352
  }
300
353
 
301
354
  /**
@@ -133,7 +133,9 @@ describe('cloneEnvRepository', () => {
133
133
  const result = await cloneEnvRepository(env);
134
134
 
135
135
  expect(getRepUrl).toHaveBeenCalledWith('gitops-dev');
136
- expect($.mock.calls[0][0][0]).toContain('git clone --depth 1');
136
+ expect($.mock.calls[0][0][0]).toContain(
137
+ 'git clone --no-single-branch --depth 10',
138
+ );
137
139
  expect(result).toContain('gitops-dev');
138
140
  });
139
141