@docupace/pipeline 1.0.8-6.xray → 1.0.8

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 (64) hide show
  1. package/eslint.config.js +2 -25
  2. package/next/execute.sh +2 -8
  3. package/package.json +8 -24
  4. package/src/changeset/cli.js +195 -151
  5. package/src/changeset/validate.js +1 -45
  6. package/src/jenkins/setParams.groovy +2 -1
  7. package/src/next/cli.js +15 -111
  8. package/src/next/config.js +7 -72
  9. package/src/next/copy.js +1 -32
  10. package/src/next/deploy.js +69 -520
  11. package/src/next/jenkins.js +2 -3
  12. package/src/next/pipline.js +1 -0
  13. package/src/next/publish.js +30 -53
  14. package/README.md +0 -136
  15. package/bin/azuread_update_callbacks_for_app.sh +0 -58
  16. package/bin/xray.sh +0 -273
  17. package/bitbucket-pipelines.yml +0 -142
  18. package/jest.config.js +0 -15
  19. package/src/auth0/alias.js +0 -79
  20. package/src/auth0/alias.test.js +0 -172
  21. package/src/auth0/cli.js +0 -82
  22. package/src/auth0/configure.js +0 -902
  23. package/src/auth0/configure.test.js +0 -167
  24. package/src/auth0/export.js +0 -48
  25. package/src/auth0/export.test.js +0 -103
  26. package/src/auth0/metadata.js +0 -141
  27. package/src/auth0/metadata.test.js +0 -186
  28. package/src/auth0/vault.js +0 -60
  29. package/src/auth0/vault.test.js +0 -134
  30. package/src/changeset/changelog-wiki.js +0 -328
  31. package/src/changeset/changeset-config.js +0 -34
  32. package/src/changeset/create.js +0 -215
  33. package/src/changeset/package-util.js +0 -87
  34. package/src/changeset/util.js +0 -43
  35. package/src/changeset/version.js +0 -102
  36. package/src/jfrog/xray-scan.yaml +0 -29
  37. package/src/lib/merge-driver.js +0 -204
  38. package/src/merge/cli-merge-all.js +0 -521
  39. package/src/merge/cli-merge.js +0 -572
  40. package/src/merge/cli-resolve.js +0 -399
  41. package/src/merge/cli.js +0 -38
  42. package/src/merge/common.js +0 -7
  43. package/src/merge/merge-changelog.js +0 -87
  44. package/src/merge/merge-package.js +0 -106
  45. package/src/merge/merge-types.js +0 -82
  46. package/src/merge/pr.js +0 -231
  47. package/src/micro/cli.js +0 -51
  48. package/src/micro/ms-deploy.js +0 -451
  49. package/src/micro/ms-publish.js +0 -186
  50. package/src/next/alias.js +0 -53
  51. package/src/next/apache.js +0 -81
  52. package/src/next/connect.js +0 -226
  53. package/src/next/git-to-semver.js +0 -79
  54. package/src/next/haproxy.js +0 -76
  55. package/src/next/jira.js +0 -84
  56. package/src/next/logger.js +0 -17
  57. package/src/next/test.js +0 -5
  58. package/src/next/util.js +0 -95
  59. package/src/next/vault.js +0 -45
  60. package/terraform/apply.sh +0 -41
  61. package/terraform/import.sh +0 -111
  62. package/terraform/init.sh +0 -78
  63. package/terraform/plan.sh +0 -95
  64. package/terraform/validate.sh +0 -17
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 {deployConnect, 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')
@@ -89,70 +47,17 @@ program
89
47
  .requiredOption('-t, --to-env <toEnv>', 'Target environment')
90
48
  .requiredOption('-F, --from-site <fromSite>', 'Source site')
91
49
  .requiredOption('-T, --to-site <toSite>', 'Target site')
92
- .option('-j, --jira-ticket [jiraTicket]', 'JIRA ticket (optional)')
93
50
  .option('-c, --deploy-core <deployCore>', 'Deploy Core', 'false')
94
- .option('-C, --deploy-connect <deployConnect>', 'Deploy Connect', 'false')
95
51
  .action(async (options) => {
96
- const {
97
- fromEnv,
98
- fromSite,
99
- toEnv,
100
- toSite,
101
- deployCore,
102
- deployConnect,
103
- jiraTicket,
104
- } = options;
105
- await deployFromSite(
106
- fromEnv,
107
- fromSite,
108
- toEnv,
109
- toSite,
110
- deployCore,
111
- deployConnect,
112
- jiraTicket,
113
- );
52
+ const { fromEnv, fromSite, toEnv, toSite, deployCore } = options;
53
+ await deployFromSite(fromEnv, fromSite, toEnv, toSite, deployCore);
114
54
  });
115
55
 
116
56
  program
117
- .command('deploy-template [tagPrefix]')
118
- .description('Deploy an standard configuration for configured sites')
119
- .action(async (tagPrefix) => {
120
- const deployTag = await getDeployTag(tagPrefix);
121
- const sites = await getDefaultDeploySite(deployTag);
122
- for (const { env, site } of sites) {
123
- await deployTemplate(env, site, deployTag);
124
- }
125
- });
126
-
127
- program
128
- .command('deploy-site-config <env> <site> [tagPrefix]')
129
- .description('Deploy site configuration for a specific site')
130
- .action(async (env, site, tagPrefix) => {
131
- const deployTag = await getDeployTag(tagPrefix);
132
- await deployTemplate(env, site, deployTag, 'siteConfigRemoteBranch');
133
- });
134
-
135
- program
136
- .command('deploy-app <application>')
57
+ .command('deployTemplate <site>')
137
58
  .description('Deploy an application for a specific site')
138
- .action(async (application) => {
139
- const deployTag = await getDeployTag();
140
- const sites = await getDefaultDeploySite(deployTag);
141
- for (const { env, site } of sites) {
142
- await deployAppWithTag(application, env, site, deployTag);
143
- }
144
- });
145
-
146
- program
147
- .command('deploy-mono-app <tag> <application>')
148
- .description('Deploy an mono application for a specific site')
149
- .action(async (tag, application) => {
150
- const deployTag = await getDeployTag(tag);
151
- const version = 'v' + deployTag.split('@')[1];
152
- const sites = await getDefaultDeploySite(version);
153
- for (const { env, site } of sites) {
154
- await deployAppWithTag(application, env, site, version);
155
- }
59
+ .action(async (site) => {
60
+ await deployTemplate(site);
156
61
  });
157
62
 
158
63
  program
@@ -190,14 +95,13 @@ program
190
95
  program
191
96
  .command('copy')
192
97
  .description('Copy a Docker image between registries')
193
- .requiredOption('-r, --repository <repository>', 'Repostory name')
98
+ .requiredOption('-a, --application <application>', 'Application name')
194
99
  .requiredOption('-f, --from-env <fromEnv>', 'Source environment')
195
100
  .requiredOption('-t, --to-env <toEnv>', 'Target environment')
196
101
  .requiredOption('-g, --tag <tag>', 'Image tag')
197
- .requiredOption('-a, --application <application>', 'Application name')
198
102
  .action(async (options) => {
199
- const { repository, fromEnv, toEnv, tag, application } = options;
200
- await copy2(repository, fromEnv, toEnv, tag, application);
103
+ const { application, fromEnv, toEnv, tag } = options;
104
+ await copy(application, fromEnv, toEnv, tag);
201
105
  });
202
106
 
203
107
  program
@@ -1,86 +1,41 @@
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
- docupaceHost: () => 'www.dev.docupaceinc.com',
12
- ccUrl: (site) => `https://${site}-cc.dev.dpai.tech`,
13
7
  },
14
8
  qa: {
15
9
  newUrl: (site) => `https://${site}.qa.dpai.tech`,
16
10
  oldUrl: (site) => `https://www.preprod.docupaceinc.com/${site}`,
17
- docupaceHost: () => 'www.preprod.docupaceinc.com',
18
- ccUrl: (site) => `https://${site}-cc.qa.dpai.tech`,
19
11
  },
20
12
  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`,
13
+ newUrl: (site) => `https://${site}.qa.dpai.tech`,
14
+ oldUrl: (site) => `https://www2.paperout.com/${site}_uat`,
25
15
  },
26
16
  stage: {
27
17
  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`,
18
+ oldUrl: (site) => `https://www2.paperout.com/${site}_staging`,
31
19
  },
20
+
32
21
  prod: {
33
22
  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`,
23
+ oldUrl: (site) => `https://www2.paperout.com/${site}`,
37
24
  },
38
25
  };
