@docupace/pipeline 1.0.39-newrelease.11 → 1.0.39-newrelease.13

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@docupace/pipeline",
3
- "version": "1.0.39-newrelease.11",
3
+ "version": "1.0.39-newrelease.13",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "type": "module",
package/src/auth0/cli.js CHANGED
@@ -15,7 +15,7 @@ const program = new Command();
15
15
 
16
16
  program
17
17
  .command(
18
- 'configureFromSite <fromSite> <toSite> <fromEnv> <toEnv> <deployUI> <deployGraphQLServer> <useNewDomain> <useS3>',
18
+ 'configureFromSite <fromSite> <toSite> <fromEnv> <toEnv> <deployUI> <deployGraphQLServer> <useNewDomain> <useS3> <deployCCUI>',
19
19
  )
20
20
  .description('Configure the Auth0 tenants in env for the given site')
21
21
  .action(
@@ -28,6 +28,7 @@ program
28
28
  deployGraphQLServer,
29
29
  useNewDomain,
30
30
  useS3,
31
+ deployCCUI,
31
32
  ) => {
32
33
  await configureFromSite(
33
34
  fromSite,
@@ -38,6 +39,7 @@ program
38
39
  deployGraphQLServer,
39
40
  useNewDomain,
40
41
  useS3 === 'true' || useS3 === true,
42
+ deployCCUI,
41
43
  );
42
44
  },
43
45
  );
