@docupace/pipeline 1.0.137 → 1.1.1
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 +34 -0
- package/README.md +15 -0
- package/package.json +12 -11
- package/pnpm-workspace.yaml +4 -0
- 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 +66 -4
- package/src/next/connect-aws-cli.js +206 -0
- package/src/next/connect-aws.js +1858 -0
- package/src/next/connect-aws.test.js +131 -0
- package/src/next/deploy.js +95 -2
- package/src/next/deploy.test.js +1 -0
- package/src/tenable/cli.js +0 -0
- package/src/veracode/cli.js +0 -0
- package/src/xray/cli.js +0 -0
- package/.gitignore +0 -109
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
import { describe, expect, it, jest, beforeEach } from '@jest/globals';
|
|
2
|
+
|
|
3
|
+
jest.unstable_mockModule('./pipline.js', () => ({
|
|
4
|
+
runPipeline: jest.fn(),
|
|
5
|
+
}));
|
|
6
|
+
|
|
7
|
+
const { runPipeline } = await import('./pipline.js');
|
|
8
|
+
const {
|
|
9
|
+
deployConnectAws,
|
|
10
|
+
validateConnectAwsArgs,
|
|
11
|
+
normalizeConnectAwsSites,
|
|
12
|
+
CONNECT_AWS_GITOPS_REPO,
|
|
13
|
+
CONNECT_AWS_UPDATE_PIPELINE,
|
|
14
|
+
} = await import('./connect-aws.js');
|
|
15
|
+
|
|
16
|
+
describe('normalizeConnectAwsSites', () => {
|
|
17
|
+
it('accepts a single site', () => {
|
|
18
|
+
expect(normalizeConnectAwsSites('oa')).toEqual(['oa']);
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
it('splits comma-separated sites and trims', () => {
|
|
22
|
+
expect(normalizeConnectAwsSites('oa, athene, template')).toEqual([
|
|
23
|
+
'oa',
|
|
24
|
+
'athene',
|
|
25
|
+
'template',
|
|
26
|
+
]);
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
it('accepts an array', () => {
|
|
30
|
+
expect(normalizeConnectAwsSites(['oa', 'athene'])).toEqual([
|
|
31
|
+
'oa',
|
|
32
|
+
'athene',
|
|
33
|
+
]);
|
|
34
|
+
});
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
describe('validateConnectAwsArgs', () => {
|
|
38
|
+
it('accepts a single site', () => {
|
|
39
|
+
expect(() =>
|
|
40
|
+
validateConnectAwsArgs('qa', '1stglobal', '4.75.52'),
|
|
41
|
+
).not.toThrow();
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
it('accepts comma-separated sites', () => {
|
|
45
|
+
expect(() =>
|
|
46
|
+
validateConnectAwsArgs('qa', 'oa,athene', '4.75.52'),
|
|
47
|
+
).not.toThrow();
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
it('rejects invalid env', () => {
|
|
51
|
+
expect(() =>
|
|
52
|
+
validateConnectAwsArgs('preprod', '1stglobal', '4.75.52'),
|
|
53
|
+
).toThrow(/Invalid env/);
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
it('rejects invalid site in a list', () => {
|
|
57
|
+
expect(() => validateConnectAwsArgs('qa', 'oa,../x', '4.75.52')).toThrow(
|
|
58
|
+
/Invalid site/,
|
|
59
|
+
);
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
it('rejects empty sites', () => {
|
|
63
|
+
expect(() => validateConnectAwsArgs('qa', ' , ', '4.75.52')).toThrow(
|
|
64
|
+
/At least one site/,
|
|
65
|
+
);
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
it('rejects invalid version', () => {
|
|
69
|
+
expect(() => validateConnectAwsArgs('qa', '1stglobal', '')).toThrow(
|
|
70
|
+
/Invalid version/,
|
|
71
|
+
);
|
|
72
|
+
});
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
describe('deployConnectAws', () => {
|
|
76
|
+
beforeEach(() => {
|
|
77
|
+
runPipeline.mockReset();
|
|
78
|
+
runPipeline.mockResolvedValue(undefined);
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
it('triggers update-site-image with a single SITE', async () => {
|
|
82
|
+
await deployConnectAws('dev', 'template', '4.76.1');
|
|
83
|
+
|
|
84
|
+
expect(runPipeline).toHaveBeenCalledWith(
|
|
85
|
+
CONNECT_AWS_GITOPS_REPO,
|
|
86
|
+
CONNECT_AWS_UPDATE_PIPELINE,
|
|
87
|
+
'main',
|
|
88
|
+
{
|
|
89
|
+
ENV: 'dev',
|
|
90
|
+
SITE: 'template',
|
|
91
|
+
VERSION: '4.76.1',
|
|
92
|
+
},
|
|
93
|
+
true,
|
|
94
|
+
);
|
|
95
|
+
});
|
|
96
|
+
|
|
97
|
+
it('passes comma-separated SITE for multiple sites', async () => {
|
|
98
|
+
await deployConnectAws('qa', ['oa', 'athene'], '4.76.1');
|
|
99
|
+
|
|
100
|
+
expect(runPipeline).toHaveBeenCalledWith(
|
|
101
|
+
CONNECT_AWS_GITOPS_REPO,
|
|
102
|
+
CONNECT_AWS_UPDATE_PIPELINE,
|
|
103
|
+
'main',
|
|
104
|
+
{
|
|
105
|
+
ENV: 'qa',
|
|
106
|
+
SITE: 'oa,athene',
|
|
107
|
+
VERSION: '4.76.1',
|
|
108
|
+
},
|
|
109
|
+
true,
|
|
110
|
+
);
|
|
111
|
+
});
|
|
112
|
+
|
|
113
|
+
it('honors wait and branch options', async () => {
|
|
114
|
+
await deployConnectAws('stage', 'oa,athene', 'git-commit-abc123', {
|
|
115
|
+
wait: false,
|
|
116
|
+
branch: 'feature/update-site-image-pipeline',
|
|
117
|
+
});
|
|
118
|
+
|
|
119
|
+
expect(runPipeline).toHaveBeenCalledWith(
|
|
120
|
+
CONNECT_AWS_GITOPS_REPO,
|
|
121
|
+
CONNECT_AWS_UPDATE_PIPELINE,
|
|
122
|
+
'feature/update-site-image-pipeline',
|
|
123
|
+
{
|
|
124
|
+
ENV: 'stage',
|
|
125
|
+
SITE: 'oa,athene',
|
|
126
|
+
VERSION: 'git-commit-abc123',
|
|
127
|
+
},
|
|
128
|
+
false,
|
|
129
|
+
);
|
|
130
|
+
});
|
|
131
|
+
});
|
package/src/next/deploy.js
CHANGED
|
@@ -17,6 +17,11 @@ import { gitDescribeToSemver } from './git-to-semver.js';
|
|
|
17
17
|
import { deployConnect, deployCore } from './jenkins.js';
|
|
18
18
|
import { makeJiraRequest } from './jira.js';
|
|
19
19
|
import { autoDeployConfigName } from './config.js';
|
|
20
|
+
import {
|
|
21
|
+
CONNECT_AWS_GITOPS_REPO,
|
|
22
|
+
deployConnectAws,
|
|
23
|
+
isAllowedConnectAwsEnv,
|
|
24
|
+
} from './connect-aws.js';
|
|
20
25
|
|
|
21
26
|
/**
|
|
22
27
|
* Clone the repository, read the YAML file, and return the parsed data and file paths.
|
|
@@ -432,6 +437,14 @@ export async function deployTemplate(
|
|
|
432
437
|
export async function deployAppWithTag(application, env, site, deployTag) {
|
|
433
438
|
console.log(`Deploying application: ${application} for site: ${site}`);
|
|
434
439
|
console.log(`Using deployment tag: ${deployTag}`);
|
|
440
|
+
|
|
441
|
+
// Connect UI on AWS: update dp-eks-connect-ui-gitops image.tag via Bitbucket pipeline.
|
|
442
|
+
// (Not a Next gitops-<env> app — no <app>.values.yaml under dp/<site>/.)
|
|
443
|
+
if (application === 'connect') {
|
|
444
|
+
await deployConnectAws(env, site, deployTag, { wait: true });
|
|
445
|
+
return;
|
|
446
|
+
}
|
|
447
|
+
|
|
435
448
|
const appDetails = appInfo[application] ?? getDefaultAppInfo(application);
|
|
436
449
|
if (!appInfo[application]) {
|
|
437
450
|
console.log(
|
|
@@ -847,10 +860,17 @@ export async function updateSiteVersion(
|
|
|
847
860
|
standardConfig,
|
|
848
861
|
siteConfig,
|
|
849
862
|
jiraTicket,
|
|
863
|
+
connectVersion,
|
|
850
864
|
) {
|
|
851
|
-
if (
|
|
865
|
+
if (
|
|
866
|
+
!uiVersion &&
|
|
867
|
+
!graphVersion &&
|
|
868
|
+
!standardConfig &&
|
|
869
|
+
!siteConfig &&
|
|
870
|
+
!connectVersion
|
|
871
|
+
) {
|
|
852
872
|
console.error(
|
|
853
|
-
'❌ At least one of --ui-version, --graph-version, --standard-config,
|
|
873
|
+
'❌ At least one of --ui-version, --graph-version, --standard-config, --site-config, or --connect-version must be provided',
|
|
854
874
|
);
|
|
855
875
|
process.exit(1);
|
|
856
876
|
}
|
|
@@ -944,6 +964,15 @@ export async function updateSiteVersion(
|
|
|
944
964
|
}
|
|
945
965
|
}
|
|
946
966
|
|
|
967
|
+
const hasNextVersionUpdate =
|
|
968
|
+
uiVersion || graphVersion || standardConfig || siteConfig;
|
|
969
|
+
|
|
970
|
+
// Connect AWS-only: update image.tag via gitops pipeline and return.
|
|
971
|
+
if (connectVersion && !hasNextVersionUpdate) {
|
|
972
|
+
await deployConnectAws(env, site, connectVersion, { wait: true });
|
|
973
|
+
return;
|
|
974
|
+
}
|
|
975
|
+
|
|
947
976
|
const toRepoPath = await cloneEnvRepository(env);
|
|
948
977
|
|
|
949
978
|
if (env !== 'dev') {
|
|
@@ -1089,6 +1118,44 @@ export async function updateSiteVersion(
|
|
|
1089
1118
|
} else {
|
|
1090
1119
|
console.log('No changes detected. Nothing to push.');
|
|
1091
1120
|
}
|
|
1121
|
+
|
|
1122
|
+
if (connectVersion) {
|
|
1123
|
+
await deployConnectAws(env, site, connectVersion, { wait: true });
|
|
1124
|
+
}
|
|
1125
|
+
}
|
|
1126
|
+
|
|
1127
|
+
/**
|
|
1128
|
+
* Read dp-connect-ui.image.tag for a site from the AWS Connect gitops repo.
|
|
1129
|
+
* @param {string} env
|
|
1130
|
+
* @param {string} site
|
|
1131
|
+
* @returns {Promise<string>}
|
|
1132
|
+
*/
|
|
1133
|
+
export async function getConnectAwsImageTag(env, site) {
|
|
1134
|
+
if (!isAllowedConnectAwsEnv(env)) {
|
|
1135
|
+
throw new Error(
|
|
1136
|
+
`Invalid AWS Connect env "${env}". Expected one of: dev, qa, stage, uat, prod`,
|
|
1137
|
+
);
|
|
1138
|
+
}
|
|
1139
|
+
|
|
1140
|
+
const repoPath = await cloneRepository(CONNECT_AWS_GITOPS_REPO);
|
|
1141
|
+
const valuesFile = path.join(repoPath, 'envs', env, site, 'values.yaml');
|
|
1142
|
+
|
|
1143
|
+
try {
|
|
1144
|
+
if (!fs.existsSync(valuesFile)) {
|
|
1145
|
+
throw new Error(`AWS Connect values file not found: ${valuesFile}`);
|
|
1146
|
+
}
|
|
1147
|
+
|
|
1148
|
+
const content = fs.readFileSync(valuesFile, 'utf8');
|
|
1149
|
+
const match = content.match(/^\s{4}tag:\s*"?([^"\n]+)"?\s*$/m);
|
|
1150
|
+
if (!match?.[1]) {
|
|
1151
|
+
throw new Error(
|
|
1152
|
+
`Could not parse image.tag from envs/${env}/${site}/values.yaml`,
|
|
1153
|
+
);
|
|
1154
|
+
}
|
|
1155
|
+
return match[1].trim();
|
|
1156
|
+
} finally {
|
|
1157
|
+
await $`rm -rf ${repoPath}`;
|
|
1158
|
+
}
|
|
1092
1159
|
}
|
|
1093
1160
|
|
|
1094
1161
|
export async function deployFromSite(
|
|
@@ -1099,6 +1166,7 @@ export async function deployFromSite(
|
|
|
1099
1166
|
isDeployCore,
|
|
1100
1167
|
isDeployConnect,
|
|
1101
1168
|
jiraTicket,
|
|
1169
|
+
isDeployConnectAws = 'false',
|
|
1102
1170
|
) {
|
|
1103
1171
|
console.log(
|
|
1104
1172
|
`Deploying changes from ${fromSite} in ${fromEnv} to ${toSite} in ${toEnv}${jiraTicket ? ` approved by JIRA ticket ${jiraTicket}` : ''}`,
|
|
@@ -1236,6 +1304,31 @@ export async function deployFromSite(
|
|
|
1236
1304
|
}
|
|
1237
1305
|
}
|
|
1238
1306
|
|
|
1307
|
+
if (isDeployConnectAws === 'true') {
|
|
1308
|
+
const sourceVersion = await getConnectAwsImageTag(fromEnv, fromSite);
|
|
1309
|
+
let targetVersion;
|
|
1310
|
+
try {
|
|
1311
|
+
targetVersion = await getConnectAwsImageTag(toEnv, toSite);
|
|
1312
|
+
} catch (error) {
|
|
1313
|
+
console.warn(
|
|
1314
|
+
`Could not read target AWS Connect version (${error.message}); deploying source version anyway.`,
|
|
1315
|
+
);
|
|
1316
|
+
targetVersion = null;
|
|
1317
|
+
}
|
|
1318
|
+
|
|
1319
|
+
if (targetVersion && targetVersion === sourceVersion) {
|
|
1320
|
+
console.log(
|
|
1321
|
+
`AWS Connect versions already match (${sourceVersion}); skipping deploy-connect-aws.`,
|
|
1322
|
+
);
|
|
1323
|
+
} else {
|
|
1324
|
+
console.log(
|
|
1325
|
+
`AWS Connect version to deploy: ${sourceVersion}` +
|
|
1326
|
+
(targetVersion ? ` (target currently ${targetVersion})` : ''),
|
|
1327
|
+
);
|
|
1328
|
+
await deployConnectAws(toEnv, toSite, sourceVersion, { wait: true });
|
|
1329
|
+
}
|
|
1330
|
+
}
|
|
1331
|
+
|
|
1239
1332
|
// Clone repositories for source and target environments
|
|
1240
1333
|
const fromRepoPath = await cloneEnvRepository(fromEnv);
|
|
1241
1334
|
const toRepoPath =
|
package/src/next/deploy.test.js
CHANGED
package/src/tenable/cli.js
CHANGED
|
File without changes
|
package/src/veracode/cli.js
CHANGED
|
File without changes
|
package/src/xray/cli.js
CHANGED
|
File without changes
|
package/.gitignore
DELETED
|
@@ -1,109 +0,0 @@
|
|
|
1
|
-
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
|
|
2
|
-
|
|
3
|
-
# IDE
|
|
4
|
-
.idea
|
|
5
|
-
*.iml
|
|
6
|
-
# Dependencies
|
|
7
|
-
/node_modules
|
|
8
|
-
/.pnp
|
|
9
|
-
.pnp.js
|
|
10
|
-
|
|
11
|
-
# Testing
|
|
12
|
-
/coverage
|
|
13
|
-
|
|
14
|
-
# Next.js
|
|
15
|
-
/.next/
|
|
16
|
-
/out/
|
|
17
|
-
|
|
18
|
-
# Production
|
|
19
|
-
/build
|
|
20
|
-
/dist
|
|
21
|
-
|
|
22
|
-
# Misc
|
|
23
|
-
.DS_Store
|
|
24
|
-
*.pem
|
|
25
|
-
cypress/screenshots/
|
|
26
|
-
|
|
27
|
-
# Debug
|
|
28
|
-
npm-debug.log*
|
|
29
|
-
yarn-debug.log*
|
|
30
|
-
yarn-error.log*
|
|
31
|
-
|
|
32
|
-
# Local env files
|
|
33
|
-
.env
|
|
34
|
-
.env*.local
|
|
35
|
-
|
|
36
|
-
# Vercel
|
|
37
|
-
.vercel
|
|
38
|
-
|
|
39
|
-
# Typescript
|
|
40
|
-
*.tsbuildinfo
|
|
41
|
-
next-env.d.ts
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
# Logs
|
|
45
|
-
logs
|
|
46
|
-
*.log
|
|
47
|
-
|
|
48
|
-
# Runtime data
|
|
49
|
-
pids
|
|
50
|
-
*.pid
|
|
51
|
-
*.seed
|
|
52
|
-
|
|
53
|
-
# Directory for instrumented libs generated by jscoverage/JSCover
|
|
54
|
-
lib-cov
|
|
55
|
-
|
|
56
|
-
# Coverage directory used by tools like istanbul
|
|
57
|
-
coverage
|
|
58
|
-
|
|
59
|
-
# nyc test coverage
|
|
60
|
-
.nyc_output
|
|
61
|
-
|
|
62
|
-
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
|
|
63
|
-
.grunt
|
|
64
|
-
|
|
65
|
-
# node-waf configuration
|
|
66
|
-
.lock-wscript
|
|
67
|
-
|
|
68
|
-
# Compiled binary addons (http://nodejs.org/api/addons.html)
|
|
69
|
-
build/Release
|
|
70
|
-
|
|
71
|
-
# Dependency directories
|
|
72
|
-
node_modules
|
|
73
|
-
jspm_packages
|
|
74
|
-
|
|
75
|
-
# Optional npm cache directory
|
|
76
|
-
.npm
|
|
77
|
-
|
|
78
|
-
# Optional REPL history
|
|
79
|
-
.node_repl_history
|
|
80
|
-
.next
|
|
81
|
-
|
|
82
|
-
scratch
|
|
83
|
-
|
|
84
|
-
# visual studio code
|
|
85
|
-
.vscode/
|
|
86
|
-
|
|
87
|
-
src/gql/graphql.js
|
|
88
|
-
.yalc/
|
|
89
|
-
yalc.lock
|
|
90
|
-
|
|
91
|
-
.last-run.json
|
|
92
|
-
|
|
93
|
-
test-results
|
|
94
|
-
coverage-reports
|
|
95
|
-
.sonar
|
|
96
|
-
.v8-coverage
|
|
97
|
-
/assets
|
|
98
|
-
tests/lib/data/auth.json
|
|
99
|
-
|
|
100
|
-
failed-tests.json
|
|
101
|
-
|
|
102
|
-
/tmp
|
|
103
|
-
|
|
104
|
-
.claude
|
|
105
|
-
.claude/settings.local.json
|
|
106
|
-
|
|
107
|
-
.run
|
|
108
|
-
|
|
109
|
-
.pnpm-store
|