@docupace/pipeline 1.0.113-test2 โ 1.0.114
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 +11 -11
- package/src/auth0/cli.js +0 -0
- package/src/changeset/cli.js +0 -0
- package/src/merge/cli.js +0 -0
- package/src/micro/cli.js +0 -0
- package/src/next/cli.js +0 -0
- package/src/next/deploy.js +3 -60
- package/src/next/deploy.test.js +1 -3
- package/.changeset/eks-migration-sync.md +0 -5
package/package.json
CHANGED
|
@@ -1,18 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@docupace/pipeline",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.114",
|
|
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
|
-
},
|
|
16
7
|
"exports": {
|
|
17
8
|
"./changelogCanny": "./src/changeset/changelog-module.cjs"
|
|
18
9
|
},
|
|
@@ -58,5 +49,14 @@
|
|
|
58
49
|
"globals": "^15.14.0",
|
|
59
50
|
"jest": "^30.1.3",
|
|
60
51
|
"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
|
package/src/changeset/cli.js
CHANGED
|
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
|
package/src/next/deploy.js
CHANGED
|
@@ -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 --
|
|
139
|
+
await $`git clone --depth 1 ${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) {
|
|
243
243
|
console.log('๐ Checking for updates to commit...');
|
|
244
244
|
// Check if there are any changes to commit
|
|
245
245
|
const status = (
|
|
@@ -273,63 +273,11 @@ export async function pushDeployConfig(repoPath, commitMessage, env) {
|
|
|
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
|
-
|
|
278
276
|
console.log('๐งน Cleaning up...');
|
|
279
277
|
await $`rm -rf ${repoPath}`;
|
|
280
278
|
console.log('Cleanup complete.');
|
|
281
279
|
}
|
|
282
280
|
|
|
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
|
-
|
|
333
281
|
function writeDeployConfig(deployConfigFilePath, deployConfig) {
|
|
334
282
|
try {
|
|
335
283
|
fs.writeFileSync(deployConfigFilePath, yaml.dump(deployConfig), 'utf8');
|
|
@@ -345,10 +293,9 @@ export async function writeAndPushDeployConfig(
|
|
|
345
293
|
deployConfigFilePath,
|
|
346
294
|
deployConfig,
|
|
347
295
|
commitMessage,
|
|
348
|
-
env,
|
|
349
296
|
) {
|
|
350
297
|
writeDeployConfig(deployConfigFilePath, deployConfig);
|
|
351
|
-
await pushDeployConfig(repoPath, commitMessage
|
|
298
|
+
await pushDeployConfig(repoPath, commitMessage);
|
|
352
299
|
}
|
|
353
300
|
|
|
354
301
|
/**
|
|
@@ -1066,7 +1013,6 @@ export async function updateSiteVersion(
|
|
|
1066
1013
|
await pushDeployConfig(
|
|
1067
1014
|
toRepoPath,
|
|
1068
1015
|
`Update site versions for ${env}/${site}`,
|
|
1069
|
-
env,
|
|
1070
1016
|
);
|
|
1071
1017
|
|
|
1072
1018
|
if (autoDeployUpdated && env !== 'dev') {
|
|
@@ -1074,7 +1020,6 @@ export async function updateSiteVersion(
|
|
|
1074
1020
|
await pushDeployConfig(
|
|
1075
1021
|
devRepoPath,
|
|
1076
1022
|
`Update auto-deploy version for ${env}/${site}`,
|
|
1077
|
-
'dev',
|
|
1078
1023
|
);
|
|
1079
1024
|
}
|
|
1080
1025
|
|
|
@@ -1344,7 +1289,6 @@ export async function deployFromSite(
|
|
|
1344
1289
|
await pushDeployConfig(
|
|
1345
1290
|
toRepoPath,
|
|
1346
1291
|
`Updated deployment configurations from ${fromEnv}/${fromSite} to ${toEnv}/${toSite}`,
|
|
1347
|
-
toEnv,
|
|
1348
1292
|
);
|
|
1349
1293
|
// auto-deploy.yaml lives in gitops-dev; push it separately when toEnv isn't dev
|
|
1350
1294
|
if (autoDeployUpdated && toEnv !== 'dev') {
|
|
@@ -1352,7 +1296,6 @@ export async function deployFromSite(
|
|
|
1352
1296
|
await pushDeployConfig(
|
|
1353
1297
|
devRepoPath,
|
|
1354
1298
|
`Update auto-deploy version for ${toEnv}/${toSite}`,
|
|
1355
|
-
'dev',
|
|
1356
1299
|
);
|
|
1357
1300
|
}
|
|
1358
1301
|
console.log('All configurations updated and pushed successfully.');
|
package/src/next/deploy.test.js
CHANGED
|
@@ -133,9 +133,7 @@ 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(
|
|
137
|
-
'git clone --no-single-branch --depth 10',
|
|
138
|
-
);
|
|
136
|
+
expect($.mock.calls[0][0][0]).toContain('git clone --depth 1');
|
|
139
137
|
expect(result).toContain('gitops-dev');
|
|
140
138
|
});
|
|
141
139
|
|