@docupace/pipeline 1.0.77 → 1.0.79

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 (69) hide show
  1. package/.prettierrc.cjs +12 -12
  2. package/README.md +135 -135
  3. package/bin/azuread_update_callbacks_for_app.sh +58 -58
  4. package/bin/next-changeset-validate.sh +8 -8
  5. package/bitbucket-pipelines.yml +59 -59
  6. package/eslint.config.js +49 -49
  7. package/jest.config.js +15 -15
  8. package/next/changeset.sh +75 -75
  9. package/next/copy.sh +34 -34
  10. package/next/deploy.sh +40 -40
  11. package/next/execute.sh +123 -123
  12. package/next/sonar.sh +23 -23
  13. package/package.json +1 -1
  14. package/src/auth0/alias.js +79 -79
  15. package/src/auth0/alias.test.js +172 -172
  16. package/src/auth0/cli.js +82 -82
  17. package/src/auth0/configure.js +902 -902
  18. package/src/auth0/configure.test.js +167 -167
  19. package/src/auth0/export.js +48 -48
  20. package/src/auth0/export.test.js +103 -103
  21. package/src/auth0/metadata.js +141 -141
  22. package/src/auth0/metadata.test.js +186 -186
  23. package/src/auth0/vault.js +60 -60
  24. package/src/auth0/vault.test.js +134 -134
  25. package/src/changeset/changelog-wiki.js +328 -328
  26. package/src/changeset/changeset-config.js +34 -34
  27. package/src/changeset/cli.js +237 -237
  28. package/src/changeset/create.js +215 -215
  29. package/src/changeset/package-util.js +87 -87
  30. package/src/changeset/util.js +43 -43
  31. package/src/changeset/validate.js +91 -91
  32. package/src/changeset/version.js +102 -102
  33. package/src/jenkins/setParams.groovy +58 -58
  34. package/src/lib/merge-driver.js +204 -204
  35. package/src/merge/cli-merge-all.js +507 -507
  36. package/src/merge/cli-merge.js +492 -492
  37. package/src/merge/cli-resolve.js +399 -399
  38. package/src/merge/cli.js +38 -38
  39. package/src/merge/merge-changelog.js +87 -87
  40. package/src/merge/merge-package.js +106 -106
  41. package/src/merge/merge-types.js +82 -82
  42. package/src/merge/pr.js +231 -231
  43. package/src/micro/deploy-microservice.js +153 -0
  44. package/src/micro/{ms-publish.js → publish-ms.js} +8 -6
  45. package/src/next/alias.js +53 -53
  46. package/src/next/apache.js +81 -81
  47. package/src/next/cli.js +10 -1
  48. package/src/next/config.js +137 -137
  49. package/src/next/connect.js +226 -226
  50. package/src/next/copy.js +61 -61
  51. package/src/next/deploy.js +666 -633
  52. package/src/next/git-to-semver.js +79 -79
  53. package/src/next/haproxy.js +76 -76
  54. package/src/next/jenkins.js +123 -123
  55. package/src/next/jira.js +84 -84
  56. package/src/next/logger.js +17 -17
  57. package/src/next/pipline.js +114 -114
  58. package/src/next/publish.js +71 -71
  59. package/src/next/pull.js +7 -7
  60. package/src/next/sonar.js +23 -23
  61. package/src/next/test.js +5 -5
  62. package/src/next/util.js +95 -93
  63. package/src/next/vault.js +45 -45
  64. package/terraform/apply.sh +37 -37
  65. package/terraform/init.sh +72 -72
  66. package/terraform/plan.sh +76 -76
  67. package/terraform/validate.sh +17 -17
  68. package/src/micro/cli.js +0 -71
  69. package/src/micro/ms-deploy.js +0 -271