39
26
 
40
27
  export const appInfo = {
41
28
  'graphql-server': {
42
29
  repositoryName: 'docupace-graphql-server',
43
- imageName: 'docupace-graphql-server',
44
30
  deployAttributes: [
45
31
  'image.tag',
46
32
  'graphqlServer.siteConfigRemoteBranch',
47
33
  'graphqlServer.standardConfigRemoteBranch',
48
34
  ],
49
35
  },
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
36
  ui: {
60
37
  repositoryName: 'docupace-ui-main',
61
- imageName: 'enterprise-ui-app',
62
38
  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
39
  },
85
40
  };
86
41
 
@@ -110,28 +65,8 @@ export const getBitbucketInfo = () => {
110
65
 
111
66
  export const getRepUrl = (repoName) => {
112
67
  const { username, password, workspace } = getBitbucketInfo();
113
- return `https://${username}:${password}@bitbucket.org/${workspace}/${repoName}.git`;
68
+ const repoUrl = `https://${username}:${password}@bitbucket.org/${workspace}/${repoName}.git`;
69
+ return repoUrl;
114
70
  };
115
71
 
116
72
  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
- };
package/src/next/copy.js CHANGED
@@ -11,38 +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 = `${appInfo[application].imageName}:${tag}`;
15
- const fromFullImageName = `${fromRegistry}/${imageName}`;
16
- const toFullImageName = `${toRegistry}/${imageName}`;
17
-
18
- console.log(
19
- `Copying Docker image: ${fromFullImageName} -> ${toFullImageName}`,
20
- );
21
-
22
- // Login to source registry
23
- await $`echo ${envInfo[fromEnv].jfrog.password} | docker login --username ${envInfo[fromEnv].jfrog.username} --password-stdin ${jfRegistryUrl}`;
24
- await $`docker pull ${fromFullImageName}`;
25
- await $`docker tag ${fromFullImageName} ${toFullImageName}`;
26
-
27
- // Login to target registry
28
- await $`echo ${envInfo[toEnv].jfrog.password} | docker login --username ${envInfo[toEnv].jfrog.username} --password-stdin ${jfRegistryUrl}`;
29
- await $`docker push ${toFullImageName}`;
30
- }
31
-
32
- export async function copy2(
33
- repositoryName,
34
- fromEnv,
35
- toEnv,
36
- tag,
37
- applicationName,
38
- ) {
39
- console.log(
40
- `Copying repository ${repositoryName} from ${fromEnv} to ${toEnv} for tag ${tag}`,
41
- );
42
- const envInfo = getEnvInfo();
43
- const fromRegistry = `${jfRegistryUrl}/${repositoryName}-${fromEnv}-docker-local`;
44
- const toRegistry = `${jfRegistryUrl}/${repositoryName}-${toEnv}-docker-local`;
45
- const imageName = `${applicationName ?? repositoryName}:${tag}`;
14
+ const imageName = `${repositoryName}:${tag}`;
46
15
  const fromFullImageName = `${fromRegistry}/${imageName}`;
47
16
  const toFullImageName = `${toRegistry}/${imageName}`;
48
17