@docupace/pipeline 1.0.7-7.micro-cli12 → 1.0.7-alpha.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.
Files changed (68) hide show
  1. package/.prettierrc.cjs +12 -12
  2. package/bin/next-changeset-validate.sh +8 -8
  3. package/eslint.config.js +26 -49
  4. package/next/changeset.sh +75 -75
  5. package/next/copy.sh +34 -34
  6. package/next/deploy.sh +40 -40
  7. package/next/execute.sh +117 -123
  8. package/next/sonar.sh +23 -23
  9. package/package.json +7 -23
  10. package/src/changeset/cli.js +281 -237
  11. package/src/changeset/validate.js +47 -91
  12. package/src/jenkins/setParams.groovy +59 -58
  13. package/src/next/cli.js +15 -111
  14. package/src/next/config.js +72 -137
  15. package/src/next/copy.js +30 -61
  16. package/src/next/deploy.js +314 -633
  17. package/src/next/jenkins.js +88 -123
  18. package/src/next/pipline.js +115 -114
  19. package/src/next/publish.js +48 -71
  20. package/src/next/pull.js +7 -7
  21. package/src/next/sonar.js +23 -23
  22. package/README.md +0 -136
  23. package/bin/azuread_update_callbacks_for_app.sh +0 -58
  24. package/bitbucket-pipelines.yml +0 -60
  25. package/jest.config.js +0 -15
  26. package/src/auth0/alias.js +0 -79
  27. package/src/auth0/alias.test.js +0 -172
  28. package/src/auth0/cli.js +0 -82
  29. package/src/auth0/configure.js +0 -902
  30. package/src/auth0/configure.test.js +0 -167
  31. package/src/auth0/export.js +0 -48
  32. package/src/auth0/export.test.js +0 -103
  33. package/src/auth0/metadata.js +0 -141
  34. package/src/auth0/metadata.test.js +0 -186
  35. package/src/auth0/vault.js +0 -60
  36. package/src/auth0/vault.test.js +0 -134
  37. package/src/changeset/changelog-wiki.js +0 -328
  38. package/src/changeset/changeset-config.js +0 -34
  39. package/src/changeset/create.js +0 -215
  40. package/src/changeset/package-util.js +0 -87
  41. package/src/changeset/util.js +0 -43
  42. package/src/changeset/version.js +0 -102
  43. package/src/lib/merge-driver.js +0 -204
  44. package/src/merge/cli-merge-all.js +0 -507
  45. package/src/merge/cli-merge.js +0 -492
  46. package/src/merge/cli-resolve.js +0 -399
  47. package/src/merge/cli.js +0 -38
  48. package/src/merge/merge-changelog.js +0 -87
  49. package/src/merge/merge-package.js +0 -106
  50. package/src/merge/merge-types.js +0 -82
  51. package/src/merge/pr.js +0 -231
  52. package/src/micro/cli.js +0 -51
  53. package/src/micro/ms-deploy.js +0 -451
  54. package/src/micro/ms-publish.js +0 -186
  55. package/src/next/alias.js +0 -53
  56. package/src/next/apache.js +0 -81
  57. package/src/next/connect.js +0 -226
  58. package/src/next/git-to-semver.js +0 -79
  59. package/src/next/haproxy.js +0 -76
  60. package/src/next/jira.js +0 -84
  61. package/src/next/logger.js +0 -17
  62. package/src/next/test.js +0 -5
  63. package/src/next/util.js +0 -93
  64. package/src/next/vault.js +0 -45
  65. package/terraform/apply.sh +0 -37
  66. package/terraform/init.sh +0 -72
  67. package/terraform/plan.sh +0 -76
  68. package/terraform/validate.sh +0 -17