@@ -57,6 +57,7 @@ export async function getAuth0AuthToken(auth0Domain, clientId, clientSecret) {
57
57
  async function configureUI(
58
58
  siteHost,
59
59
  coreURL,
60
+ connectURL,
60
61
  docupaceHost,
61
62
  site,
62
63
  env,
@@ -74,6 +75,7 @@ async function configureUI(
74
75
  );
75
76
  siteHost = siteHost.replace('https://', '');
76
77
  coreURL = coreURL.replace('https://', '');
78
+ connectURL = connectURL.replace('https://', '');
77
79
 
78
80
  try {
79
81
  const auth0Response = await axios.get(
@@ -129,7 +131,7 @@ uiMain:
129
131
  auth0ClientId: vault:secret/data/${site}/ui/config#AUTH0_CLIENT_ID
130
132
  graphqlClientUrl: https://${siteHost}/api/graphql
131
133
  graphqlServerUrl: https://${siteHost}/api/graphql
132
- connectUrl: https://${siteHost}
134
+ connectUrl: https://${connectURL}
133
135
  coreUrl: https://${coreURL}
134
136
  env:
135
137
  AUTH0_CLIENT_SECRET: vault:secret/data/${site}/ui/config#AUTH0_CLIENT_SECRET
@@ -244,6 +246,167 @@ externalConnectService:
244
246
  }
245
247
  }
246
248
 
249
+ async function configureCCUI(
250
+ siteHost,
251
+ coreURL,
252
+ connectURL,
253
+ docupaceHost,
254
+ site,
255
+ env,
256
+ auth0Domain,
257
+ auth0ClientId,
258
+ auth0ClientSecret,
259
+ auth0Token,
260
+ vaultSiteSecretsPath,
261
+ imageTag,
262
+ repoPath,
263
+ useS3,
264
+ ccUrl,
265
+ ) {
266
+ console.log(
267
+ `Configuring CC UI for site: ${site} Host: ${siteHost} in env: ${env}`,
268
+ );
269
+ siteHost = siteHost.replace('https://', '');
270
+ coreURL = coreURL.replace('https://', '');
271
+ connectURL = connectURL.replace('https://', '');
272
+ ccUrl = ccUrl.replace('https://', '');
273
+
274
+ try {
275
+ const auth0Response = await axios.get(
276
+ `https://${auth0Domain}/api/v2/clients`,
277
+ {
278
+ headers: { authorization: `Bearer ${auth0Token}` },
279
+ },
280
+ );
281
+
282
+ const uiClient = auth0Response.data.find(
283
+ (client) => client.name === 'docupace-ui-cc',
284
+ );
285
+ const uiAuth0ClientId = uiClient.client_id;
286
+ const uiAuth0ClientSecret = uiClient.client_secret;
287
+
288
+ // Generate Auth0 Secret
289
+ const uiAuth0Secret = crypto
290
+ .randomBytes(48)
291
+ .toString('base64')
292
+ .replace(/[^a-zA-Z0-9]/g, '');
293
+
294
+ // Prepare data payload
295
+ console.log('Preparing Vault CC UI data payload...');
296
+ const ccUISecretData = JSON.stringify({
297
+ data: {
298
+ AUTH0_CLIENT_ID: uiAuth0ClientId,
299
+ AUTH0_CLIENT_SECRET: uiAuth0ClientSecret,
300
+ AUTH0_SECRET: uiAuth0Secret,
301
+ },
302
+ });
303
+ console.log('Updating Vault Site Secret =>', vaultSiteSecretsPath);
304
+ await updateVaultSecrets(vaultSiteSecretsPath, ccUISecretData);
305
+
306
+ let siteAWSSecrets = null;
307
+
308
+ if (useS3 === true || useS3 === 'true') {
309
+ const siteAWSSecretsPath = getVaultSecretsConfigs(site).awsSecretsPath;
310
+ siteAWSSecrets = await getVaultSecrets(siteAWSSecretsPath);
311
+ console.log(`siteAWSSecretsPath => ${siteAWSSecretsPath}`);
312
+ }
313
+
314
+ // Prepare cc.app.yaml
315
+ const uiССAppYaml = `
316
+ repo: docupace-ui-main
317
+ revision: master
318
+ `.trim();
319
+ // Prepare cc.values.yaml
320
+ const uiССValuesYaml = `
321
+ uiMain:
322
+ auth0BaseUrl: https://${ccUrl}
323
+ auth0IssuerBaseUrl: https://${auth0Domain}
324
+ auth0ClientId: vault:secret/data/${site}/ui-cc/config#AUTH0_CLIENT_ID
325
+ graphqlClientUrl: https://${siteHost}/api/graphql
326
+ graphqlServerUrl: https://${siteHost}/api/graphql
327
+ connectUrl: https://${connectURL}
328
+ coreUrl: https://${coreURL}
329
+ env:
330
+ AUTH0_AUDIENCE: core-api-access
331
+ AUTH0_CLIENT_SECRET: vault:secret/data/${site}/ui-cc/config#AUTH0_CLIENT_SECRET
332
+ AUTH0_SECRET: vault:secret/data/${site}/ui-cc/config#AUTH0_SECRET
333
+ ${
334
+ useS3 === true || useS3 === 'true'
335
+ ? `
336
+ AWS_ACCESS_KEY_ID: vault:secret/data/${site}/aws/config#AWS_ACCESS_KEY_ID
337
+ AWS_BUCKET_NAME: vault:secret/data/${site}/aws/config#AWS_BUCKET_NAME
338
+ AWS_SECRET_ACCESS_KEY: vault:secret/data/${site}/aws/config#AWS_SECRET_ACCESS_KEY
339
+ image:
340
+ repository: registry.paperout.com/docupace-ui-main-dev-docker-local/cc-ui-app
341
+ tag: ${imageTag}
342
+ imagePullSecrets:
343
+ - name: jf-artifactory
344
+ ingress:
345
+ enabled: true
346
+ className: nginx
347
+ annotations:
348
+ external-dns.alpha.kubernetes.io/hostname: ${ccUrl}
349
+ external-dns.alpha.kubernetes.io/zone: public
350
+ cert-manager.io/cluster-issuer: letsencrypt
351
+ nginx.ingress.kubernetes.io/proxy-buffer-size: 128k
352
+ hosts:
353
+ - host: ${ccUrl}
354
+ paths:
355
+ - path: /
356
+ pathType: Prefix
357
+ tls:
358
+ - hosts:
359
+ - ${ccUrl}
360
+ secretName: dp-cc-ui-cert
361
+ `.trim()
362
+ : ''
363
+ }
364
+ ${
365
+ useS3 === true || useS3 === 'true'
366
+ ? `
367
+ serviceAccount:
368
+ create: true
369
+ annotations:
370
+ eks.amazonaws.com/role-arn: arn:aws:iam::${siteAWSSecrets.AWS_ACCOUNT_ID}:role/eks-pod-identity-connect-next-${env}-${site}-bucket
371
+ `.trim()
372
+ : ''
373
+ }
374
+ `.trim();
375
+
376
+ console.log('Writing configuration files...');
377
+ await ensureDirectoryExists(path.resolve(`${repoPath}/dp/${site}`));
378
+
379
+ await fs.writeFile(
380
+ `${repoPath}/dp/${site}/cc.app.yaml`,
381
+ uiССAppYaml,
382
+ (err) => {
383
+ if (err) {
384
+ console.error('Failed to write the file:', err);
385
+ } else {
386
+ console.log('File written successfully.');
387
+ }
388
+ },
389
+ );
390
+
391
+ await fs.writeFile(
392
+ `${repoPath}/dp/${site}/cc.values.yaml`,
393
+ uiССValuesYaml,
394
+ (err) => {
395
+ if (err) {
396
+ console.error('Failed to write the file:', err);
397
+ } else {
398
+ console.log('File written successfully.');
399
+ }
400
+ },
401
+ );
402
+ console.log('Done!');
403
+ console.log('Updating Core Site Config...');
404
+ await updateCoreSiteConfig(site, env, useS3);
405
+ } catch (error) {
406
+ console.error('Error configuring UI:', error);
407
+ }
408
+ }
409
+
247
410
  export async function cleanAndWritePropertiesFile(configPath, content) {
248
411
  try {
249
412
  const cleanedContent = content
@@ -456,6 +619,7 @@ export async function configureFromSite(
456
619
  deployGraphQLServer,
457
620
  useNewDomain,
458
621
  useS3,
622
+ deployCCUI,
459
623
  ) {
460
624
  console.log(
461
625
  `Configuring Auth0 tenants and ArgoCD apps for site: ${toSite} in env: ${toEnv} from site: ${fromSite}`,
@@ -480,10 +644,14 @@ export async function configureFromSite(
480
644
  auth0ClientSecret,
481
645
  );
482
646
 
483
- // UI app
647
+ // UI MAIN app
484
648
  const uiSecretsPath = getVaultSecretsConfigs(toSite).uiSecretsPath;
485
649
  console.log(`uiSecretsPath => ${uiSecretsPath}`);
486
650
 
651
+ // UI CC app
652
+ const ccUISecretsPath = getVaultSecretsConfigs(toSite).ccUISecretsPath;
653
+ console.log(`ccUISecretsPath => ${ccUISecretsPath}`);
654
+
487
655
  // GraphQL-Server app
488
656
  const graphqlSecretsPath =
489
657
  getVaultSecretsConfigs(toSite).graphqlServerSecretsPath;
@@ -533,17 +701,22 @@ export async function configureFromSite(
533
701
  const envConfig = environmentConfig[toEnv];
534
702
 
535
703
  let CORE_URL, SITE_HOST, CORE_API_CONTEXT, CONNECT_URL, DOCUPACE_HOST;
536
- if (useNewDomain) {
704
+ const newUrl = envConfig.newUrl(toSite);
705
+ const ccUrl = envConfig.ccUrl(toSite);
706
+
707
+ SITE_HOST = `${newUrl}`;
708
+
709
+ if (useNewDomain === true || useNewDomain === 'true') {
537
710
  const newUrl = envConfig.newUrl(toSite);
538
711
  CORE_URL = `${newUrl}/core`;
539
- SITE_HOST = newUrl;
712
+ // SITE_HOST = newUrl;
540
713
  CORE_API_CONTEXT = 'core';
541
714
  CONNECT_URL = `${newUrl}/connect`;
542
715
  DOCUPACE_HOST = envConfig.docupaceHost();
543
716
  } else {
544
717
  const oldUrl = envConfig.oldUrl(toSite);
545
718
  CORE_URL = oldUrl;
546
- SITE_HOST = oldUrl;
719
+ // SITE_HOST = oldUrl;
547
720
  CORE_API_CONTEXT = toSite;
548
721
  CONNECT_URL = `${oldUrl}_ui`;
549
722
  }
@@ -552,6 +725,7 @@ export async function configureFromSite(
552
725
  await configureUI(
553
726
  SITE_HOST,
554
727
  CORE_URL,
728
+ CONNECT_URL,
555
729
  DOCUPACE_HOST,
556
730
  toSite,
557
731
  toEnv,
@@ -566,6 +740,26 @@ export async function configureFromSite(
566
740
  );
567
741
  }
568
742
 
743
+ if (deployCCUI === true || deployCCUI === 'true') {
744
+ await configureCCUI(
745
+ SITE_HOST,
746
+ CORE_URL,
747
+ CONNECT_URL,
748
+ DOCUPACE_HOST,
749
+ toSite,
750
+ toEnv,
751
+ auth0Domain,
752
+ auth0ClientId,
753
+ auth0ClientSecret,
754
+ auth0Token,
755
+ ccUISecretsPath,
756
+ uiImageTag,
757
+ repoPathToEnv,
758
+ useS3,
759
+ ccUrl,
760
+ );
761
+ }
762
+
569
763
  await configureGraphQLServer(
570
764
  SITE_HOST,
571
765
  CORE_URL,
@@ -25,6 +25,7 @@ export async function uploadToCanny(releaseNote, labelIDs) {
25
25
  releaseNote.userFacingDescription &&
26
26
  releaseNote.userFacingDescription.__line.trim()
27
27
  ) {
28
+ content += `${releaseNote.summary}\n\n`;
28
29
  content += `${releaseNote.userFacingDescription.__line}\n\n`;
29
30
  } else {
30
31
  content += `${releaseNote.summary}\n\n`;
@@ -89,8 +89,8 @@ async function fetchNewLink(oldLink, params) {
89
89
  } else {
90
90
  const changes = getChanges(params);
91
91
  const labels = getLabels(changes);
92
- const labelIDs = getLabelIDs(labels);
93
92
  const jiraVersions = getJiraVersions(changes);
93
+ const labelIDs = getLabelIDs([...labels, ...jiraVersions]);
94
94
  const data = await uploadToCanny(releaseNote, labelIDs);
95
95
  await updateJiraReleaseNotes(
96
96
  releaseNote.ticketId,
@@ -1,11 +1,17 @@
1
1
  export const componentConfig = {
2
- '@docupace/enterprise-ui-app': 'Enterprise',
3
- '@docupace/cc-ui-app': 'C & C',
2
+ '@docupace/enterprise-ui-app': 'Enterprise Application',
3
+ '@docupace/cc-ui-app': 'C & C Application',
4
4
  '@docupace/core': 'Enterprise Core',
5
- '@docupace/graphql-server': 'Enterprise',
5
+ '@docupace/graphql-server': 'GraphQL Server',
6
+ '@docupace/enterprise-template': 'Enterprise Configuration',
7
+ '@docupace/cc-template': 'CC Configuration',
6
8
  };
7
9
 
8
10
  export const labelIDMap = {
9
11
  Enterprise: '6836d53ad8622b2abab1fbd9',
10
12
  'Enterprise Core': '6836d532716bbe32f53661fb',
13
+ 'Enterprise Core - 25.0': '68400cea3c20ce44785cca3e',
14
+ 'Enterprise Core - 25.1': '68401502fa2d977cfcd6e102',
15
+ 'Enterprise Core - 25.2': '6840151b0915e310b1766005',
16
+ 'Enterprise Core - 25.3': '684018c7f11b9e5d5d24936f',
11
17
  };
@@ -60,10 +60,9 @@ async function writeChangesetFile(
60
60
  .map((pkg) => `'${pkg.name}': ${changeType}`)
61
61
  .join('\n');
62
62
 
63
- const relYamlFilePath = path.relative(
64
- path.resolve(process.cwd(), '.changeset'),
65
- yamlFilePath,
66
- );
63
+ const relYamlFilePath = path
64
+ .relative(path.resolve(process.cwd(), '.changeset'), yamlFilePath)
65
+ .replaceAll('\\', '/');
67
66
 
68
67
  const changesetContent = `---
69
68
  ${packageEntries}
@@ -17,7 +17,7 @@ const changeSetPackage = `{
17
17
  "dependencies": {},
18
18
  "devDependencies": {
19
19
  "@changesets/cli": "^2.27.10",
20
- "@docupace/pipeline": "1.0.39-newrelease.11"
20
+ "@docupace/pipeline": "1.0.39-newrelease.13"
21
21
  }
22
22
  }
23
23
  `;
package/src/next/cli.js CHANGED
@@ -11,7 +11,7 @@ import {
11
11
  getDefaultDeploySite,
12
12
  getDeployTag,
13
13
  } from './deploy.js';
14
- import { copy } from './copy.js';
14
+ import { copy, copy2 } from './copy.js';
15
15
  import { vaultAddSiteData } from './vault.js';
16
16
  import { addApacheSite } from './apache.js';
17
17
  import { haproxySync } from './haproxy.js';
@@ -176,13 +176,14 @@ program
176
176
  program
177
177
  .command('copy')
178
178
  .description('Copy a Docker image between registries')
179
- .requiredOption('-a, --application <application>', 'Application name')
179
+ .requiredOption('-r, --repository <repository>', 'Repostory name')
180
180
  .requiredOption('-f, --from-env <fromEnv>', 'Source environment')
181
181
  .requiredOption('-t, --to-env <toEnv>', 'Target environment')
182
182
  .requiredOption('-g, --tag <tag>', 'Image tag')
183
+ .requiredOption('-a, --application <application>', 'Application name')
183
184
  .action(async (options) => {
184
- const { application, fromEnv, toEnv, tag } = options;
185
- await copy(application, fromEnv, toEnv, tag);
185
+ const { repository, fromEnv, toEnv, tag, application } = options;
186
+ await copy2(repository, fromEnv, toEnv, tag, application);
186
187
  });
187
188
 
188
189
  program
@@ -9,41 +9,66 @@ export const environmentConfig = {
9
9
  newUrl: (site) => `https://${site}.dev.dpai.tech`,
10
10
  oldUrl: (site) => `https://www.dev.docupaceinc.com/${site}`,
11
11
  docupaceHost: () => 'www.dev.docupaceinc.com',
12
+ ccUrl: (site) => `https://${site}-cc.dev.dpai.tech`,
12
13
  },
13
14
  qa: {
14
15
  newUrl: (site) => `https://${site}.qa.dpai.tech`,
15
16
  oldUrl: (site) => `https://www.preprod.docupaceinc.com/${site}`,
16
17
  docupaceHost: () => 'www.preprod.docupaceinc.com',
18
+ ccUrl: (site) => `https://${site}-cc.qa.dpai.tech`,
17
19
  },
18
20
  uat: {
19
- newUrl: (site) => `https://${site}.qa.dpai.tech`,
21
+ newUrl: (site) => `https://${site}.uat.dpai.tech`,
20
22
  oldUrl: (site) => `https://www2.paperout.com/${site}_uat`,
21
23
  docupaceHost: () => 'www2.paperout.com',
24
+ ccUrl: (site) => `https://${site}-cc.uat.dpai.tech`,
22
25
  },
23
26
  stage: {
24
- newUrl: (site) => `https://${site}.stage.dpai.tech`,
27
+ newUrl: (site) => `https://${site}.stg.dpai.tech`,
25
28
  oldUrl: (site) => `https://www2.paperout.com/${site}_staging`,
26
29
  docupaceHost: () => 'www2.paperout.com',
30
+ ccUrl: (site) => `https://${site}-cc.stg.dpai.tech`,
27
31
  },
28
32
  prod: {
29
33
  newUrl: (site) => `https://${site}.dpai.tech`,
30
34
  oldUrl: (site) => `https://www2.paperout.com/${site}`,
31
35
  docupaceHost: () => 'www2.paperout.com',
36
+ ccUrl: (site) => `https://${site}-cc.dpai.tech`,
32
37
  },
33
38
  };
34
39
 
35
40
  export const appInfo = {
36
41
  'graphql-server': {
37
42
  repositoryName: 'docupace-graphql-server',
43
+ imageName: 'docupace-graphql-server',
38
44
  deployAttributes: [
39
45
  'image.tag',
40
46
  'graphqlServer.siteConfigRemoteBranch',
41
47
  'graphqlServer.standardConfigRemoteBranch',
42
48
  ],
43
49
  },
50
+ cc: {
51
+ repositoryName: 'docupace-ui-main',
52
+ imageName: 'cc-ui-app',
53
+ deployAttributes: ['image.tag'],
54
+ getAppRevision: (config) => {
55
+ const version = config.image.tag.slice(1);
56
+ return 'cc-ui-app@' + version;
57
+ },
58
+ },
44
59
  ui: {
45
60
  repositoryName: 'docupace-ui-main',
61
+ imageName: 'enterprise-ui-app',
46
62
  deployAttributes: ['image.tag'],
63
+ getAppRevision: (config) => {
64
+ const tag = config.image.tag;
65
+ const version = tag.startsWith('v') ? tag.slice(1) : tag;
66
+ if (semver.gt(version, UI_MONO_VERSION)) {
67
+ return 'enterprise-ui-app@' + version;
68
+ } else {
69
+ return tag;
70
+ }
71
+ },
47
72
  updateConfigFunction: (config) => {
48
73
  if (config.image.repository.endsWith('/docupace-ui-main')) {
49
74
  const tag = config.image.tag;
@@ -96,6 +121,7 @@ export const getVaultSecretsConfigs = (site) => {
96
121
  siteCommonSecretsPath: `secret/data/${site}/common/config`,
97
122
  graphqlServerSecretsPath: `secret/data/${site}/graphql-server/config`,
98
123
  uiSecretsPath: `secret/data/${site}/ui/config`,
124
+ ccUISecretsPath: `secret/data/${site}/ui-cc/config`,
99
125
  awsSecretsPath: `secret/data/${site}/aws/config`,
100
126
  };
101
127
  };
package/src/next/copy.js CHANGED
@@ -11,7 +11,7 @@ export async function copy(application, fromEnv, toEnv, tag) {
11
11
  const repositoryName = appInfo[application].repositoryName;
12
12
  const fromRegistry = `${jfRegistryUrl}/${repositoryName}-${fromEnv}-docker-local`;
13
13
  const toRegistry = `${jfRegistryUrl}/${repositoryName}-${toEnv}-docker-local`;
14
- const imageName = `${repositoryName}:${tag}`;
14
+ const imageName = `${appInfo[application].imageName}:${tag}`;
15
15
  const fromFullImageName = `${fromRegistry}/${imageName}`;
16
16
  const toFullImageName = `${toRegistry}/${imageName}`;
17
17
 
@@ -29,14 +29,20 @@ export async function copy(application, fromEnv, toEnv, tag) {
29
29
  await $`docker push ${toFullImageName}`;
30
30
  }
31
31
 
32
- export async function copy2(repositoryName, fromEnv, toEnv, tag) {
32
+ export async function copy2(
33
+ repositoryName,
34
+ fromEnv,
35
+ toEnv,
36
+ tag,
37
+ applicationName,
38
+ ) {
33
39
  console.log(
34
40
  `Copying repository ${repositoryName} from ${fromEnv} to ${toEnv} for tag ${tag}`,
35
41
  );
36
42
  const envInfo = getEnvInfo();
37
43
  const fromRegistry = `${jfRegistryUrl}/${repositoryName}-${fromEnv}-docker-local`;
38
44
  const toRegistry = `${jfRegistryUrl}/${repositoryName}-${toEnv}-docker-local`;
39
- const imageName = `${repositoryName}:${tag}`;
45
+ const imageName = `${applicationName ?? repositoryName}:${tag}`;
40
46
  const fromFullImageName = `${fromRegistry}/${imageName}`;
41
47
  const toFullImageName = `${toRegistry}/${imageName}`;
42
48
 
@@ -303,7 +303,13 @@ export async function deployAppWithTag(application, env, site, deployTag) {
303
303
 
304
304
  if (env !== 'dev') {
305
305
  const appDetails = appInfo[application];
306
- await copy2(appDetails.repositoryName, 'dev', env, deployTag);
306
+ await copy2(
307
+ appDetails.repositoryName,
308
+ 'dev',
309
+ env,
310
+ deployTag,
311
+ appDetails.imageName,
312
+ );
307
313
  }
308
314
 
309
315
  const { repoPath, deployConfigFilePath, deployConfig } =
@@ -390,6 +396,7 @@ export async function deployApp(
390
396
  fromEnv,
391
397
  toEnv,
392
398
  fromDeployConfig.image.tag,
399
+ appDetails.imageName,
393
400
  );
394
401
  }
395
402
 
@@ -419,7 +426,9 @@ export async function deployApp(
419
426
  deployConfigFilePath: toDeployAppConfigFilePath,
420
427
  } = await readDeployConfig(application, toEnv, toSite, 'app');
421
428
 
422
- toDeployAppConfig.revision = fromDeployConfig.image.tag;
429
+ toDeployAppConfig.revision = appDetails.getAppRevision
430
+ ? appDetails.getAppRevision(fromDeployConfig)
431
+ : fromDeployConfig.image.tag;
423
432
 
424
433
  // Write updated configuration to the target YAML file
425
434
  writeDeployConfig(toDeployConfigFilePath, toDeployConfig);
@@ -1,10 +1,22 @@
1
1
  import { $ } from 'zx';
2
+ import fs from 'fs-extra';
3
+ import path from 'path';
4
+
5
+ export async function haproxySync(cluster) {
6
+ if (cluster !== 'preprod' && cluster !== 'stage') {
7
+ console.log('Error: Cluster must be preprod or stage');
8
+ process.exit(1);
9
+ }
2
10
 
3
- export async function haproxySync() {
4
11
  const repoPath = '/root/repo/docupace-ansible';
5
- const inventory = path.join(repoPath, 'inventories/preprod/inventory');
12
+ const inventory = path.join(repoPath, `inventories/${cluster}/inventory`);
6
13
 
7
14
  // Create haproxy.sh
15
+ const cluserHostMap = {
16
+ preprod: '10.10.28.198',
17
+ stage: '10.12.28.10',
18
+ };
19
+
8
20
  const scriptContent = `
9
21
  #!/bin/bash
10
22
 
@@ -18,11 +30,11 @@ export async function haproxySync() {
18
30
  git submodule foreach --recursive git checkout master
19
31
  git submodule foreach --recursive git pull origin master
20
32
 
21
- ansible-playbook -i inventories/preprod/inventory haproxy.yml -e "cluster=preprod"
33
+ ansible-playbook -i inventories/${cluster}/inventory haproxy.yml -e "cluster=${cluster}"
22
34
 
23
35
  echo "proceeding"
24
36
  echo "committing changes"
25
- git add preprod-haproxy.cfg
37
+ git add ${cluster}-haproxy.cfg
26
38
  git commit -m "Sync haproxy"
27
39
  git push origin master
28
40
  `;
@@ -32,18 +44,16 @@ export async function haproxySync() {
32
44
  // Private key
33
45
  const haproxyPrivateKey = process.env.HAPROXY_PRIVATE_KEY;
34
46
  if (!haproxyPrivateKey) {
35
- log('Error: HAPROXY_PRIVATE_KEY not set.');
47
+ console.log('Error: HAPROXY_PRIVATE_KEY not set.');
36
48
  process.exit(1);
37
49
  }
38
50
 
39
51
  await fs.writeFile('private.key', Buffer.from(haproxyPrivateKey, 'base64'));
40
52
  await fs.chmod('private.key', 0o600);
41
53
 
42
- await $`cat private.key`; // Just to mimic the script's behavior
43
-
44
54
  // Copy script to remote
45
- await $`scp -i private.key -o StrictHostKeyChecking=no haproxy.sh root@10.10.28.198:/tmp/haproxy.sh`;
55
+ await $`scp -i private.key -o StrictHostKeyChecking=no haproxy.sh root@${cluserHostMap[cluster]}:/tmp/haproxy.sh`;
46
56
 
47
57
  // Execute script on remote
48
- await $`ssh -i private.key -o StrictHostKeyChecking=no root@10.10.28.198 "bash /tmp/haproxy.sh"`;
58
+ await $`ssh -i private.key -o StrictHostKeyChecking=no root@${cluserHostMap[cluster]} "bash /tmp/haproxy.sh"`;
49
59
  }
@@ -2,6 +2,7 @@
2
2
  set -e
3
3
 
4
4
  PROJECT=$1
5
+ export ROLE_NAME="${2:-atlassian-bitbucket-pipelines-runner-eks-role}"
5
6
 
6
7
  if [[ -z "$PROJECT" ]]; then
7
8
  echo "Error: Project name is required."
@@ -9,7 +10,6 @@ if [[ -z "$PROJECT" ]]; then
9
10
  exit 1
10
11
  fi
11
12
 
12
- export ROLE_NAME="atlassian-bitbucket-pipelines-runner-eks-role"
13
13
  export SESSION_NAME="EKSAdminSession"
14
14
  export EKS_CLUSTER_NAME="connect-next-${CURRENT_ENVIRONMENT}-eks-cluster"
15
15
  export ROLE_ARN="arn:aws:iam::$(aws sts get-caller-identity | jq -r '.Account'):role/$ROLE_NAME"
package/terraform/init.sh CHANGED
@@ -3,6 +3,7 @@ set -e
3
3
 
4
4
  PROJECT=$1
5
5
  CURRENT_ENVIRONMENT=$2
6
+ export ROLE_NAME="${3:-atlassian-bitbucket-pipelines-runner-eks-role}"
6
7
 
7
8
  if [[ -z "$PROJECT" ]]; then
8
9
  echo "Error: Project name is required."
@@ -16,7 +17,6 @@ if [[ -z "$CURRENT_ENVIRONMENT" ]]; then
16
17
  exit 1
17
18
  fi
18
19
 
19
- export ROLE_NAME="atlassian-bitbucket-pipelines-runner-eks-role"
20
20
  export SESSION_NAME="EKSAdminSession"
21
21
  export EKS_CLUSTER_NAME="connect-next-${CURRENT_ENVIRONMENT}-eks-cluster"
22
22
  export ROLE_ARN="arn:aws:iam::$(aws sts get-caller-identity | jq -r '.Account'):role/$ROLE_NAME"
@@ -37,6 +37,7 @@ info () {
37
37
  echo "PROJECT => $PROJECT"
38
38
  echo "CURRENT_ENVIRONMENT => $CURRENT_ENVIRONMENT"
39
39
  echo "SITE_NAME => $SITE_NAME"
40
+ echo "Using AWS Role: $ROLE_NAME"
40
41
  }
41
42
 
42
43
  if [[ "$PROJECT" == "s3" ]]; then
package/terraform/plan.sh CHANGED
@@ -3,6 +3,7 @@ set -e
3
3
 
4
4
  PROJECT=$1
5
5
  CURRENT_ENVIRONMENT=$2
6
+ export ROLE_NAME="${3:-atlassian-bitbucket-pipelines-runner-eks-role}"
6
7
 
7
8
  if [[ -z "$PROJECT" ]]; then
8
9
  echo "Error: Project name is required."
@@ -16,7 +17,6 @@ if [[ -z "$CURRENT_ENVIRONMENT" ]]; then
16
17
  exit 1
17
18
  fi
18
19
 
19
- export ROLE_NAME="atlassian-bitbucket-pipelines-runner-eks-role"
20
20
  export SESSION_NAME="EKSAdminSession"
21
21
  export EKS_CLUSTER_NAME="connect-next-${CURRENT_ENVIRONMENT}-eks-cluster"
22
22
  export ROLE_ARN="arn:aws:iam::$(aws sts get-caller-identity | jq -r '.Account'):role/$ROLE_NAME"
@@ -53,8 +53,10 @@ elif [[ "$PROJECT" == "idp" ]];then
53
53
  -var="old_page_design=${USE_OLD_PAGE_DESIGN}" \
54
54
  -var="use_new_domain=${USE_NEW_DOMAIN}" \
55
55
  -var="configure_autologin=${CONFIGURE_AUTOLOGIN}" \
56
- -var="configure_ui_main=${CONFIGURE_UI_MAIN}" \
56
+ -var="configure_enterprise_ui=${CONFIGURE_ENTERPRISE_UI}" \
57
57
  -var="enable_mfa=${ENABLE_MFA}" \
58
+ -var="configure_ui_cc=${CONFIGURE_UI_CC}" \
59
+ -var="configure_precisefp_client_credentials=${CONFIGURE_PRECISEFP_CLIENT_CREDENTIALS}" \
58
60
  -out .tfplan
59
61
  else
60
62
  terraform plan -var-file="./env/${CURRENT_ENVIRONMENT}/us-west-2/terraform.tfvars" -out .tfplan