@docupace/pipeline 1.0.137-alpha.0 → 1.0.137

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/README.md CHANGED
@@ -51,28 +51,20 @@ dp-next-cli [command] [options]
51
51
  - `-j, --jira-ticket [jiraTicket]`: JIRA ticket (optional)
52
52
  - `-c, --deploy-core <deployCore>`: Deploy Core (default: "false")
53
53
  - `-C, --deploy-connect <deployConnect>`: Deploy Connect (default: "false")
54
- - `-A, --deploy-connect-aws <deployConnectAws>`: Deploy Connect UI on AWS via `dp-eks-connect-ui-gitops` (default: "false")
55
54
  - `update-site-version <env> <site>`: Update specific version components for a site
56
55
  - `-u, --ui-version <uiVersion>`: UI image tag
57
56
  - `-g, --graph-version <graphVersion>`: GraphQL-server image tag
58
57
  - `-S, --standard-config <standardConfig>`: Standard config remote branch
59
58
  - `-s, --site-config <siteConfig>`: Site config remote branch
60
- - `-c, --connect-version <connectVersion>`: AWS Connect UI image tag (optional)
61
59
  - `-j, --jira-ticket [jiraTicket]`: JIRA ticket (required for prod)
62
60
  - `deploy-template`: Deploy an application for a specific site
63
61
  - `deploy-app <application>`: Deploy an application for a specific site
64
- - `deploy-app connect -e <env> -s <site>`: Deploy AWS Connect UI (triggers `deploy-connect-aws` / gitops `update-site-image`)
65
- - `-e, --env <env>` / `-s, --site <site>`: Target env/site (optional; otherwise uses auto-deploy targets)
66
62
  - `deploy-core <env> <site>`: Deploy Core
67
63
  - `-l, --liquibase <liquibase>`: Application name (default: "true")
68
64
  - `-b, --branch <branch>`: Branch (default: "master")
69
65
  - `deploy-connect <env> <site>`: Deploy Connect
70
66
  - `-l, --liquibase <liquibase>`: Application name (default: "true")
71
67
  - `-b, --branch <branch>`: Branch (default: "master")
72
- - `deploy-connect-aws <env> <sites> <version>`: Deploy Connect UI on AWS (updates `dp-eks-connect-ui-gitops` image.tag via Bitbucket pipeline)
73
- - `<sites>`: single site or comma-separated list (e.g. `oa` or `oa,athene,template`)
74
- - `-b, --branch <branch>`: Gitops branch for the pipeline (default: "main")
75
- - `-w, --wait` / `--no-wait`: Wait for pipeline completion (default: wait)
76
68
  - `deploy-core-pipeline <env> <site>`: Deploy Core via pipeline
77
69
  - `-l, --liquibase <liquibase>`: Application name (default: "true")
78
70
  - `-b, --branch <branch>`: Branch (default: "master")
@@ -195,13 +187,6 @@ dp-changeset-cli create-changeset
195
187
 
196
188
  # Configure Auth0 for a site
197
189
  dp-auth0-cli configureFromSite sourceSite targetSite dev prod true true true false