@@ -1,91 +1,47 @@
1
- import fs from 'fs';
2
- import path from 'path';
3
- import { $ } from 'zx';
4
-
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
- await setGitInfo();
21
- const destBranch = process.env.BITBUCKET_PR_DESTINATION_BRANCH;
22
- await $`git fetch origin ${destBranch}:${destBranch}`;
23
- let releases;
24
-
25
- try {
26
- console.log('🔍 Validating changesets...');
27
- releases = await versionStatus(destBranch);
28
- } catch (e) {
29
- console.error(
30
- '❌ 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',
31
- e,
32
- );
33
- process.exit(-1);
34
- }
35
-
36
- if (!['master', 'main'].includes(destBranch)) {
37
- if (releases.some((item) => item.type !== 'patch')) {
38
- console.error(
39
- '❌ A changeset must be a patch for change to a release branch',
40
- );
41
- process.exit(-1);
42
- }
43
- }
44
-
45
- console.log('✅ Changeset validation passed.');
46
- }
47
-
48
- export async function validateChangesetPath(directoryPath) {
49
- try {
50
- // Step 1: Read the directory for md files excluding README.md
51
- const allFiles = fs.readdirSync(directoryPath);
52
- const mdFiles = allFiles.filter(
53
- (file) => file.endsWith('.md') && file !== 'README.md',
54
- );
55
-
56
- // Step 2: Check for pre.json and parse it
57
- const preJsonPath = path.join(directoryPath, 'pre.json');
58
- let preJson;
59
-
60
- if (!fs.existsSync(preJsonPath) && mdFiles.length === 0) {
61
- throw new Error('Error: No pre.json and no md files found.');
62
- }
63
-
64
- if (fs.existsSync(preJsonPath)) {
65
- preJson = JSON.parse(fs.readFileSync(preJsonPath, 'utf-8'));
66
-
67
- if (preJson.mode == 'pre') {
68
- // Step 4a: Get list of changesets from pre.json
69
- const changesets = preJson.changesets || [];
70
- const changesetNames = changesets.map((change) => change);
71
-
72
- // Step 4b: Match files with the list of changesets
73
- const mdFileNamesWithoutExt = mdFiles.map((file) =>
74
- path.basename(file, '.md'),
75
- );
76
- const unmatchedFiles = mdFileNamesWithoutExt.filter(
77
- (fileName) => !changesetNames.includes(fileName),
78
- );
79
-
80
- if (unmatchedFiles.length == 0) {
81
- throw new Error('Error: No new MD files found:');
82
- }
83
- }
84
- }
85
-
86
- console.log('Validation successful.');
87
- } catch (error) {
88
- console.log(error.message);
89
- throw error;
90
- }
91
- }
1
+ import fs from 'fs';
2
+ import path from 'path';
3
+
4
+ export async function validateChangesets(directoryPath) {
5
+ try {
6
+ // Step 1: Read the directory for md files excluding README.md
7
+ const allFiles = fs.readdirSync(directoryPath);
8
+ const mdFiles = allFiles.filter(
9
+ (file) => file.endsWith('.md') && file !== 'README.md',
10
+ );
11
+
12
+ // Step 2: Check for pre.json and parse it
13
+ const preJsonPath = path.join(directoryPath, 'pre.json');
14
+ let preJson;
15
+
16
+ if (!fs.existsSync(preJsonPath) && mdFiles.length === 0) {
17
+ throw new Error('Error: No pre.json and no md files found.');
18
+ }
19
+
20
+ if (fs.existsSync(preJsonPath)) {
21
+ preJson = JSON.parse(fs.readFileSync(preJsonPath, 'utf-8'));
22
+
23
+ if (preJson.mode == 'pre') {
24
+ // Step 4a: Get list of changesets from pre.json
25
+ const changesets = preJson.changesets || [];
26
+ const changesetNames = changesets.map((change) => change);
27
+
28
+ // Step 4b: Match files with the list of changesets
29
+ const mdFileNamesWithoutExt = mdFiles.map((file) =>
30
+ path.basename(file, '.md'),
31
+ );
32
+ const unmatchedFiles = mdFileNamesWithoutExt.filter(
33
+ (fileName) => !changesetNames.includes(fileName),
34
+ );
35
+
36
+ if (unmatchedFiles.length == 0) {
37
+ throw new Error('Error: No new MD files found:');
38
+ }
39
+ }
40
+ }
41
+
42
+ console.log('Validation successful.');
43
+ } catch (error) {
44
+ console.log(error.message);
45
+ throw error;
46
+ }
47
+ }
@@ -1,58 +1,59 @@
1
- import groovy.json.JsonSlurper
2
- import hudson.model.*
3
-
4
- def build = Thread.currentThread().executable
5
- def params = build.getEnvironment(listener)
6
-
7
- def site = params.get('site')
8
- def server = "jboss7"
9
- def environment = params.get('environment')
10
-
11
- def buildFile=new File("D:\\Docupace\\CustomFolders\\" + environment + "\\" + site + "\\" + server + "\\buildApp.properties")
12
-
13
- List<String> jboss7controllerResult = []
14
-
15
- def controllersReport = new File("D:\\Docupace\\controllers_report.json")
16
- def inputJSON = new JsonSlurper().parseText(controllersReport.text)
17
- def props = new Properties()
18
- buildFile.withInputStream { stream -> props.load(stream) }
19
- def webRootContext = props["web.root.context"]
20
- if (webRootContext == null || webRootContext =="core") webRootContext = props["docupace.config.client.id"].toLowerCase()
21
-
22
- webRootContext = webRootContext.replaceFirst('_sso','')
23
- def map = inputJSON.'content'
24
-
25
- def Boolean enabled
26
-
27
- map.each {k,v ->
28
- v.each{vk, vv -> if (vk == webRootContext ) {
29
- enabled = false
30
- if(vv.deploymentsProperty.size()>0) enabled = vv.deploymentsProperty[0].isEnabled
31
- if (enabled) jboss7controllerResult.push(k)
32
- else jboss7controllerResult << k
33
- }
34
- }
35
- }
36
-
37
- if (jboss7controllerResult.size()>0) {
38
- if (environment == 'preprod') {
39
- jboss7controllerResult.remove("dev-corjbdc10.corp.docupace.com")
40
- jboss7controllerResult.remove("usdoc-s-jbdc1.corp.docupace.com")
41
- }
42
- if (environment == 'dev') {
43
- jboss7controllerResult.remove("qa-corjbdc10.corp.docupace.com")
44
- jboss7controllerResult.remove("qa-corjbdc20.corp.docupace.com")
45
- jboss7controllerResult.remove("usdoc-s-jbdc2.corp.docupace.com")
46
- }
47
- }
48
-
49
- println jboss7controllerResult[0]
50
-
51
- env.jboss7controller = jboss7controllerResult[0]
52
-
53
- def serverGroup = inputJSON.'content'."${jboss7controller}"."${webRootContext}".'serverGroup'
54
-
55
- println serverGroup
56
-
57
- params.put("serverGroup", serverGroup)
58
-
1
+ import groovy.json.JsonSlurper
2
+
3
+ import hudson.model.*;
4
+
5
+ def build = Thread.currentThread().executable
6
+ def params = build.getEnvironment(listener)
7
+
8
+ def site = params.get('site')
9
+ def server = "jboss7"
10
+ def environment = params.get('environment')
11
+
12
+ def buildFile=new File("D:\\Docupace\\CustomFolders\\" + environment + "\\" + site + "\\" + server + "\\buildApp.properties")
13
+
14
+ List<String> jboss7controllerResult = []
15
+
16
+ def controllersReport = new File("D:\\Docupace\\controllers_report.json")
17
+ def inputJSON = new JsonSlurper().parseText(controllersReport.text)
18
+ def props = new Properties()
19
+ buildFile.withInputStream { stream -> props.load(stream) }
20
+ def webRootContext = props["web.root.context"]
21
+ if (webRootContext == null || webRootContext =="core") webRootContext = props["docupace.config.client.id"].toLowerCase()
22
+
23
+ webRootContext = webRootContext.replaceFirst('_sso','')
24
+ def map = inputJSON.'content'
25
+
26
+ def Boolean enabled
27
+
28
+ map.each {k,v ->
29
+ v.each{vk, vv -> if (vk == webRootContext ) {
30
+ enabled = false
31
+ if(vv.deploymentsProperty.size()>0) enabled = vv.deploymentsProperty[0].isEnabled
32
+ if (enabled) jboss7controllerResult.push(k)
33
+ else jboss7controllerResult << k
34
+ }
35
+ }
36
+ }
37
+
38
+ if (jboss7controllerResult.size()>0) {
39
+ if (environment == 'preprod') {
40
+ jboss7controllerResult.remove("dev-corjbdc10.corp.docupace.com")
41
+ jboss7controllerResult.remove("usdoc-s-jbdc1.corp.docupace.com")
42
+ }
43
+ if (environment == 'dev') {
44
+ jboss7controllerResult.remove("qa-corjbdc10.corp.docupace.com")
45
+ jboss7controllerResult.remove("qa-corjbdc20.corp.docupace.com")
46
+ jboss7controllerResult.remove("usdoc-s-jbdc2.corp.docupace.com")
47
+ }
48
+ }
49
+
50
+ println jboss7controllerResult[0]
51
+
52
+ env.jboss7controller = jboss7controllerResult[0]
53
+
54
+ def serverGroup = inputJSON.'content'."${jboss7controller}"."${webRootContext}".'serverGroup'
55
+
56
+ println serverGroup
57
+
58
+ params.put("serverGroup", serverGroup)
59
+
package/src/next/cli.js CHANGED
@@ -4,27 +4,19 @@ import { Command } from 'commander';
4
4
  import { pull } from './pull.js';
