@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
package/README.md DELETED
@@ -1,136 +0,0 @@
1
- # Pipeline Shared Scripts
2
-
3
- A collection of CLI tools for Docupace's CI/CD pipelines and deployment workflows.
4
-
5
- ## Overview
6
-
7
- This package provides a set of command-line interfaces (CLIs) to facilitate various DevOps operations in the Docupace ecosystem:
8
-
9
- - `dp-next-cli`: Deployment and pipeline management for Next applications
10
- - `dp-changeset-cli`: Versioning and changeset management
11
- - `dp-auth0-cli`: Auth0 tenant configuration and management
12
-
13
- ## Installation
14
-
15
- ```bash
16
- npm install @docupace/pipeline
17
- ```
18
-
19
- Or with pnpm:
20
-
21
- ```bash
22
- pnpm add @docupace/pipeline
23
- ```
24
-
25
- ## Command Line Interfaces
26
-
27
- ### dp-next-cli
28
-
29
- Manages deployment, Docker image handling, and infrastructure configuration.
30
-
31
- ```bash
32
- dp-next-cli [command] [options]
33
- ```
34
-
35
- **Commands:**
36
-
37
- - `pull <imageName>`: Pull a Docker image from the registry
38
- - `sonar`: Run Sonar analysis
39
- - `addApacheSite`: Add site to apache
40
- - `connectClone`: Clone connect site
41
- - `haproxySync`: Sync haproxy config
42
- - `vaultAddSiteData`: Add m2m auth0 data to vault
43
- - `-s, --site-name <siteName>`: Site name
44
- - `-p, --site-config-remote-path <path>`: Site config remote path
45
- - `publish`: Publish a Docker image
46
- - `deploy-from-site`: Deploy an application for a specific site
47
- - `-f, --from-env <fromEnv>`: Source environment
48
- - `-t, --to-env <toEnv>`: Target environment
49
- - `-F, --from-site <fromSite>`: Source site
50
- - `-T, --to-site <toSite>`: Target site
51
- - `-c, --deploy-core <deployCore>`: Deploy Core (default: "false")
52
- - `-C, --deploy-connect <deployConnect>`: Deploy Connect (default: "false")
53
- - `deploy-template`: Deploy an application for a specific site
54
- - `deploy-app <application>`: Deploy an application for a specific site
55
- - `deploy-core <env> <site>`: Deploy Core
56
- - `-l, --liquibase <liquibase>`: Application name (default: "true")
57
- - `-b, --branch <branch>`: Branch (default: "master")
58
- - `deploy-connect <env> <site>`: Deploy Connect
59
- - `-l, --liquibase <liquibase>`: Application name (default: "true")
60
- - `-b, --branch <branch>`: Branch (default: "master")
61
- - `deploy-core-pipeline <env> <site>`: Deploy Core via pipeline
62
- - `-l, --liquibase <liquibase>`: Application name (default: "true")
63
- - `-b, --branch <branch>`: Branch (default: "master")
64
- - `copy`: Copy a Docker image between registries
65
- - `-a, --application <application>`: Application name
66
- - `-f, --from-env <fromEnv>`: Source environment
67
- - `-t, --to-env <toEnv>`: Target environment
68
- - `-g, --tag <tag>`: Image tag
69
- - `run-pipeline`: Trigger a pipeline by name
70
- - `-r, --repository <repository>`: Repository name
71
- - `-p, --pipeline-name <pipelineName>`: Pipeline name
72
- - `-b, --branch <branch>`: Branch name
73
- - `-v, --variables <key=value>`: Pipeline variable as key=value pair
74
- - `-w, --wait`: Wait for the pipeline to complete (default: false)
75
-
76
- ### dp-changeset-cli
77
-
78
- Manages versioning and changesets for mono-repos and single-package repos.
79
-
80
- ```bash
81
- dp-changeset-cli [command] [options]
82
- ```
83
-
84
- **Commands:**
85
-
86
- - `validate`: Validate changesets for the provided PR
87
- - `version`: Run Changeset versioning
88
- - `commit-tag`: Commit and tag the new version
89
- - `version-commit-tag`: Run versioning and commit-and-tag in sequence
90
- - `close-version`: Close a version and create a release branch
91
- - `create-changeset`: Create a changeset based on the current branch and Jira ticket information
92
-
93
- ### dp-auth0-cli
94
-
95
- Manages Auth0 tenant configuration across environments.
96
-
97
- ```bash
98
- dp-auth0-cli [command] [options]
99
- ```
100
-
101
- **Commands:**
102
-
103
- - `configureFromSite <fromSite> <toSite> <fromEnv> <toEnv> <deployUI> <deployGraphQLServer> <useNewDomain> <useS3>`: Configure Auth0 tenants
104
- - `getVaultSecrets <vaultPath>`: Get secrets from Vault
105
- - `configureAlias <site> <env> <username> <password> <realm>`: Configure Core Alias for the given site
106
- - `exportConf <site> <env>`: Export Auth0 configuration for the given site
107
- - `getAuth0Metadata <site> <env>`: Get Auth0 metadata for the given site
108
-
109
- ## Environment Configuration
110
-
111
- The CLI tools look for environment configuration in the following locations:
112
- - `.env.pipeline.local`
113
- - `config/.env.pipeline.local`
114
-
115
- ## Examples
116
-
117
- ```bash
118
- # Deploy from one site to another
119
- dp-next-cli deploy-from-site --from-env dev --to-env dev --from-site financialdev --to-site template --deploy-core true
120
-
121
- # Run a pipeline
122
- dp-next-cli run-pipeline -r docupace-next-e2e -b master -p run-tests-qa
123
-
124
- # Validate changesets
125
- dp-changeset-cli validate
126
-
127
- # Create a new changeset
128
- dp-changeset-cli create-changeset
129
-
130
- # Configure Auth0 for a site
131
- dp-auth0-cli configureFromSite sourceSite targetSite dev prod true true true false
132
- ```
133
-
134
- ## License
135
-
136
- ISC
@@ -1,58 +0,0 @@
1
- #!/bin/bash
2
- set -e
3
-
4
- ENV=$1
5
-
6
- if [ -z "$ENV" ]; then
7
- echo "Usage: $0 <environment>"
8
- exit 1
9
- fi
10
-
11
- TENANT_ID="docupace.onmicrosoft.com"
12
- CLIENT_ID=$ARM_CLIENT_ID
13
- CLIENT_SECRET=$ARM_CLIENT_SECRET
14
- NEW_REDIRECT="https://docupace-$ENV-$SITE_NAME.us.auth0.com/login/callback"
15
- APP_ID="auth0-$ENV-docupace"
16
- APP_SCOPE="https://graph.microsoft.com/.default"
17
- GRAPH_API="https://graph.microsoft.com/v1.0"
18
-
19
- ACCESS_TOKEN=$(curl -s -X POST \
20
- -H "Content-Type: application/x-www-form-urlencoded" \
21
- -d "grant_type=client_credentials&client_id=$CLIENT_ID&client_secret=$CLIENT_SECRET&scope=$APP_SCOPE" \
22
- https://login.microsoftonline.com/$TENANT_ID/oauth2/v2.0/token | jq -r '.access_token')
23
-
24
- APP_DETAILS=$(curl -s -G "https://graph.microsoft.com/v1.0/applications" \
25
- -H "Authorization: Bearer $ACCESS_TOKEN" \
26
- -H "Content-Type: application/json" \
27
- --data-urlencode "\$filter=appId eq '$CLIENT_ID'")
28
-
29
- APP_ID=$(echo "$APP_DETAILS" | jq -r '.value[0].id')
30
- echo "Application ID: $APP_ID"
31
-
32
- CURRENT_REDIRECTS=$(echo "$APP_DETAILS" | jq -r '.value[0].web.redirectUris // []')
33
- echo "Current redirect URIs: $CURRENT_REDIRECTS"
34
-
35
- if echo "$CURRENT_REDIRECTS" | jq -e --arg uri "$NEW_REDIRECT" 'index($uri)' > /dev/null; then
36
- echo "Redirect URI '$NEW_REDIRECT' already exists. No update needed."
37
- else
38
- UPDATED_REDIRECTS=$(echo "$CURRENT_REDIRECTS" | jq --arg uri "$NEW_REDIRECT" '. + [$uri]')
39
- echo "Updated redirect URIs: $UPDATED_REDIRECTS"
40
-
41
- UPDATE_REDIRECTS=$(curl -fs -X PATCH \
42
- -H "Authorization: Bearer $ACCESS_TOKEN" \
43
- -H "Content-Type: application/json" \
44
- -d "{
45
- \"web\": {
46
- \"redirectUris\": $UPDATED_REDIRECTS
47
- }
48
- }" \
49
- "https://graph.microsoft.com/v1.0/applications/$APP_ID")
50
-
51
- if [ $? -eq 0 ]; then
52
- echo "Successfully updated redirect URIs"
53
- echo $UPDATE_REDIRECTS
54
- else
55
- echo "Failed to update redirect URIs"
56
- echo $UPDATE_REDIRECTS
57
- fi
58
- fi
@@ -1,60 +0,0 @@
1
- # bitbucket-pipelines.yml
2
- clone:
3
- depth: 2
4
-
5
- pipelines:
6
- pull-requests:
7
- '**':
8
- - step:
9
- runs-on:
10
- - self.hosted
11
- - linux.shell
12
- name: On Pull Request
13
- script:
14
- - npm install -g pnpm
15
- - pnpm config set //registry.npmjs.org/:_authToken $DOCUPACE_NPM_TOKEN
16
- - pnpm install --frozen-lockfile
17
- - 'npx eslint . --rule "no-unused-vars: warn" --rule "no-useless-escape: warn" --color'
18
- - pnpm test
19
- artifacts:
20
- - coverage/**
21
- after-script:
22
- - echo "Pipeline completed with status $BITBUCKET_EXIT_CODE"
23
-
24
- custom:
25
- scheduled-tests:
26
- - step:
27
- runs-on:
28
- - self.hosted
29
- - linux.shell
30
- name: Scheduled Tests
31
- script:
32
- - npm install -g pnpm
33
- - pnpm config set //registry.npmjs.org/:_authToken $DOCUPACE_NPM_TOKEN
34
- - pnpm install --frozen-lockfile
35
- - 'npx eslint . --rule "no-unused-vars: warn" --rule "no-useless-escape: warn" --color'
36
- - pnpm test
37
- artifacts:
38
- - coverage/**
39
- after-script:
40
- - echo "Pipeline completed with status $BITBUCKET_EXIT_CODE"
41
-
42
- branches:
43
- main:
44
- - step:
45
- runs-on:
46
- - self.hosted
47
- - linux.shell
48
- name: Main Branch Build
49
- script:
50
- - npm install -g pnpm
51
- - pnpm config set //registry.npmjs.org/:_authToken $DOCUPACE_NPM_TOKEN
52
- - pnpm install --frozen-lockfile
53
- - 'npx eslint . --rule "no-unused-vars: warn" --rule "no-useless-escape: warn" --color'
54
- - pnpm test
55
- artifacts:
56
- - coverage/**
57
-
58
- definitions:
59
- caches:
60
- pnpm: ~/.pnpm-store
package/jest.config.js DELETED
@@ -1,15 +0,0 @@
1
- // jest.config.js
2
- export default {
3
- testEnvironment: 'node',
4
- transform: {},
5
- verbose: true,
6
- collectCoverage: true,
7
- coverageDirectory: 'coverage',
8
- coverageReporters: ['text', 'lcov', 'json', 'html'],
9
- collectCoverageFrom: [
10
- 'src/**/*.{js,ts}',
11
- '!src/**/cli.js',
12
- '!src/**/*.test.{js,ts}',
13
- '!**/node_modules/**',
14
- ],
15
- };
@@ -1,79 +0,0 @@
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 +0,0 @@
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 DELETED
@@ -1,82 +0,0 @@
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);