@docupace/pipeline 1.0.39-newrelease.8 → 1.0.39

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.
@@ -1,86 +1,157 @@
1
1
  #!/usr/bin/env node
2
- import dotenv from 'dotenv';
3
- dotenv.config({ path: ['.env.pipeline.local', 'config/.env.pipeline.local'] });
4
-
5
2
  import { Command } from 'commander';
6
3
  import { $ } from 'zx';
4
+ import path from 'path';
7
5
  import { validateChangesets } from './validate.js';
8
-
9
- import { isMonoRepo, setGitInfo } from '../next/util.js';
10
- import { updateJiraWithVersion, versionCommand } from './version.js';
11
- import { createChangeset } from './create.js';
6
+ import fs from 'fs';
7
+ import OpenAI from 'openai';
8
+ import { zodResponseFormat } from 'openai/helpers/zod';
9
+ import z from 'zod';
10
+ import dotenv from 'dotenv';
11
+ import { makeJiraRequest, updateComponentVersion } from '../next/jira.js';
12
+ dotenv.config({ path: ['.env.pipeline.local', 'config/.env.pipeline.local'] });
12
13
 
13
14
  const program = new Command();
14
15
 
15
16
  const args = process.argv;
16
17
 
17
- async function commitTagCommand(releases) {
18
- console.log('📌 Checking for updates to commit...');
18
+ async function createChangesetDirectory() {
19
+ try {
20
+ // Use path.join to build a safe path to `.changeset`
21
+ const targetDir = path.join(process.cwd(), '.changeset');
19
22
 
20
- // Check if there are changes to commit
21
- const status = (await $`git status --porcelain`).stdout.trim();
22
- if (!status) {
23
- console.log('✅ No changes to commit. Exiting.');
24
- return;
23
+ // Create the directory recursively if it doesn't exist
24
+ await fs.promises.mkdir(targetDir, { recursive: true });
25
+ } catch (error) {
26
+ console.error('Error creating .changeset directory:', error);
25
27
  }
28
+ }
26
29
 
27
- console.log('📌 Committing and tagging the new version...');
28
- await setGitInfo();
29
- await $`git add .`;
30
+ function run(command) {
31
+ return new Promise((resolve, reject) => {
32
+ exec(command, { shell: true }, (error, stdout, stderr) => {
33
+ if (error) {
34
+ reject(error);
35
+ } else {
36
+ resolve({ stdout, stderr });
37
+ }
38
+ });
39
+ });
40
+ }
30
41
 
31
- if (isMonoRepo()) {
32
- await commitTagMono(releases);
33
- } else {
34
- await commitTag();
42
+ async function fileExists(filePath) {
43
+ try {
44
+ await fs.promises.access(filePath);
45
+ return true;
46
+ } catch {
47
+ return false;
35
48
  }
36
49
  }
37
50
 
38
- export function getAppReleases(releases) {
39
- const appReleases = releases.filter((release) =>
40
- release.name.endsWith('-app'),
41
- );
42
- return appReleases;
51
+ async function getMainPackage() {
52
+ const mainModulePath = process.cwd();
53
+ if (mainModulePath) {
54
+ const packageJsonPath = path.join(mainModulePath, 'package.json');
55
+ if (await fileExists(packageJsonPath)) {
56
+ const fileContent = await fs.promises.readFile(packageJsonPath, 'utf-8');
57
+ const packageJson = JSON.parse(fileContent);
58
+ return packageJson;
59
+ }
60
+ }
61
+ throw new Error('Main package.json not found');
43
62
  }
44
63
 
45
- function getAppNameFromPackageName(packageName) {
46
- const appName = packageName.includes('/')
47
- ? packageName.split('/')[1]
48
- : packageName;
64
+ // Helper function to set Git info
65
+ async function setGitInfo() {
66
+ await $`git config --global user.email "gitops@docupace.com"`;
67
+ await $`git config --global user.name "Gitops"`;
68
+ await $`git remote set-url origin https://${process.env.THIS_REP_TOKEN}@bitbucket.org/${process.env.BITBUCKET_REPO_FULL_NAME}.git`;
69
+ }
49
70
 
50
- return appName;
71
+ const changeSetPackage = `{
72
+ "name": "changeset-package",
73
+ "version": "1.0.0",
74
+ "description": "",
75
+ "scripts": {
76
+ },
77
+ "type": "module",
78
+ "keywords": [],
79
+ "author": "",
80
+ "license": "ISC",
81
+ "dependencies": {},
82
+ "devDependencies": {
83
+ "@changesets/cli": "^2.27.10"
84
+ }
51
85
  }
86
+ `;
52
87
 
53
- async function commitTagMono(releases) {
54
- let versions = [];
55
- for (const release of getAppReleases(releases)) {
56
- const newVersion = release.newVersion;
57
- const appName = getAppNameFromPackageName(release.name);
58
- versions.push(`${appName}@${newVersion}`);
88
+ async function versionCommand(closeVersion = false) {
89
+ console.log('📦 Running Changeset versioning...');
90
+ await setGitInfo();
91
+ await $`mv package.json package.json.bak`;
92
+ await $`mv pnpm-lock.yaml pnpm-lock.yaml.bak`;
93
+ await fs.promises.writeFile('package.json', changeSetPackage);
94
+ await $`pnpm install`;
95
+ await $`rm package.json pnpm-lock.yaml`;
96
+ await $`mv package.json.bak package.json`;
97
+ await $`mv pnpm-lock.yaml.bak pnpm-lock.yaml`;
98
+ if (closeVersion) {
99
+ await $`pnpm changeset pre exit`;
59
100
  }
60
101
 
61
- const { stdout } = await $`git symbolic-ref refs/remotes/origin/HEAD`;
62
- const defaultBranch = stdout.trim().replace('refs/remotes/origin/', '');
102
+ await $`pnpm changeset version`;
103
+
104
+ // Read the updated package.json to get the new version and package name
105
+ const packageJson = JSON.parse(
106
+ await fs.promises.readFile('package.json', 'utf-8'),
107
+ );
108
+ const version = packageJson.version;
109
+ const packageName = packageJson.name;
63
110
 
64
- await $`git commit -m "Version bump to ${versions.join(',')} and changelog"`;
65
- await $`git push origin ${defaultBranch}`;
66
- for (const newVersion of versions) {
67
- await $`git tag ${newVersion}`;
68
- console.log(`✅ Version ${newVersion} tagged.`);
111
+ if (closeVersion) {
112
+ return { version, packageName };
69
113
  }
70
- await $`git push origin --tags`;
71
- console.log(`✅ Version pushed.`);
114
+
115
+ // Get the last commit message and extract Jira ticket
116
+ const lastCommit = (await $`git log -1 --pretty=%B`).stdout.trim();
117
+ console.log(`Last commit '${lastCommit}' being processed to get Jira ticket`);
118
+
119
+ const jiraTicketMatch = lastCommit.match(/([A-Z]+-\d+)/);
120
+ const jiraTicketId = jiraTicketMatch ? jiraTicketMatch[0] : null;
121
+
122
+ // If we have all the necessary data, update the component version in Jira
123
+ if (jiraTicketId && version && packageName) {
124
+ try {
125
+ await updateComponentVersion(jiraTicketId, packageName, version);
126
+ } catch (error) {
127
+ console.error(
128
+ `Failed to update Jira component version: ${error.message}`,
129
+ );
130
+ }
131
+ }
132
+
133
+ console.log('✅ Changeset versioning complete.');
134
+ return { version, packageName };
72
135
  }
73
136
 
74
- async function commitTag() {
137
+ async function commitTagCommand() {
138
+ console.log('📌 Checking for updates to commit...');
139
+
140
+ // Check if there are changes to commit
141
+ const status = (await $`git status --porcelain`).stdout.trim();
142
+ if (!status) {
143
+ console.log('✅ No changes to commit. Exiting.');
144
+ return;
145
+ }
146
+
147
+ console.log('📌 Committing and tagging the new version...');
148
+ await setGitInfo();
149
+ await $`git add .`;
75
150
  const newVersion = (
76
151
  await $`node -p "require('./package.json').version"`
77
152
  ).stdout.trim();
78
-
79
- const { stdout } = await $`git symbolic-ref refs/remotes/origin/HEAD`;
80
- const defaultBranch = stdout.trim().replace('refs/remotes/origin/', '');
81
-
82
153
  await $`git commit -m "Version bump to ${newVersion} and changelog"`;
83
- await $`git push origin ${defaultBranch}`;
154
+ await $`git push origin`;
84
155
  await $`git tag v${newVersion}`;
85
156
  await $`git push origin --tags`;
86
157
  console.log(`✅ Version ${newVersion} tagged and pushed.`);
@@ -88,17 +159,17 @@ async function commitTag() {
88
159
 
89
160
  // Command: validate
90
161
  program
91
- .command('validate')
162
+ .command('validate <path>')
92
163
  .description('Validate changesets for the provided PR')
93
- .action(async () => {
164
+ .action(async (path) => {
94
165
  if (!process.env.BITBUCKET_PR_ID) {
95
166
  return;
96
167
  }
97
168
  console.log('🔍 Validating changesets...');
98
169
  try {
99
- await validateChangesets();
170
+ await validateChangesets(path);
100
171
  console.log('✅ Changeset validation passed.');
101
- } catch {
172
+ } catch (error) {
102
173
  console.error(
103
174
  '❌ No changeset found. Please add a changeset to this PR. Please see more information at https://docupacellc.atlassian.net/wiki/spaces/PM/pages/1350893571/Creating+changesets+for+Docupace+Next',
104
175
  );
@@ -127,11 +198,8 @@ program
127
198
  .description('Run versioning and commit-and-tag in sequence')
128
199
  .action(async () => {
129
200
  console.log('📦 Running all steps...');
130
- const releases = await versionCommand();
131
- await updateJiraWithVersion(releases);
132
- if (!process.env.VERSION_DISABLE_COMMIT) {
133
- await commitTagCommand(releases);
134
- }
201
+ await versionCommand();
202
+ await commitTagCommand();
135
203
  });
136
204
 
137
205
  program
@@ -139,21 +207,15 @@ program
139
207
  .description('Closes a version')
140
208
  .action(async () => {
141
209
  console.log('📦 Running all steps...');
142
- const releases = await versionCommand(true);
143
- await commitTagCommand(releases);
210
+ const { version } = await versionCommand(true);
211
+ await commitTagCommand();
144
212
 
213
+ // Get current branch
145
214
  const { stdout: currentBranch } = await $`git rev-parse --abbrev-ref HEAD`;
146
215
 
147
- if (isMonoRepo()) {
148
- for (const release of getAppReleases(releases)) {
149
- const appName = getAppNameFromPackageName(release.name);
150
- await $`git checkout -b release/${appName}/${release.newVersion}`;
151
- await $`git push origin release/${appName}/${release.newVersion}`;
152
- }
153
- } else {
154
- await $`git checkout -b release/${releases[0].newVersion}`;
155
- await $`git push origin release/${releases[0].newVersion}`;
156
- }
216
+ // Create and push release branch
217
+ await $`git checkout -b release/${version}`;
218
+ await $`git push origin release/${version}`;
157
219
 
158
220
  // Return to original branch
159
221
  await $`git checkout ${currentBranch.trim()}`;
@@ -163,15 +225,109 @@ program
163
225
  await $`git add .`;
164
226
  await $`git commit -m "Open next alpha version"`;
165
227
  await $`git push origin`;
228
+
166
229
  });
167
230
 
168
231
  program
169
- .command('create-changeset [jiraIssueKey]')
232
+ .name('create-changeset')
170
233
  .description(
171
234
  'Creates a changeset based on the current branch and Jira ticket information',
172
235
  )
173
- .action(async (jiraIssueKey) => {
174
- await createChangeset(jiraIssueKey);
236
+ .action(async () => {
237
+ const mainPackage = await getMainPackage();
238
+ const componentName = mainPackage.name;
239
+
240
+ try {
241
+ // Step 1: Get the current branch name
242
+ const branchName = (await $`git branch --show-current`).stdout.trim();
243
+ console.log(`Current branch: ${branchName}`);
244
+
245
+ // Step 2: Extract Jira ticket number (e.g., matching JIRA-1234 pattern)
246
+ const jiraTicketMatch = branchName.match(/([A-Z]+-\d+)/);
247
+ if (!jiraTicketMatch) {
248
+ throw new Error('No Jira ticket found in the branch name.');
249
+ }
250
+ const jiraTicketId = jiraTicketMatch[0];
251
+
252
+ const jiraBaseUrl = 'https://docupacellc.atlassian.net';
253
+ const jiraEmail = process.env.JIRA_API_EMAIL;
254
+ const jiraApiKey = process.env.JIRA_API_KEY;
255
+ const jiraFullApiKey = `${jiraEmail}:${jiraApiKey}`;
256
+ const jiraUrl = `${jiraBaseUrl}/rest/api/2/issue/${jiraTicketId}`;
257
+ const jiraResponse = await fetch(jiraUrl, {
258
+ headers: {
259
+ Authorization: `Basic ${Buffer.from(jiraFullApiKey).toString('base64')}`,
260
+ 'Content-Type': 'application/json',
261
+ },
262
+ });
263
+
264
+ if (!jiraResponse.ok) {
265
+ throw new Error(
266
+ `Failed to fetch Jira ticket. Status: ${jiraResponse.status}`,
267
+ );
268
+ }
269
+ const jiraTicketData = await jiraResponse.json();
270
+
271
+ const jiraSummary = jiraTicketData.fields.summary;
272
+
273
+ console.log(
274
+ `Generating release notes for ${jiraTicketId} - ${jiraSummary}`,
275
+ );
276
+
277
+ const openaiClient = new OpenAI({
278
+ apiKey: process.env['OPENAI_API_KEY'],
279
+ });
280
+
281
+ const ChangeRequestSchema = z.object({
282
+ change_type: z.enum(['patch', 'minor']),
283
+ summary: z.string(),
284
+ jira_ticket_id: z.string(),
285
+ });
286
+
287
+ const openAiResponse = await openaiClient.chat.completions.create({
288
+ model: 'gpt-4o-mini',
289
+ messages: [
290
+ {
291
+ role: 'system',
292
+ content: `Process JSON from a Jira ticket to generate simple maximum 2 sentence release note for the ticket and determine the change type for bug it should be a patch for new feature it should be a minor change`,
293
+ },
294
+ {
295
+ role: 'user',
296
+ content: JSON.stringify(jiraTicketData),
297
+ },
298
+ ],
299
+ response_format: zodResponseFormat(
300
+ ChangeRequestSchema,
301
+ 'changeset_schema',
302
+ ),
303
+ temperature: 0,
304
+ });
305
+
306
+ const assistantResponse = openAiResponse.choices[0].message.content;
307
+ const parsedResponse = JSON.parse(assistantResponse);
308
+
309
+ const { change_type, summary } = parsedResponse;
310
+ console.log(`Change type: ${change_type}`);
311
+ console.log(`Release note: ${summary}`);
312
+
313
+ // Step 5: Create a changeset .md file
314
+ const changesetContent = `---
315
+ "${componentName}": ${change_type}
316
+ ---
317
+
318
+ ${summary} [${jiraTicketId}]
319
+ `;
320
+ const changesetFile = `./.changeset/${jiraTicketId}.md`;
321
+
322
+ await createChangesetDirectory();
323
+ await fs.promises.writeFile(changesetFile, changesetContent);
324
+ console.log(`Created changeset file at ${changesetFile}`);
325
+
326
+ console.log('Done!');
327
+ } catch (err) {
328
+ console.error(`Error: ${err.message}`);
329
+ process.exit(1);
330
+ }
175
331
  });
176
332
 
177
333
  // Parse arguments
@@ -1,44 +1,7 @@
1
1
  import fs from 'fs';
2
2
  import path from 'path';
3
- import { $ } from 'zx';
4
3
 
5
- import { isMonoRepo, setGitInfo } from '../next/util.js';
6
- import { versionStatus } from './version.js';
7
-
8
- const CHANGESET_DIR = '.changeset';
9
-
10
- function areArraysEqualIgnoringOrder(arr1, arr2) {
11
- if (arr1.length !== arr2.length) return false;
12
-
13
- const sortedA = [...arr1].sort();
14
- const sortedB = [...arr2].sort();
15
-
16
- return sortedA.every((element, index) => element === sortedB[index]);
17
- }
18
-
19
- export async function validateChangesets() {
20
- if (isMonoRepo()) {
21
- await setGitInfo();
22
- const destBranch = process.env.BITBUCKET_PR_DESTINATION_BRANCH;
23
- await $`git fetch origin ${destBranch}:${destBranch}`;
24
- await versionStatus(destBranch);
25
- /*const changedPackages = await getChangedPackages();
26
- const releaseNames = releases.map((release) => release.name);
27
- const changedPackageNames = changedPackages.map(
28
- (changedPackage) => changedPackage.name,
29
- );
30
-
31
- if (!areArraysEqualIgnoringOrder(releaseNames, changedPackageNames)) {
32
- throw new Error(
33
- 'Changesets must be created for all packages created and for those that have those changed as dependencies',
34
- );
35
- }*/
36
- } else {
37
- await validateChangesetPath(path.resolve(process.cwd(), CHANGESET_DIR));
38
- }
39
- }
40
-
41
- export async function validateChangesetPath(directoryPath) {
4
+ export async function validateChangesets(directoryPath) {
42
5
  try {
43
6
  // Step 1: Read the directory for md files excluding README.md
44
7
  const allFiles = fs.readdirSync(directoryPath);
@@ -1,5 +1,6 @@
1
1
  import groovy.json.JsonSlurper
2
- import hudson.model.*
2
+
3
+ import hudson.model.*;
3
4
 
4
5
  def build = Thread.currentThread().executable
5
6
  def params = build.getEnvironment(listener)
@@ -1,43 +1,40 @@
1
1
  import { $ } from 'zx';
2
2
 
3
3
  export async function addApacheSite() {
4
- if (
5
- !process.env.ENVIRONMENT ||
6
- (process.env.ENVIRONMENT !== 'dev' && process.env.ENVIRONMENT !== 'qa')
7
- ) {
8
- log("Error: ENVIRONMENT must be either 'dev' or 'qa'.");
9
- process.exit(1);
10
- }
11
- if (!process.env.SITE) {
12
- log('Error: SITE cannot be empty.');
13
- process.exit(1);
14
- }
15
-
16
- // Save private key from base64
17
- const haproxyPrivateKey = process.env.HAPROXY_PRIVATE_KEY;
18
- if (!haproxyPrivateKey) {
19
- log('Error: HAPROXY_PRIVATE_KEY not set.');
20
- process.exit(1);
21
- }
4
+ if (
5
+ !process.env.ENVIRONMENT ||
6
+ (process.env.ENVIRONMENT !== 'dev' && process.env.ENVIRONMENT !== 'qa')
7
+ ) {
8
+ log("Error: ENVIRONMENT must be either 'dev' or 'qa'.");
9
+ process.exit(1);
10
+ }
11
+ if (!process.env.SITE) {
12
+ log('Error: SITE cannot be empty.');
13
+ process.exit(1);
14
+ }
15
+
16
+ // Save private key from base64
17
+ const haproxyPrivateKey = process.env.HAPROXY_PRIVATE_KEY;
18
+ if (!haproxyPrivateKey) {
19
+ log('Error: HAPROXY_PRIVATE_KEY not set.');
20
+ process.exit(1);
21
+ }
22
+
23
+ await fs.writeFile('private.key', Buffer.from(haproxyPrivateKey, 'base64'));
24
+ await fs.chmod('private.key', 0o600);
25
+
26
+
27
+ console.log("Running command");
28
+ const sshCmd = (server,script) =>
29
+ $`ssh -i private.key -o StrictHostKeyChecking=no root@${server} ${script}`;
30
+
31
+ let server = `${process.env.ENVIRONMENT}-apalb01a.corp.docupace.com`;
32
+ // The script is run twice in the Bash version
33
+ await sshCmd(server, `/root/repo/iis-preprod/scripts/addsite/add_core_site.sh ${process.env.ENVIRONMENT} ${process.env.SITE}`);
22
34
 
23
- await fs.writeFile('private.key', Buffer.from(haproxyPrivateKey, 'base64'));
24
- await fs.chmod('private.key', 0o600);
35
+ server = `${process.env.ENVIRONMENT}-apalb01b.corp.docupace.com`;
25
36
 
26
- console.log('Running command');
27
- const sshCmd = (server, script) =>
28
- $`ssh -i private.key -o StrictHostKeyChecking=no root@${server} ${script}`;
29
-
30
- let server = `${process.env.ENVIRONMENT}-apalb01a.corp.docupace.com`;
31
- // The script is run twice in the Bash version
32
- await sshCmd(
33
- server,
34
- `/root/repo/iis-preprod/scripts/addsite/add_core_site.sh ${process.env.ENVIRONMENT} ${process.env.SITE}`,
35
- );
36
-
37
- server = `${process.env.ENVIRONMENT}-apalb01b.corp.docupace.com`;
38
-
39
- await sshCmd(
40
- server,
41
- `/root/repo/iis-preprod/scripts/addsite/add_core_site.sh ${process.env.ENVIRONMENT} ${process.env.SITE}`,
42
- );
43
- }
37
+ await sshCmd(server,`/root/repo/iis-preprod/scripts/addsite/add_core_site.sh ${process.env.ENVIRONMENT} ${process.env.SITE}`);
38
+ }
39
+
40
+
package/src/next/cli.js CHANGED
@@ -7,24 +7,25 @@ import { publish } from './publish.js';
7
7
  import {
8
8
  deployAppWithTag,
9
9
  deployFromSite,
10
- deployTemplate,
11
10
  getDefaultDeploySite,
12
11
  getDeployTag,
13
12
  } from './deploy.js';
13
+ import { deployTemplate } from './deploy.js';
14
14
  import { copy } from './copy.js';
15
15
  import { vaultAddSiteData } from './vault.js';
16
16
  import { addApacheSite } from './apache.js';
17
17
  import { haproxySync } from './haproxy.js';
18
18
  import { connectClone } from './connect.js';
19
19
  import dotenv from 'dotenv';
20
- import { $ } from 'zx';
21
- import { deployConnect, deployCore } from './jenkins.js';
22
- import { runPipeline } from './pipline.js';
23
20
 
24
21
  dotenv.config({ path: ['.env.pipeline.local', 'config/.env.pipeline.local'] });
25
22
 
26
23
  const program = new Command();
27
24
 
25
+ import { $ } from 'zx';
26
+ import { deployConnect, deployCore } from './jenkins.js';
27
+ import { runPipeline } from './pipline.js';
28
+
28
29
  const GIT_SHA = (await $`git log --pretty=format:'%h' -n 1`).stdout.trim();
29
30
 
30
31
  program
@@ -131,16 +132,6 @@ program
131
132
  await deployAppWithTag(application, env, site, deployTag);
132
133
  });
133
134
 
134
- program
135
- .command('deploy-mono-app <tag> <application>')
136
- .description('Deploy an application for a specific site')
137
- .action(async (tag, application) => {
138
- const deployTag = await getDeployTag(tag);
139
- const version = 'v' + deployTag.split('@')[1];
140
- const { env, site } = await getDefaultDeploySite(version);
141
- await deployAppWithTag(application, env, site, version);
142
- });
143
-
144
135
  program
145
136
  .command('deploy-core <env> <site>')
146
137
  .description('Deploy Core')
@@ -1,34 +1,35 @@
1
- import semver from 'semver';
2
-
3
1
  export const environments = ['dev', 'qa', 'uat', 'stage', 'prod'];
4
2
 
5
- const UI_MONO_VERSION = '1.4.0-alpha.0';
6
-
7
3
  export const environmentConfig = {
8
4
  dev: {
9
5
  newUrl: (site) => `https://${site}.dev.dpai.tech`,
10
6
  oldUrl: (site) => `https://www.dev.docupaceinc.com/${site}`,
11
7
  docupaceHost: () => 'www.dev.docupaceinc.com',
8
+ ccUrl: (site) => `https://${site}-cc.dev.dpai.tech`,
12
9
  },
13
10
  qa: {
14
11
  newUrl: (site) => `https://${site}.qa.dpai.tech`,
15
12
  oldUrl: (site) => `https://www.preprod.docupaceinc.com/${site}`,
16
13
  docupaceHost: () => 'www.preprod.docupaceinc.com',
14
+ ccUrl: (site) => `https://${site}-cc.qa.dpai.tech`,
17
15
  },
18
16
  uat: {
19
- newUrl: (site) => `https://${site}.qa.dpai.tech`,
17
+ newUrl: (site) => `https://${site}.uat.dpai.tech`,
20
18
  oldUrl: (site) => `https://www2.paperout.com/${site}_uat`,
21
19
  docupaceHost: () => 'www2.paperout.com',
20
+ ccUrl: (site) => `https://${site}-cc.uat.dpai.tech`,
22
21
  },
23
22
  stage: {
24
- newUrl: (site) => `https://${site}.stage.dpai.tech`,
23
+ newUrl: (site) => `https://${site}.stg.dpai.tech`,
25
24
  oldUrl: (site) => `https://www2.paperout.com/${site}_staging`,
26
25
  docupaceHost: () => 'www2.paperout.com',
26
+ ccUrl: (site) => `https://${site}-cc.stg.dpai.tech`,
27
27
  },
28
28
  prod: {
29
29
  newUrl: (site) => `https://${site}.dpai.tech`,
30
30
  oldUrl: (site) => `https://www2.paperout.com/${site}`,
31
31
  docupaceHost: () => 'www2.paperout.com',
32
+ ccUrl: (site) => `https://${site}-cc.dpai.tech`,
32
33
  },
33
34
  };
34
35
 
@@ -44,18 +45,6 @@ export const appInfo = {
44
45
  ui: {
45
46
  repositoryName: 'docupace-ui-main',
46
47
  deployAttributes: ['image.tag'],
47
- updateConfigFunction: (config) => {
48
- if (config.image.repository.endsWith('/docupace-ui-main')) {
49
- const tag = config.image.tag;
50
- const version = tag.startsWith('v') ? tag.slice(1) : tag;
51
- if (semver.gt(version, UI_MONO_VERSION)) {
52
- const parts = config.image.repository.split('/');
53
- parts[2] = 'enterprise-ui-app';
54
- config.image.repository = parts.join('/');
55
- }
56
- }
57
- return config;
58
- },
59
48
  },
60
49
  };
61
50
 
@@ -96,6 +85,7 @@ export const getVaultSecretsConfigs = (site) => {
96
85
  siteCommonSecretsPath: `secret/data/${site}/common/config`,
97
86
  graphqlServerSecretsPath: `secret/data/${site}/graphql-server/config`,
98
87
  uiSecretsPath: `secret/data/${site}/ui/config`,
88
+ ccUISecretsPath: `secret/data/${site}/ui-cc/config`,
99
89
  awsSecretsPath: `secret/data/${site}/aws/config`,
100
90
  };
101
91
  };
@@ -6,7 +6,7 @@ import lodash from 'lodash';
6
6
  import { appInfo, environmentConfig, getRepUrl } from './config.js';
7
7
  import { copy2 } from './copy.js';
8
8
  import axios from 'axios';
9
- import { deployConnect, deployCore } from './jenkins.js';
9
+ import { deployCore, deployConnect } from './jenkins.js';
10
10
 
11
11
  /**
12
12
  * Clone the repository, read the YAML file, and return the parsed data and file paths.
@@ -266,9 +266,9 @@ export async function writeAndPushDeployConfig(
266
266
  * @param {string} site - The site name.
267
267
  */
268
268
 
269
- export async function getDeployTag(prefix = 'v') {
269
+ export async function getDeployTag() {
270
270
  const gitTag = (
271
- await $`git tag --points-at HEAD | grep '^${prefix}' | head -n 1`
271
+ await $`git tag --points-at HEAD | grep '^v' | head -n 1`
272
272
  ).stdout.trim();
273
273
  const deployTag = gitTag || `build-${process.env.BITBUCKET_BUILD_NUMBER}`;
274
274
  return deployTag;
@@ -410,10 +410,6 @@ export async function deployApp(
410
410
  }
411
411
  }
412
412
 
413
- if (appDetails.updateConfigFunction) {
414
- appDetails.updateConfigFunction(toDeployConfig);
415
- }
416
-
417
413
  const {
418
414
  deployConfig: toDeployAppConfig,
419
415
  deployConfigFilePath: toDeployAppConfigFilePath,