5
5
  import { sonar } from './sonar.js';
6
6
  import { publish } from './publish.js';
7
- import {
8
- deployAppWithTag,
9
- deployFromSite,
10
- deployTemplate,
11
- getDefaultDeploySite,
12
- getDeployTag,
13
- } from './deploy.js';
14
- import { copy2 } from './copy.js';
15
- import { vaultAddSiteData } from './vault.js';
16
- import { addApacheSite } from './apache.js';
17
- import { haproxySync } from './haproxy.js';
18
- import { connectClone } from './connect.js';
7
+ import { deployFromSite } from './deploy.js';
8
+ import { deployTemplate } from './deploy.js';
9
+ import { copy } from './copy.js';
19
10
  import dotenv from 'dotenv';
20
- import { $ } from 'zx';
21
- import { deployConnect, deployCore } from './jenkins.js';
22
- import { runPipeline } from './pipline.js';
23
11
 
24
12
  dotenv.config({ path: ['.env.pipeline.local', 'config/.env.pipeline.local'] });
25
13
 
26
14
  const program = new Command();
27
15
 
16
+ // GIT SHA computation
17
+ import { $ } from 'zx';
18
+ import { deployCore } from './jenkins.js';
19
+ import { runPipeline } from './pipline.js';
28
20
  const GIT_SHA = (await $`git log --pretty=format:'%h' -n 1`).stdout.trim();