198
-
199
- # Deploy Connect UI image tag on AWS (single site or comma-separated sites)
200
- dp-next-cli deploy-connect-aws qa 1stglobal 4.75.52
201
- dp-next-cli deploy-connect-aws qa oa,athene,template 4.75.52
202
-
203
- # Promote AWS Connect UI version from one site to another via deploy-from-site
204
- dp-next-cli deploy-from-site -f dev -t qa -F template -T template -A true
205
190
  ```
206
191
 
207
192
  ## License
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@docupace/pipeline",
3
- "version": "1.0.137-alpha.0",
3
+ "version": "1.0.137",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "type": "module",
package/src/next/cli.js CHANGED
@@ -20,7 +20,6 @@ import { connectClone } from './connect.js';
20
20
  import dotenv from 'dotenv';
21
21
  import { $ } from 'zx';
22
22
  import { deployConnect, deployCore } from './jenkins.js';
23
- import { deployConnectAws } from './connect-aws.js';
24
23
  import { runPipeline } from './pipline.js';
25
24
 
26
25
  dotenv.config({ path: ['.env.pipeline.local', 'config/.env.pipeline.local'] });
@@ -94,11 +93,6 @@ program
94
93
  .option('-j, --jira-ticket [jiraTicket]', 'JIRA ticket (optional)')
95
94
  .option('-c, --deploy-core <deployCore>', 'Deploy Core', 'false')
96
95
  .option('-C, --deploy-connect <deployConnect>', 'Deploy Connect', 'false')
97
- .option(
98
- '-A, --deploy-connect-aws <deployConnectAws>',
99
- 'Deploy Connect UI on AWS (dp-eks-connect-ui-gitops)',
100
- 'false',
101
- )
102
96
  .action(async (options) => {
103
97
  const {
104
98
  fromEnv,
@@ -107,7 +101,6 @@ program
107
101
  toSite,
108
102
  deployCore,
109
103
  deployConnect,
110
- deployConnectAws: deployConnectAwsFlag,
111
104
  jiraTicket,
112
105
  } = options;
113
106
  await deployFromSite(
@@ -118,7 +111,6 @@ program
118
111
  deployCore,
119
112
  deployConnect,
120
113
  jiraTicket,
121
- deployConnectAwsFlag,
122
114
  );
123
115
  });
124
116
 
@@ -132,20 +124,10 @@ program
132
124
  'Standard config remote branch',
133
125
  )
134
126
  .option('-s, --site-config <siteConfig>', 'Site config remote branch')
135
- .option(
136
- '-c, --connect-version <connectVersion>',
137
- 'AWS Connect UI image tag (triggers deploy-connect-aws)',
138
- )
139
127
  .option('-j, --jira-ticket [jiraTicket]', 'JIRA ticket (required for prod)')
140
128
  .action(async (env, site, options) => {
141
- const {
142
- uiVersion,
143
- graphVersion,
144
- standardConfig,
145
- siteConfig,
146
- connectVersion,
147
- jiraTicket,
148
- } = options;
129
+ const { uiVersion, graphVersion, standardConfig, siteConfig, jiraTicket } =
130
+ options;
149
131
  await updateSiteVersion(
150
132
  env,
151
133
  site,
@@ -154,7 +136,6 @@ program
154
136
  standardConfig,
155
137
  siteConfig,
156
138
  jiraTicket,
157
- connectVersion,
158
139
  );
159
140
  });
160
141
 
@@ -193,9 +174,7 @@ program
193
174
 
194
175
  program
195
176
  .command('deploy-app <application>')
196
- .description(
197
- 'Deploy an application for a specific site (use application "connect" for AWS Connect UI)',
198
- )
177
+ .description('Deploy an application for a specific site')
199
178
  .option('-e, --env <env>', 'Target environment (overrides default sites)')
200
179
  .option('-s, --site <site>', 'Target site (overrides default sites)')
201
180
  .action(async (application, options) => {
@@ -204,19 +183,6 @@ program
204
183
  options.env && options.site
205
184
  ? [{ env: options.env, site: options.site }]
206
185
  : await getDefaultDeploySite(deployTag);
207
-
208
- // Batch Connect AWS updates into one pipeline run per env (comma-separated sites).
209
- if (application === 'connect') {
210
- const sitesByEnv = sites.reduce((acc, { env, site }) => {
211
- (acc[env] ??= []).push(site);
212
- return acc;
213
- }, {});
214
- for (const [env, envSites] of Object.entries(sitesByEnv)) {
215
- await deployAppWithTag('connect', env, envSites.join(','), deployTag);
216
- }
217
- return;
218
- }
219
-
220
186
  for (const { env, site } of sites) {
221
187
  await deployAppWithTag(application, env, site, deployTag);
222
188
  }
@@ -257,21 +223,6 @@ program
257
223
  await deployConnect(env, site, options.liquibase, options.branch);
258
224
  });
259
225
 
260
- program
261
- .command('deploy-connect-aws <env> <sites> <version>')
262
- .description(
263
- 'Deploy Connect UI on AWS by updating image.tag via dp-eks-connect-ui-gitops pipeline',
264
- )
265
- .option('-b, --branch <branch>', 'Gitops branch to run pipeline on', 'main')
266
- .option('-w, --wait', 'Wait for the pipeline to complete', true)
267
- .option('--no-wait', 'Do not wait for the pipeline to complete')
268
- .action(async (env, sites, version, options) => {
269
- await deployConnectAws(env, sites, version, {
270
- wait: options.wait,
271
- branch: options.branch,
272
- });
273
- });
274
-
275
226
  program
276
227
  .command('deploy-core-pipeline <env> <site>')
277
228
  .description('Deploy Core')
@@ -17,11 +17,6 @@ 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';
25
20
 
26
21
  /**
27
22
  * Clone the repository, read the YAML file, and return the parsed data and file paths.
@@ -437,14 +432,6 @@ export async function deployTemplate(
437
432
  export async function deployAppWithTag(application, env, site, deployTag) {
438
433
  console.log(`Deploying application: ${application} for site: ${site}`);
439
434
  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
-
448
435
  const appDetails = appInfo[application] ?? getDefaultAppInfo(application);
449
436
  if (!appInfo[application]) {
450
437
  console.log(
@@ -860,17 +847,10 @@ export async function updateSiteVersion(
860
847
  standardConfig,
861
848
  siteConfig,
862
849
  jiraTicket,
863
- connectVersion,
864
850
  ) {
865
- if (
866
- !uiVersion &&
867
- !graphVersion &&
868
- !standardConfig &&
869
- !siteConfig &&
870
- !connectVersion
871
- ) {
851
+ if (!uiVersion && !graphVersion && !standardConfig && !siteConfig) {
872
852
  console.error(
873
- '❌ At least one of --ui-version, --graph-version, --standard-config, --site-config, or --connect-version must be provided',
853
+ '❌ At least one of --ui-version, --graph-version, --standard-config, or --site-config must be provided',
874
854
  );
875
855
  process.exit(1);
876
856
  }
@@ -964,15 +944,6 @@ export async function updateSiteVersion(
964
944
  }
965
945
  }
966
946
 
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
-
976
947
  const toRepoPath = await cloneEnvRepository(env);
977
948
 
978
949
  if (env !== 'dev') {
@@ -1118,44 +1089,6 @@ export async function updateSiteVersion(
1118
1089
  } else {
1119
1090
  console.log('No changes detected. Nothing to push.');
1120
1091
  }
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
- }
1159
1092
  }
1160
1093
 
1161
1094
  export async function deployFromSite(
@@ -1166,7 +1099,6 @@ export async function deployFromSite(
1166
1099
  isDeployCore,
1167
1100
  isDeployConnect,
1168
1101
  jiraTicket,
1169
- isDeployConnectAws = 'false',
1170
1102
  ) {
1171
1103
  console.log(
1172
1104
  `Deploying changes from ${fromSite} in ${fromEnv} to ${toSite} in ${toEnv}${jiraTicket ? ` approved by JIRA ticket ${jiraTicket}` : ''}`,
@@ -1304,31 +1236,6 @@ export async function deployFromSite(
1304
1236
  }
1305
1237
  }
1306
1238
 
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
-
1332
1239
  // Clone repositories for source and target environments
1333
1240
  const fromRepoPath = await cloneEnvRepository(fromEnv);
1334
1241
  const toRepoPath =
@@ -1,88 +0,0 @@
1
- import { runPipeline } from './pipline.js';
2
-
3
- export const CONNECT_AWS_GITOPS_REPO = 'dp-eks-connect-ui-gitops';
4
- export const CONNECT_AWS_UPDATE_PIPELINE = 'update-site-image';
5
- export const CONNECT_AWS_DEFAULT_BRANCH = 'main';
6
-
7
- const ALLOWED_ENVS = new Set(['dev', 'qa', 'stage', 'uat', 'prod']);
8
- const SITE_PATTERN = /^[A-Za-z0-9][A-Za-z0-9._-]*$/;
9
- const VERSION_PATTERN = /^[A-Za-z0-9][A-Za-z0-9._+-]*$/;
10
-
11
- /**
12
- * Normalize sites input to a non-empty list of site names.
13
- * Accepts a single site string, comma-separated string, or string[].
14
- *
15
- * @param {string|string[]} sites
16
- * @returns {string[]}
17
- */
18
- export function normalizeConnectAwsSites(sites) {
19
- const raw = Array.isArray(sites) ? sites : String(sites ?? '').split(',');
20
- return raw.map((s) => String(s).trim()).filter(Boolean);
21
- }
22
-
23
- /**
24
- * Trigger the Bitbucket custom pipeline that updates
25
- * envs/<env>/<site>/values.yaml image.tag in dp-eks-connect-ui-gitops.
26
- *
27
- * @param {string} env - Target environment (dev|qa|stage|uat|prod)
28
- * @param {string|string[]} sites - Site name, or comma-separated / array of sites
29
- * @param {string} version - Image tag to deploy
30
- * @param {{ wait?: boolean, branch?: string }} [options]
31
- */
32
- export async function deployConnectAws(
33
- env,
34
- sites,
35
- version,
36
- { wait = true, branch = CONNECT_AWS_DEFAULT_BRANCH } = {},
37
- ) {
38
- const siteList = normalizeConnectAwsSites(sites);
39
- validateConnectAwsArgs(env, siteList, version);
40
-
41
- const siteParam = siteList.join(',');
42
- console.log(
43
- `Deploying AWS Connect UI: env=${env} site(s)=${siteParam} version=${version} (pipeline=${CONNECT_AWS_UPDATE_PIPELINE})`,
44
- );
45
-
46
- await runPipeline(
47
- CONNECT_AWS_GITOPS_REPO,
48
- CONNECT_AWS_UPDATE_PIPELINE,
49
- branch,
50
- {
51
- ENV: env,
52
- SITE: siteParam,
53
- VERSION: version,
54
- },
55
- wait,
56
- );
57
- }
58
-
59
- /**
60
- * @param {string} env
61
- * @param {string|string[]} sites - single site, comma-separated, or array
62
- * @param {string} version
63
- */
64
- export function validateConnectAwsArgs(env, sites, version) {
65
- if (!ALLOWED_ENVS.has(env)) {
66
- throw new Error(
67
- `Invalid env "${env}". Expected one of: ${[...ALLOWED_ENVS].join(', ')}`,
68
- );
69
- }
70
-
71
- const siteList = normalizeConnectAwsSites(sites);
72
- if (siteList.length === 0) {
73
- throw new Error('At least one site is required');
74
- }
75
- for (const site of siteList) {
76
- if (!SITE_PATTERN.test(site)) {
77
- throw new Error(`Invalid site "${site}"`);
78
- }
79
- }
80
-
81
- if (!version || !VERSION_PATTERN.test(version)) {
82
- throw new Error(`Invalid version "${version}"`);
83
- }
84
- }
85
-
86
- export function isAllowedConnectAwsEnv(env) {
87
- return ALLOWED_ENVS.has(env);
88
- }
@@ -1,131 +0,0 @@
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
- });