@@ -1,79 +1,79 @@
1
- import axios from 'axios';
2
- import { createAlias } from '../next/alias.js';
3
- import { getAuth0AuthToken } from './configure.js';
4
- import { getVaultSecrets } from './vault.js';
5
- import { getVaultSecretsConfigs } from '../next/config.js';
6
- import { cloneEnvRepository, readDeployConfig } from '../next/deploy.js';
7
-
8
- export async function getCCAlias({ application, auth0Domain, auth0AuthToken }) {
9
- console.log(`Forming alias name for application ${application}...`);
10
-
11
- try {
12
- const auth0Response = await axios.get(
13
- `https://${auth0Domain}/api/v2/clients`,
14
- {
15
- headers: { authorization: `Bearer ${auth0AuthToken}` },
16
- },
17
- );
18
-
19
- const appAuth0ClientIdData = auth0Response.data.find(
20
- (client) => client.name === `${application}`,
21
- );
22
- const appAuth0ClientId = appAuth0ClientIdData.client_id;
23
-
24
- console.log(`Client Credentials Alias: ${appAuth0ClientId}@clients`);
25
- return `${appAuth0ClientId}@clients`;
26
- } catch (err) {
27
- console.error(
28
- `Failed to form alias name for application: ${application}: ${err.message}`,
29
- );
30
- }
31
- }
32
-
33
- export async function configureAlias(
34
- site,
35
- env,
36
- username,
37
- password,
38
- realm,
39
- auth0Tenant,
40
- ) {
41
- console.log(`Creating alias for site: ${site} in env: ${env}`);
42
- // Site Common Secrets
43
- const siteCommonSecretsPath =
44
- getVaultSecretsConfigs(site).siteCommonSecretsPath;
45
- console.log(`siteCommonSecretsPath => ${siteCommonSecretsPath}`);
46
- const siteCommonSecrets = await getVaultSecrets(siteCommonSecretsPath);
47
-
48
- let auth0Domain;
49
- if (auth0Tenant === '') {
50
- auth0Domain = `docupace-${env}-${site}.us.auth0.com`;
51
- } else {
52
- auth0Domain = `${auth0Tenant}.us.auth0.com`;
53
- }
54
- const auth0ClientId = siteCommonSecrets.AUTH0_CLIENT_ID;
55
- const auth0ClientSecret = siteCommonSecrets.AUTH0_CLIENT_SECRET;
56
- const auth0Token = await getAuth0AuthToken(
57
- auth0Domain,
58
- auth0ClientId,
59
- auth0ClientSecret,
60
- );
61
-
62
- await cloneEnvRepository(env);
63
-
64
- const { deployConfig: deployGraphQLServerConfig } = await readDeployConfig(
65
- 'graphql-server',
66
- env,
67
- site,
68
- 'values',
69
- );
70
- const coreUrl = deployGraphQLServerConfig.graphqlServer.coreUrl;
71
-
72
- const clientCredentialsAlias = await getCCAlias({
73
- application: 'docupace-graphql-client-credentials',
74
- auth0Domain: auth0Domain,
75
- auth0AuthToken: auth0Token,
76
- });
77
-
78
- await createAlias(coreUrl, username, password, realm, clientCredentialsAlias);
79
- }
1
+ import axios from 'axios';
2
+ import { createAlias } from '../next/alias.js';
3
+ import { getAuth0AuthToken } from './configure.js';
4
+ import { getVaultSecrets } from './vault.js';
5
+ import { getVaultSecretsConfigs } from '../next/config.js';
6
+ import { cloneEnvRepository, readDeployConfig } from '../next/deploy.js';
7
+
8
+ export async function getCCAlias({ application, auth0Domain, auth0AuthToken }) {
9
+ console.log(`Forming alias name for application ${application}...`);
10
+
11
+ try {
12
+ const auth0Response = await axios.get(
13
+ `https://${auth0Domain}/api/v2/clients`,
14
+ {
15
+ headers: { authorization: `Bearer ${auth0AuthToken}` },
16
+ },
17
+ );
18
+
19
+ const appAuth0ClientIdData = auth0Response.data.find(
20
+ (client) => client.name === `${application}`,
21
+ );
22
+ const appAuth0ClientId = appAuth0ClientIdData.client_id;
23
+
24
+ console.log(`Client Credentials Alias: ${appAuth0ClientId}@clients`);
25
+ return `${appAuth0ClientId}@clients`;
26
+ } catch (err) {
27
+ console.error(
28
+ `Failed to form alias name for application: ${application}: ${err.message}`,
29
+ );
30
+ }
31
+ }
32
+
33
+ export async function configureAlias(
34
+ site,
35
+ env,
36
+ username,
37
+ password,
38
+ realm,
39
+ auth0Tenant,
40
+ ) {
41
+ console.log(`Creating alias for site: ${site} in env: ${env}`);
42
+ // Site Common Secrets
43
+ const siteCommonSecretsPath =
44
+ getVaultSecretsConfigs(site).siteCommonSecretsPath;
45
+ console.log(`siteCommonSecretsPath => ${siteCommonSecretsPath}`);
46
+ const siteCommonSecrets = await getVaultSecrets(siteCommonSecretsPath);
47
+
48
+ let auth0Domain;
49
+ if (auth0Tenant === '') {
50
+ auth0Domain = `docupace-${env}-${site}.us.auth0.com`;
51
+ } else {
52
+ auth0Domain = `${auth0Tenant}.us.auth0.com`;
53
+ }
54
+ const auth0ClientId = siteCommonSecrets.AUTH0_CLIENT_ID;
55
+ const auth0ClientSecret = siteCommonSecrets.AUTH0_CLIENT_SECRET;
56
+ const auth0Token = await getAuth0AuthToken(
57
+ auth0Domain,
58
+ auth0ClientId,
59
+ auth0ClientSecret,
60
+ );
61
+
62
+ await cloneEnvRepository(env);
63
+
64
+ const { deployConfig: deployGraphQLServerConfig } = await readDeployConfig(
65
+ 'graphql-server',
66
+ env,
67
+ site,
68
+ 'values',
69
+ );
70
+ const coreUrl = deployGraphQLServerConfig.graphqlServer.coreUrl;
71
+
72
+ const clientCredentialsAlias = await getCCAlias({
73
+ application: 'docupace-graphql-client-credentials',
74
+ auth0Domain: auth0Domain,
75
+ auth0AuthToken: auth0Token,
76
+ });
77
+
78
+ await createAlias(coreUrl, username, password, realm, clientCredentialsAlias);
79
+ }
@@ -1,172 +1,172 @@
1
- // alias.test.js
2
- import { jest } from '@jest/globals';
3
-
4
- // --------- ESM-Compatible Mocks ---------
5
- jest.unstable_mockModule('axios', () => ({
6
- default: {
7
- get: jest.fn(),
8
- },
9
- }));
10
-
11
- jest.unstable_mockModule('../next/alias.js', () => ({
12
- createAlias: jest.fn(),
13
- }));
14
-
15
- jest.unstable_mockModule('./configure.js', () => ({
16
- getAuth0AuthToken: jest.fn(),
17
- }));
18
-
19
- jest.unstable_mockModule('./vault.js', () => ({
20
- getVaultSecrets: jest.fn(),
21
- }));
22
-
23
- jest.unstable_mockModule('../next/config.js', () => ({
24
- getVaultSecretsConfigs: jest.fn(),
25
- }));
26
-
27
- jest.unstable_mockModule('../next/deploy.js', () => ({
28
- cloneEnvRepository: jest.fn(),
29
- readDeployConfig: jest.fn(),
30
- }));
31
-
32
- // --------- Import AFTER mocks ---------
33
- const { configureAlias, getCCAlias } = await import('./alias.js');
34
- const axios = (await import('axios')).default;
35
- const { createAlias } = await import('../next/alias.js');
36
- const { getAuth0AuthToken } = await import('./configure.js');
37
- const { getVaultSecrets } = await import('./vault.js');
38
- const { getVaultSecretsConfigs } = await import('../next/config.js');
39
- const { cloneEnvRepository, readDeployConfig } = await import(
40
- '../next/deploy.js'
41
- );
42
-
43
- // --------- Shared Test Setup ---------
44
- beforeAll(() => {
45
- jest.spyOn(console, 'log').mockImplementation(() => {}); // silence logs
46
- });
47
-
48
- afterAll(() => {
49
- console.log.mockRestore();
50
- });
51
-
52
- describe('configureAlias', () => {
53
- const site = 'example';
54
- const env = 'dev';
55
- const username = 'admin';
56
- const password = 'pass';
57
- const realm = 'Users';
58
- const auth0Tenant = '';
59
-
60
- const mockSecrets = {
61
- AUTH0_CLIENT_ID: 'client-id',
62
- AUTH0_CLIENT_SECRET: 'client-secret',
63
- };
64
-
65
- const mockToken = 'mocked-auth0-token';
66
-
67
- const mockClients = [
68
- { name: 'docupace-graphql-client-credentials', client_id: 'client-123' },
69
- ];
70
-
71
- const mockConfig = {
72
- deployConfig: {
73
- graphqlServer: {
74
- coreUrl: 'https://core.example.com',
75
- },
76
- },
77
- };
78
-
79
- beforeEach(() => {
80
- jest.clearAllMocks();
81
-
82
- getVaultSecretsConfigs.mockReturnValue({
83
- siteCommonSecretsPath: 'vault/path/to/secrets',
84
- });
85
-
86
- getVaultSecrets.mockResolvedValue(mockSecrets);
87
- getAuth0AuthToken.mockResolvedValue(mockToken);
88
- axios.get.mockResolvedValue({ data: mockClients });
89
- cloneEnvRepository.mockResolvedValue(undefined);
90
- readDeployConfig.mockResolvedValue(mockConfig);
91
- createAlias.mockResolvedValue(undefined);
92
- });
93
-
94
- it('should configure alias with default tenant and call all required steps', async () => {
95
- await configureAlias(site, env, username, password, realm, auth0Tenant);
96
-
97
- expect(getVaultSecretsConfigs).toHaveBeenCalledWith(site);
98
- expect(getVaultSecrets).toHaveBeenCalledWith('vault/path/to/secrets');
99
-
100
- expect(getAuth0AuthToken).toHaveBeenCalledWith(
101
- 'docupace-dev-example.us.auth0.com',
102
- 'client-id',
103
- 'client-secret',
104
- );
105
-
106
- expect(cloneEnvRepository).toHaveBeenCalledWith(env);
107
-
108
- expect(readDeployConfig).toHaveBeenCalledWith(
109
- 'graphql-server',
110
- env,
111
- site,
112
- 'values',
113
- );
114
-
115
- expect(axios.get).toHaveBeenCalledWith(
116
- 'https://docupace-dev-example.us.auth0.com/api/v2/clients',
117
- { headers: { authorization: `Bearer ${mockToken}` } },
118
- );
119
-
120
- expect(createAlias).toHaveBeenCalledWith(
121
- 'https://core.example.com',
122
- username,
123
- password,
124
- realm,
125
- 'client-123@clients',
126
- );
127
- });
128
- });
129
-
130
- describe('getCCAlias', () => {
131
- const application = 'docupace-graphql-client-credentials';
132
- const auth0Domain = 'example.auth0.com';
133
- const auth0AuthToken = 'token';
134
-
135
- it('should return correct alias string for client', async () => {
136
- axios.get.mockResolvedValue({
137
- data: [{ name: application, client_id: 'abc123' }],
138
- });
139
-
140
- const alias = await getCCAlias({
141
- application,
142
- auth0Domain,
143
- auth0AuthToken,
144
- });
145
- expect(alias).toBe('abc123@clients');
146
-
147
- expect(axios.get).toHaveBeenCalledWith(
148
- 'https://example.auth0.com/api/v2/clients',
149
- { headers: { authorization: 'Bearer token' } },
150
- );
151
- });
152
-
153
- it('should log error and return undefined if axios fails', async () => {
154
- axios.get.mockRejectedValue(new Error('Network error'));
155
- const errorSpy = jest.spyOn(console, 'error').mockImplementation(() => {});
156
-
157
- const result = await getCCAlias({
158
- application,
159
- auth0Domain,
160
- auth0AuthToken,
161
- });
162
- expect(result).toBeUndefined();
163
-
164
- expect(errorSpy).toHaveBeenCalledWith(
165
- expect.stringContaining(
166
- 'Failed to form alias name for application: docupace-graphql-client-credentials: Network error',
167
- ),
168
- );
169
-
170
- errorSpy.mockRestore();
171
- });
172
- });
1
+ // alias.test.js
2
+ import { jest } from '@jest/globals';
3
+
4
+ // --------- ESM-Compatible Mocks ---------
5
+ jest.unstable_mockModule('axios', () => ({
6
+ default: {
7
+ get: jest.fn(),
8
+ },
9
+ }));
10
+
11
+ jest.unstable_mockModule('../next/alias.js', () => ({
12
+ createAlias: jest.fn(),
13
+ }));
14
+
15
+ jest.unstable_mockModule('./configure.js', () => ({
16
+ getAuth0AuthToken: jest.fn(),
17
+ }));
18
+
19
+ jest.unstable_mockModule('./vault.js', () => ({
20
+ getVaultSecrets: jest.fn(),
21
+ }));
22
+
23
+ jest.unstable_mockModule('../next/config.js', () => ({
24
+ getVaultSecretsConfigs: jest.fn(),
25
+ }));
26
+
27
+ jest.unstable_mockModule('../next/deploy.js', () => ({
28
+ cloneEnvRepository: jest.fn(),
29
+ readDeployConfig: jest.fn(),
30
+ }));
31
+
32
+ // --------- Import AFTER mocks ---------
33
+ const { configureAlias, getCCAlias } = await import('./alias.js');
34
+ const axios = (await import('axios')).default;
35
+ const { createAlias } = await import('../next/alias.js');
36
+ const { getAuth0AuthToken } = await import('./configure.js');
37
+ const { getVaultSecrets } = await import('./vault.js');
38
+ const { getVaultSecretsConfigs } = await import('../next/config.js');
39
+ const { cloneEnvRepository, readDeployConfig } = await import(
40
+ '../next/deploy.js'
41
+ );
42
+
43
+ // --------- Shared Test Setup ---------
44
+ beforeAll(() => {
45
+ jest.spyOn(console, 'log').mockImplementation(() => {}); // silence logs
46
+ });
47
+
48
+ afterAll(() => {
49
+ console.log.mockRestore();
50
+ });
51
+
52
+ describe('configureAlias', () => {
53
+ const site = 'example';
54
+ const env = 'dev';
55
+ const username = 'admin';
56
+ const password = 'pass';
57
+ const realm = 'Users';
58
+ const auth0Tenant = '';
59
+
60
+ const mockSecrets = {
61
+ AUTH0_CLIENT_ID: 'client-id',
62
+ AUTH0_CLIENT_SECRET: 'client-secret',
63
+ };
64
+
65
+ const mockToken = 'mocked-auth0-token';
66
+
67
+ const mockClients = [
68
+ { name: 'docupace-graphql-client-credentials', client_id: 'client-123' },
69
+ ];
70
+
71
+ const mockConfig = {
72
+ deployConfig: {
73
+ graphqlServer: {
74
+ coreUrl: 'https://core.example.com',
75
+ },
76
+ },
77
+ };
78
+
79
+ beforeEach(() => {
80
+ jest.clearAllMocks();
81
+
82
+ getVaultSecretsConfigs.mockReturnValue({
83
+ siteCommonSecretsPath: 'vault/path/to/secrets',
84
+ });
85
+
86
+ getVaultSecrets.mockResolvedValue(mockSecrets);
87
+ getAuth0AuthToken.mockResolvedValue(mockToken);
88
+ axios.get.mockResolvedValue({ data: mockClients });
89
+ cloneEnvRepository.mockResolvedValue(undefined);
90
+ readDeployConfig.mockResolvedValue(mockConfig);
91
+ createAlias.mockResolvedValue(undefined);
92
+ });
93
+
94
+ it('should configure alias with default tenant and call all required steps', async () => {
95
+ await configureAlias(site, env, username, password, realm, auth0Tenant);
96
+
97
+ expect(getVaultSecretsConfigs).toHaveBeenCalledWith(site);
98
+ expect(getVaultSecrets).toHaveBeenCalledWith('vault/path/to/secrets');
99
+
100
+ expect(getAuth0AuthToken).toHaveBeenCalledWith(
101
+ 'docupace-dev-example.us.auth0.com',
102
+ 'client-id',
103
+ 'client-secret',
104
+ );
105
+
106
+ expect(cloneEnvRepository).toHaveBeenCalledWith(env);
107
+
108
+ expect(readDeployConfig).toHaveBeenCalledWith(
109
+ 'graphql-server',
110
+ env,
111
+ site,
112
+ 'values',
113
+ );
114
+
115
+ expect(axios.get).toHaveBeenCalledWith(
116
+ 'https://docupace-dev-example.us.auth0.com/api/v2/clients',
117
+ { headers: { authorization: `Bearer ${mockToken}` } },
118
+ );
119
+
120
+ expect(createAlias).toHaveBeenCalledWith(
121
+ 'https://core.example.com',
122
+ username,
123
+ password,
124
+ realm,
125
+ 'client-123@clients',
126
+ );
127
+ });
128
+ });
129
+
130
+ describe('getCCAlias', () => {
131
+ const application = 'docupace-graphql-client-credentials';
132
+ const auth0Domain = 'example.auth0.com';
133
+ const auth0AuthToken = 'token';
134
+
135
+ it('should return correct alias string for client', async () => {
136
+ axios.get.mockResolvedValue({
137
+ data: [{ name: application, client_id: 'abc123' }],
138
+ });
139
+
140
+ const alias = await getCCAlias({
141
+ application,
142
+ auth0Domain,
143
+ auth0AuthToken,
144
+ });
145
+ expect(alias).toBe('abc123@clients');
146
+
147
+ expect(axios.get).toHaveBeenCalledWith(
148
+ 'https://example.auth0.com/api/v2/clients',
149
+ { headers: { authorization: 'Bearer token' } },
150
+ );
151
+ });
152
+
153
+ it('should log error and return undefined if axios fails', async () => {
154
+ axios.get.mockRejectedValue(new Error('Network error'));
155
+ const errorSpy = jest.spyOn(console, 'error').mockImplementation(() => {});
156
+
157
+ const result = await getCCAlias({
158
+ application,
159
+ auth0Domain,
160
+ auth0AuthToken,
161
+ });
162
+ expect(result).toBeUndefined();
163
+
164
+ expect(errorSpy).toHaveBeenCalledWith(
165
+ expect.stringContaining(
166
+ 'Failed to form alias name for application: docupace-graphql-client-credentials: Network error',
167
+ ),
168
+ );
169
+
170
+ errorSpy.mockRestore();
171
+ });
172
+ });
package/src/auth0/cli.js CHANGED
@@ -1,82 +1,82 @@
1
- #!/usr/bin/env node
2
-
3
- import { Command } from 'commander';
4
- import { configureFromSite } from './configure.js';
5
- import { getVaultSecrets } from './vault.js';
6
-
7
- import dotenv from 'dotenv';
8
- import { configureAlias } from './alias.js';
9
- import { exportConf } from './export.js';
10
- import { getAuth0Metadata } from './metadata.js';
11
-
12
- dotenv.config({ path: ['.env.pipeline.local', 'config/.env.pipeline.local'] });
13
-
14
- const program = new Command();
15
-
16
- program
17
- .command(
18
- 'configureFromSite <fromSite> <toSite> <fromEnv> <toEnv> <deployUI> <deployGraphQLServer> <useNewDomain> <useS3Ui> <deployCCUI> <useS3Gq> [auth0Tenant]',
19
- )
20
- .description('Configure the Auth0 tenants in env for the given site')
21
- .action(
22
- async (
23
- fromSite,
24
- toSite,
25
- fromEnv,
26
- toEnv,
27
- deployUI,
28
- deployGraphQLServer,
29
- useNewDomain,
30
- useS3Ui,
31
- deployCCUI,
32
- useS3Gq,
33
- auth0Tenant = '',
34
- ) => {
35
- await configureFromSite(
36
- fromSite,
37
- toSite,
38
- fromEnv,
39
- toEnv,
40
- deployUI,
41
- deployGraphQLServer,
42
- useNewDomain,
43
- useS3Ui === 'true' || useS3Ui === true,
44
- deployCCUI,
45
- useS3Gq === 'true' || useS3Gq === true,
46
- auth0Tenant,
47
- );
48
- },
49
- );
50
-
51
- program
52
- .command('getVaultSecrets <vaultPath>')
53
- .description('Get Secrets for Vault PATH')
54
- .action(async (vaultPath) => {
55
- const data = await getVaultSecrets(vaultPath);
56
- console.log(JSON.stringify(data, 'null', 2));
57
- });
58
-
59
- program
60
- .command(
61
- 'configureAlias <site> <env> <username> <password> <realm> [auth0Tenant]',
62
- )
63
- .description('Configure Core Alias for the given site')
64
- .action(async (site, env, username, password, realm, auth0Tenant = '') => {
65
- await configureAlias(site, env, username, password, realm, auth0Tenant);
66
- });
67
-
68
- program
69
- .command('exportConf <site> <env> [auth0Tenant]')
70
- .description('Export Auth0 configuration for the given site')
71
- .action(async (site, env, auth0Tenant = '') => {
72
- await exportConf(site, env, auth0Tenant);
73
- });
74
-
75
- program
76
- .command('getAuth0Metadata <site> <env> [auth0Tenant] [jiraTicket]')
77
- .description('Get Auth0 metadata for the given site')
78
- .action(async (site, env, auth0Tenant = '', jiraTicket = '') => {
79
- await getAuth0Metadata(site, env, auth0Tenant, jiraTicket);
80
- });
81
-
82
- program.parse(process.argv);
1
+ #!/usr/bin/env node
2
+
3
+ import { Command } from 'commander';
4
+ import { configureFromSite } from './configure.js';
5
+ import { getVaultSecrets } from './vault.js';
6
+
7
+ import dotenv from 'dotenv';
8
+ import { configureAlias } from './alias.js';
9
+ import { exportConf } from './export.js';
10
+ import { getAuth0Metadata } from './metadata.js';
11
+
12
+ dotenv.config({ path: ['.env.pipeline.local', 'config/.env.pipeline.local'] });
13
+
14
+ const program = new Command();
15
+
16
+ program
17
+ .command(
18
+ 'configureFromSite <fromSite> <toSite> <fromEnv> <toEnv> <deployUI> <deployGraphQLServer> <useNewDomain> <useS3Ui> <deployCCUI> <useS3Gq> [auth0Tenant]',
19
+ )
20
+ .description('Configure the Auth0 tenants in env for the given site')
21
+ .action(
22
+ async (
23
+ fromSite,
24
+ toSite,
25
+ fromEnv,
26
+ toEnv,
27
+ deployUI,
28
+ deployGraphQLServer,
29
+ useNewDomain,
30
+ useS3Ui,
31
+ deployCCUI,
32
+ useS3Gq,
33
+ auth0Tenant = '',
34
+ ) => {
35
+ await configureFromSite(
36
+ fromSite,
37
+ toSite,
38
+ fromEnv,
39
+ toEnv,
40
+ deployUI,
41
+ deployGraphQLServer,
42
+ useNewDomain,
43
+ useS3Ui === 'true' || useS3Ui === true,
44
+ deployCCUI,
45
+ useS3Gq === 'true' || useS3Gq === true,
46
+ auth0Tenant,
47
+ );
48
+ },
49
+ );
50
+
51
+ program
52
+ .command('getVaultSecrets <vaultPath>')
53
+ .description('Get Secrets for Vault PATH')
54
+ .action(async (vaultPath) => {
55
+ const data = await getVaultSecrets(vaultPath);
56
+ console.log(JSON.stringify(data, 'null', 2));
57
+ });
58
+
59
+ program
60
+ .command(
61
+ 'configureAlias <site> <env> <username> <password> <realm> [auth0Tenant]',
62
+ )
63
+ .description('Configure Core Alias for the given site')
64
+ .action(async (site, env, username, password, realm, auth0Tenant = '') => {
65
+ await configureAlias(site, env, username, password, realm, auth0Tenant);
66
+ });
67
+
68
+ program
69
+ .command('exportConf <site> <env> [auth0Tenant]')
70
+ .description('Export Auth0 configuration for the given site')
71
+ .action(async (site, env, auth0Tenant = '') => {
72
+ await exportConf(site, env, auth0Tenant);
73
+ });
74
+
75
+ program
76
+ .command('getAuth0Metadata <site> <env> [auth0Tenant] [jiraTicket]')
77
+ .description('Get Auth0 metadata for the given site')
78
+ .action(async (site, env, auth0Tenant = '', jiraTicket = '') => {
79
+ await getAuth0Metadata(site, env, auth0Tenant, jiraTicket);
80
+ });
81
+
82
+ program.parse(process.argv);