29
21
 
30
22
  program
@@ -41,40 +33,6 @@ program
41
33
  await sonar(GIT_SHA);
42
34
  });
43
35
 
44
- program
45
- .command('addApacheSite')
46
- .description('Add site to apache')
47
- .action(async () => {
48
- await addApacheSite();
49
- });
50
-
51
- program
52
- .command('connectClone')
53
- .description('Clone connect site')
54
- .action(async () => {
55
- await connectClone();
56
- });
57
-
58
- program
59
- .command('haproxySync')
60
- .description('Sync haproxy config')
61
- .action(async () => {
62
- await haproxySync();
63
- });
64
-
65
- program
66
- .command('vaultAddSiteData')
67
- .description('Add m2m auth0 data to vault')
68
- .requiredOption('-s, --site-name <siteName>', 'Site name')
69
- .requiredOption(
70
- '-p, --site-config-remote-path <siteConfigRemotePath>',
71
- 'Site Config Remote Path',
72
- )
73
- .action(async (options) => {
74
- const { siteName, siteConfigRemotePath } = options;
75
- await vaultAddSiteData(siteName, siteConfigRemotePath);
76
- });
77
-
78
36
  program
79
37
  .command('publish')
80
38
  .description('Publish a Docker image')
@@ -90,60 +48,16 @@ program
90
48
  .requiredOption('-F, --from-site <fromSite>', 'Source site')
91
49
  .requiredOption('-T, --to-site <toSite>', 'Target site')
92
50
  .option('-c, --deploy-core <deployCore>', 'Deploy Core', 'false')
93
- .option('-C, --deploy-connect <deployConnect>', 'Deploy Connect', 'false')
94
51
  .action(async (options) => {
95
- const { fromEnv, fromSite, toEnv, toSite, deployCore, deployConnect } =
96
- options;
97
- await deployFromSite(
98
- fromEnv,
99
- fromSite,
100
- toEnv,
101
- toSite,
102
- deployCore,
103
- deployConnect,
104
- );
52
+ const { fromEnv, fromSite, toEnv, toSite, deployCore } = options;
53
+ await deployFromSite(fromEnv, fromSite, toEnv, toSite, deployCore);
105
54
  });
106
55
 
107
56
  program
108
- .command('deploy-template [tagPrefix]')
109
- .description('Deploy an standard configuration for configured sites')
110
- .action(async (tagPrefix) => {
111
- const deployTag = await getDeployTag(tagPrefix);
112
- const sites = await getDefaultDeploySite(deployTag);
113
- for (const { env, site } of sites) {
114
- await deployTemplate(env, site, deployTag);
115
- }
116
- });
117
-
118
- program
119
- .command('deploy-site-config <env> <site> [tagPrefix]')
120
- .description('Deploy site configuration for a specific site')
121
- .action(async (env, site, tagPrefix) => {
122
- const deployTag = await getDeployTag(tagPrefix);
123
- await deployTemplate(env, site, deployTag, 'siteConfigRemoteBranch');
124
- });
125
-
126
- program
127
- .command('deploy-app <application>')
57
+ .command('deployTemplate <site>')
128
58
  .description('Deploy an application for a specific site')
129
- .action(async (application) => {
130
- const deployTag = await getDeployTag();
131
- const sites = await getDefaultDeploySite(deployTag);
132
- for (const { env, site } of sites) {
133
- await deployAppWithTag(application, env, site, deployTag);
134
- }
135
- });
136
-
137
- program
138
- .command('deploy-mono-app <tag> <application>')
139
- .description('Deploy an mono application for a specific site')
140
- .action(async (tag, application) => {
141
- const deployTag = await getDeployTag(tag);
142
- const version = 'v' + deployTag.split('@')[1];
143
- const sites = await getDefaultDeploySite(version);
144
- for (const { env, site } of sites) {
145
- await deployAppWithTag(application, env, site, version);
146
- }
59
+ .action(async (site) => {
60
+ await deployTemplate(site);
147
61
  });
148
62
 
149
63
  program
@@ -155,15 +69,6 @@ program
155
69
  await deployCore(env, site, options.liquibase, options.branch);
156
70
  });
157
71
 
158
- program
159
- .command('deploy-connect <env> <site>')
160
- .description('Deploy Core')
161
- .option('-l, --liquibase <liquibase>', 'Application name', 'true')
162
- .option('-b, --branch <branch>', 'Branch', 'master')
163
- .action(async (env, site, options) => {
164
- await deployConnect(env, site, options.liquibase, options.branch);
165
- });
166
-
167
72
  program
168
73
  .command('deploy-core-pipeline <env> <site>')
169
74
  .description('Deploy Core')
@@ -181,14 +86,13 @@ program
181
86
  program
182
87
  .command('copy')
183
88
  .description('Copy a Docker image between registries')
184
- .requiredOption('-r, --repository <repository>', 'Repostory name')
89
+ .requiredOption('-a, --application <application>', 'Application name')
185
90
  .requiredOption('-f, --from-env <fromEnv>', 'Source environment')
186
91
  .requiredOption('-t, --to-env <toEnv>', 'Target environment')
187
92
  .requiredOption('-g, --tag <tag>', 'Image tag')
188
- .requiredOption('-a, --application <application>', 'Application name')
189
93
  .action(async (options) => {
190
- const { repository, fromEnv, toEnv, tag, application } = options;
191
- await copy2(repository, fromEnv, toEnv, tag, application);
94
+ const { application, fromEnv, toEnv, tag } = options;
95
+ await copy(application, fromEnv, toEnv, tag);
192
96
  });
193
97
 
194
98
  program
@@ -1,137 +1,72 @@
1
- import semver from 'semver';
2
-
3
- export const environments = ['dev', 'qa', 'uat', 'stage', 'prod'];
4
-
5
- const UI_MONO_VERSION = '1.4.0-alpha.0';
6
-
7
- export const environmentConfig = {
8
- dev: {
9
- newUrl: (site) => `https://${site}.dev.dpai.tech`,
10
- oldUrl: (site) => `https://www.dev.docupaceinc.com/${site}`,
11
- docupaceHost: () => 'www.dev.docupaceinc.com',
12
- ccUrl: (site) => `https://${site}-cc.dev.dpai.tech`,
13
- },
14
- qa: {
15
- newUrl: (site) => `https://${site}.qa.dpai.tech`,
16
- oldUrl: (site) => `https://www.preprod.docupaceinc.com/${site}`,
17
- docupaceHost: () => 'www.preprod.docupaceinc.com',
18
- ccUrl: (site) => `https://${site}-cc.qa.dpai.tech`,
19
- },
20
- uat: {
21
- newUrl: (site) => `https://${site}.uat.dpai.tech`,
22
- oldUrl: (site) => `https://uat.paperout.com/${site}`,
23
- docupaceHost: () => 'www.uat.paperout.com',
24
- ccUrl: (site) => `https://${site}-cc.uat.dpai.tech`,
25
- },
26
- stage: {
27
- newUrl: (site) => `https://${site}.stage.dpai.tech`,
28
- oldUrl: (site) => `https://stage.paperout.com/${site}`,
29
- docupaceHost: () => 'www.stage.paperout.com',
30
- ccUrl: (site) => `https://${site}-cc.stage.dpai.tech`,
31
- },
32
- prod: {
33
- newUrl: (site) => `https://${site}.dpai.tech`,
34
- oldUrl: (site) => `https://www3.paperout.com/${site}`,
35
- docupaceHost: () => 'www3.paperout.com',
36
- ccUrl: (site) => `https://${site}-cc.dpai.tech`,
37
- },
38
- };
39
-
40
- export const appInfo = {
41
- 'graphql-server': {
42
- repositoryName: 'docupace-graphql-server',
43
- imageName: 'docupace-graphql-server',
44
- deployAttributes: [
45
- 'image.tag',
46
- 'graphqlServer.siteConfigRemoteBranch',
47
- 'graphqlServer.standardConfigRemoteBranch',
48
- ],
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
- },
59
- ui: {
60
- repositoryName: 'docupace-ui-main',
61
- imageName: 'enterprise-ui-app',
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
- },
72
- updateConfigFunction: (config) => {
73
- if (config.image.repository.endsWith('/docupace-ui-main')) {
74
- const tag = config.image.tag;
75
- const version = tag.startsWith('v') ? tag.slice(1) : tag;
76
- if (semver.gt(version, UI_MONO_VERSION)) {
77
- const parts = config.image.repository.split('/');
78
- parts[2] = 'enterprise-ui-app';
79
- config.image.repository = parts.join('/');
80
- }
81
- }
82
- return config;
83
- },
84
- },
85
- };
86
-
87
- export const getEnvInfo = () => {
88
- const envInfo = Object.fromEntries(
89
- environments.map((env) => [
90
- env,
91
- {
92
- jfrog: {
93
- username: process.env[`JF_REGISTRY_${env.toUpperCase()}_USERNAME`],
94
- password: process.env[`JF_REGISTRY_${env.toUpperCase()}_PASSWORD`],
95
- },
96
- },
97
- ]),
98
- );
99
-
100
- return envInfo;
101
- };
102
-
103
- export const getBitbucketInfo = () => {
104
- return {
105
- username: process.env.BITBUCKET_USERNAME,
106
- password: process.env.BITBUCKET_APP_PASSWORD,
107
- workspace: 'dp-cloud',
108
- };
109
- };
110
-
111
- export const getRepUrl = (repoName) => {
112
- const { username, password, workspace } = getBitbucketInfo();
113
- return `https://${username}:${password}@bitbucket.org/${workspace}/${repoName}.git`;
114
- };
115
-
116
- export const jfRegistryUrl = 'registry.paperout.com';
117
-
118
- export const getVaultSecretsConfigs = (site) => {
119
- return {
120
- commonSecretsPath: 'secret/data/common/config',
121
- siteCommonSecretsPath: `secret/data/${site}/common/config`,
122
- graphqlServerSecretsPath: `secret/data/${site}/graphql-server/config`,
123
- uiSecretsPath: `secret/data/${site}/ui/config`,
124
- ccUISecretsPath: `secret/data/${site}/ui-cc/config`,
125
- awsSecretsPath: `secret/data/${site}/aws/config`,
126
- };
127
- };
128
-
129
- export const coreSiteEnvMap = {
130
- dev: 'dev',
131
- qa: 'preprod',
132
- stg: 'staging',
133
- stage: 'staging',
134
- uat: 'uat',
135
- prd: 'prod',
136
- prod: 'prod',
137
- };
1
+ export const environments = ['dev', 'qa', 'uat', 'stage', 'prod'];
2
+
3
+ export const environmentConfig = {
4
+ dev: {
5
+ newUrl: (site) => `${site}.dev.dpai.tech`,
6
+ oldUrl: (site) => `https://www.dev.docupaceinc.com/${site}`,
7
+ },
8
+ qa: {
9
+ newUrl: (site) => `${site}.qa.dpai.tech`,
10
+ oldUrl: (site) => `https://www.preprod.docupaceinc.com/${site}`,
11
+ },
12
+ uat: {
13
+ newUrl: (site) => `${site}.qa.dpai.tech`,
14
+ oldUrl: (site) => `https://www2.paperout.com/${site}_uat`,
15
+ },
16
+ stage: {
17
+ newUrl: (site) => `${site}.stage.dpai.tech`,
18
+ oldUrl: (site) => `https://www2.paperout.com/${site}_staging`,
19
+ },
20
+
21
+ prod: {
22
+ newUrl: (site) => `${site}.dpai.tech`,
23
+ oldUrl: (site) => `https://www2.paperout.com/${site}`,
24
+ },
25
+ };
26
+
27
+ export const appInfo = {
28
+ 'graphql-server': {
29
+ repositoryName: 'docupace-graphql-server',
30
+ deployAttributes: [
31
+ 'image.tag',
32
+ 'graphqlServer.siteConfigRemoteBranch',
33
+ 'graphqlServer.standardConfigRemoteBranch',
34
+ ],
35
+ },
36
+ ui: {
37
+ repositoryName: 'docupace-ui-main',
38
+ deployAttributes: ['image.tag'],
39
+ },
40
+ };
41
+
42
+ export const getEnvInfo = () => {
43
+ const envInfo = Object.fromEntries(
44
+ environments.map((env) => [
45
+ env,
46
+ {
47
+ jfrog: {
48
+ username: process.env[`JF_REGISTRY_${env.toUpperCase()}_USERNAME`],
49
+ password: process.env[`JF_REGISTRY_${env.toUpperCase()}_PASSWORD`],
50
+ },
51
+ },
52
+ ]),
53
+ );
54
+
55
+ return envInfo;
56
+ };
57
+
58
+ export const getBitbucketInfo = () => {
59
+ return {
60
+ username: process.env.BITBUCKET_USERNAME,
61
+ password: process.env.BITBUCKET_APP_PASSWORD,
62
+ workspace: 'dp-cloud',
63
+ };
64
+ };
65
+
66
+ export const getRepUrl = (repoName) => {
67
+ const { username, password, workspace } = getBitbucketInfo();
68
+ const repoUrl = `https://${username}:${password}@bitbucket.org/${workspace}/${repoName}.git`;
69
+ return repoUrl;
70
+ };
71
+
72
+ export const jfRegistryUrl = 'registry.paperout.com';