@docupace/pipeline 1.0.130 → 1.0.132
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.
- package/.gitignore +105 -0
- package/package.json +1 -1
- package/src/auth0/metadata.js +5 -2
- package/src/auth0/metadata.test.js +5 -2
- package/src/changeset/cli.js +26 -0
- package/src/next/config.js +11 -2
- package/src/next/connect.js +3 -2
- package/src/next/deploy.js +2 -1
- package/src/next/deploy.test.js +1 -0
package/.gitignore
ADDED
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
|
|
2
|
+
|
|
3
|
+
# IDE
|
|
4
|
+
.idea
|
|
5
|
+
*.iml
|
|
6
|
+
# Dependencies
|
|
7
|
+
/node_modules
|
|
8
|
+
/.pnp
|
|
9
|
+
.pnp.js
|
|
10
|
+
|
|
11
|
+
# Testing
|
|
12
|
+
/coverage
|
|
13
|
+
|
|
14
|
+
# Next.js
|
|
15
|
+
/.next/
|
|
16
|
+
/out/
|
|
17
|
+
|
|
18
|
+
# Production
|
|
19
|
+
/build
|
|
20
|
+
/dist
|
|
21
|
+
|
|
22
|
+
# Misc
|
|
23
|
+
.DS_Store
|
|
24
|
+
*.pem
|
|
25
|
+
cypress/screenshots/
|
|
26
|
+
|
|
27
|
+
# Debug
|
|
28
|
+
npm-debug.log*
|
|
29
|
+
yarn-debug.log*
|
|
30
|
+
yarn-error.log*
|
|
31
|
+
|
|
32
|
+
# Local env files
|
|
33
|
+
.env*.local
|
|
34
|
+
|
|
35
|
+
# Vercel
|
|
36
|
+
.vercel
|
|
37
|
+
|
|
38
|
+
# Typescript
|
|
39
|
+
*.tsbuildinfo
|
|
40
|
+
next-env.d.ts
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
# Logs
|
|
44
|
+
logs
|
|
45
|
+
*.log
|
|
46
|
+
|
|
47
|
+
# Runtime data
|
|
48
|
+
pids
|
|
49
|
+
*.pid
|
|
50
|
+
*.seed
|
|
51
|
+
|
|
52
|
+
# Directory for instrumented libs generated by jscoverage/JSCover
|
|
53
|
+
lib-cov
|
|
54
|
+
|
|
55
|
+
# Coverage directory used by tools like istanbul
|
|
56
|
+
coverage
|
|
57
|
+
|
|
58
|
+
# nyc test coverage
|
|
59
|
+
.nyc_output
|
|
60
|
+
|
|
61
|
+
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
|
|
62
|
+
.grunt
|
|
63
|
+
|
|
64
|
+
# node-waf configuration
|
|
65
|
+
.lock-wscript
|
|
66
|
+
|
|
67
|
+
# Compiled binary addons (http://nodejs.org/api/addons.html)
|
|
68
|
+
build/Release
|
|
69
|
+
|
|
70
|
+
# Dependency directories
|
|
71
|
+
node_modules
|
|
72
|
+
jspm_packages
|
|
73
|
+
|
|
74
|
+
# Optional npm cache directory
|
|
75
|
+
.npm
|
|
76
|
+
|
|
77
|
+
# Optional REPL history
|
|
78
|
+
.node_repl_history
|
|
79
|
+
.next
|
|
80
|
+
|
|
81
|
+
scratch
|
|
82
|
+
|
|
83
|
+
# visual studio code
|
|
84
|
+
.vscode/
|
|
85
|
+
|
|
86
|
+
src/gql/graphql.js
|
|
87
|
+
.yalc/
|
|
88
|
+
yalc.lock
|
|
89
|
+
|
|
90
|
+
.last-run.json
|
|
91
|
+
|
|
92
|
+
test-results
|
|
93
|
+
coverage-reports
|
|
94
|
+
.sonar
|
|
95
|
+
.v8-coverage
|
|
96
|
+
/assets
|
|
97
|
+
tests/lib/data/auth.json
|
|
98
|
+
|
|
99
|
+
failed-tests.json
|
|
100
|
+
|
|
101
|
+
/tmp
|
|
102
|
+
|
|
103
|
+
.claude
|
|
104
|
+
|
|
105
|
+
.run
|
package/package.json
CHANGED
package/src/auth0/metadata.js
CHANGED
|
@@ -4,11 +4,14 @@ import * as path from 'node:path'; // ESM-compatible import
|
|
|
4
4
|
import { cloneRepository, pushDeployConfig } from '../next/deploy.js';
|
|
5
5
|
import { getAuth0AuthToken } from './configure.js';
|
|
6
6
|
import { getVaultSecrets } from './vault.js';
|
|
7
|
-
import {
|
|
7
|
+
import {
|
|
8
|
+
connectDeployRepoName,
|
|
9
|
+
getVaultSecretsConfigs,
|
|
10
|
+
} from '../next/config.js';
|
|
8
11
|
|
|
9
12
|
export async function getAuth0Metadata(site, env, auth0Tenant, jiraTicket) {
|
|
10
13
|
try {
|
|
11
|
-
const connectDeployRepoPath = await cloneRepository(
|
|
14
|
+
const connectDeployRepoPath = await cloneRepository(connectDeployRepoName);
|
|
12
15
|
|
|
13
16
|
const envMap = {
|
|
14
17
|
dev: 'dev',
|
|
@@ -34,6 +34,7 @@ jest.unstable_mockModule('./vault.js', () => ({
|
|
|
34
34
|
|
|
35
35
|
jest.unstable_mockModule('../next/config.js', () => ({
|
|
36
36
|
getVaultSecretsConfigs: jest.fn(),
|
|
37
|
+
connectDeployRepoName: 'dp-eks-connect-ui-gitops',
|
|
37
38
|
}));
|
|
38
39
|
|
|
39
40
|
// ----- Imports AFTER mocks -----
|
|
@@ -43,7 +44,9 @@ const axios = (await import('axios')).default;
|
|
|
43
44
|
const { cloneRepository, pushDeployConfig } = await import('../next/deploy.js');
|
|
44
45
|
const { getAuth0AuthToken } = await import('./configure.js');
|
|
45
46
|
const { getVaultSecrets } = await import('./vault.js');
|
|
46
|
-
const { getVaultSecretsConfigs } = await import(
|
|
47
|
+
const { getVaultSecretsConfigs, connectDeployRepoName } = await import(
|
|
48
|
+
'../next/config.js'
|
|
49
|
+
);
|
|
47
50
|
|
|
48
51
|
// ----- Shared Setup -----
|
|
49
52
|
beforeAll(() => {
|
|
@@ -113,7 +116,7 @@ describe('getAuth0Metadata', () => {
|
|
|
113
116
|
|
|
114
117
|
await getAuth0Metadata(site, env, auth0Tenant);
|
|
115
118
|
|
|
116
|
-
expect(cloneRepository).toHaveBeenCalledWith(
|
|
119
|
+
expect(cloneRepository).toHaveBeenCalledWith(connectDeployRepoName);
|
|
117
120
|
expect(fs.readFile).toHaveBeenCalledWith('conf/application.conf', 'utf-8');
|
|
118
121
|
expect(fs.ensureDir).toHaveBeenCalledWith('conf/saml');
|
|
119
122
|
expect(fs.writeFile).toHaveBeenCalledWith(
|
package/src/changeset/cli.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { Command } from 'commander';
|
|
3
3
|
import { $ } from 'zx';
|
|
4
|
+
import path from 'path';
|
|
4
5
|
import { validateChangesets } from './validate.js';
|
|
5
6
|
import dotenv from 'dotenv';
|
|
6
7
|
import { isMonoRepo, setGitInfo } from '../next/util.js';
|
|
@@ -19,6 +20,26 @@ const program = new Command();
|
|
|
19
20
|
|
|
20
21
|
const args = process.argv;
|
|
21
22
|
|
|
23
|
+
async function runPostVersionScript(scriptPath, releases) {
|
|
24
|
+
if (!scriptPath || !releases?.length) {
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
const resolvedScriptPath = path.resolve(process.cwd(), scriptPath);
|
|
29
|
+
console.log(`📌 Running post-version script: ${resolvedScriptPath}`);
|
|
30
|
+
|
|
31
|
+
if (isMonoRepo()) {
|
|
32
|
+
for (const release of getAppReleases(releases)) {
|
|
33
|
+
await $`node ${resolvedScriptPath} ${release.newVersion}`;
|
|
34
|
+
}
|
|
35
|
+
} else {
|
|
36
|
+
const newVersion = releases[0]?.newVersion;
|
|
37
|
+
if (newVersion) {
|
|
38
|
+
await $`node ${resolvedScriptPath} ${newVersion}`;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
22
43
|
async function commitTagCommand(releases) {
|
|
23
44
|
console.log('📌 Checking for updates to commit...');
|
|
24
45
|
|
|
@@ -157,12 +178,17 @@ program
|
|
|
157
178
|
'--install-latest',
|
|
158
179
|
'Install the latest version of @docupace/pipeline instead of the current version',
|
|
159
180
|
)
|
|
181
|
+
.option(
|
|
182
|
+
'--post-version-script <path>',
|
|
183
|
+
'Path to a JS file to run after the version is bumped but before it is committed, tagged, and pushed. Called with the new version as its first argument.',
|
|
184
|
+
)
|
|
160
185
|
.action(async (options) => {
|
|
161
186
|
console.log('📦 Running all steps...');
|
|
162
187
|
try {
|
|
163
188
|
const releases = await versionCommand(false, options.installLatest);
|
|
164
189
|
await updateJiraWithVersion(releases);
|
|
165
190
|
await updateWikiWithVersion(releases);
|
|
191
|
+
await runPostVersionScript(options.postVersionScript, releases);
|
|
166
192
|
await commitTagCommand(releases);
|
|
167
193
|
} catch (error) {
|
|
168
194
|
console.error('❌ Version-commit-tag failed:', error);
|
package/src/next/config.js
CHANGED
|
@@ -4,6 +4,13 @@ export const environments = ['dev', 'qa', 'uat', 'stage', 'prod'];
|
|
|
4
4
|
|
|
5
5
|
const UI_MONO_VERSION = '1.4.0-alpha.0';
|
|
6
6
|
|
|
7
|
+
// Non-release deploys (e.g. `build-<BITBUCKET_BUILD_NUMBER>` tags, see
|
|
8
|
+
// getDeployTag) aren't valid semver and are always cut from the current,
|
|
9
|
+
// already-migrated mono repo, so treat anything that doesn't parse as
|
|
10
|
+
// semver as newer than the split rather than letting semver.gt throw.
|
|
11
|
+
const isUiMonoVersion = (version) =>
|
|
12
|
+
semver.valid(version) ? semver.gt(version, UI_MONO_VERSION) : true;
|
|
13
|
+
|
|
7
14
|
export const environmentConfig = {
|
|
8
15
|
dev: {
|
|
9
16
|
newUrl: (site) => `https://${site}.dev.dpai.tech`,
|
|
@@ -86,7 +93,7 @@ export const appInfo = {
|
|
|
86
93
|
getAppRevision: (config) => {
|
|
87
94
|
const tag = config.image.tag;
|
|
88
95
|
const version = tag.startsWith('v') ? tag.slice(1) : tag;
|
|
89
|
-
if (
|
|
96
|
+
if (isUiMonoVersion(version)) {
|
|
90
97
|
return 'enterprise-ui-app@' + version;
|
|
91
98
|
} else {
|
|
92
99
|
return tag;
|
|
@@ -96,7 +103,7 @@ export const appInfo = {
|
|
|
96
103
|
if (config.image.repository.endsWith('/docupace-ui-main')) {
|
|
97
104
|
const tag = config.image.tag;
|
|
98
105
|
const version = tag.startsWith('v') ? tag.slice(1) : tag;
|
|
99
|
-
if (
|
|
106
|
+
if (isUiMonoVersion(version)) {
|
|
100
107
|
const parts = config.image.repository.split('/');
|
|
101
108
|
parts[2] = 'enterprise-ui-app';
|
|
102
109
|
config.image.repository = parts.join('/');
|
|
@@ -172,3 +179,5 @@ export const coreSiteEnvMap = {
|
|
|
172
179
|
};
|
|
173
180
|
|
|
174
181
|
export const autoDeployConfigName = 'auto-deploy.yaml';
|
|
182
|
+
|
|
183
|
+
export const connectDeployRepoName = 'dp-eks-connect-ui-gitops';
|
package/src/next/connect.js
CHANGED
|
@@ -3,6 +3,7 @@ import fs from 'fs-extra';
|
|
|
3
3
|
import path from 'path';
|
|
4
4
|
import { $ } from 'zx';
|
|
5
5
|
import { getVaultSecrets } from '../auth0/vault.js';
|
|
6
|
+
import { connectDeployRepoName } from './config.js';
|
|
6
7
|
|
|
7
8
|
process.env.COMMON_VAULT_PATH =
|
|
8
9
|
process.env.COMMON_VAULT_PATH || 'secret/data/common/config';
|
|
@@ -109,9 +110,9 @@ export async function connectClone() {
|
|
|
109
110
|
process.env.AUTH0_DOMAIN = `docupace-${idpEnvMap[process.env.BUILD_ENVIRONMENT]}-${process.env.BUILD_SITE}.${process.env.AUTH0_REGION_DOMAIN}`;
|
|
110
111
|
|
|
111
112
|
const projectRoot = process.cwd();
|
|
112
|
-
// 4) Clone
|
|
113
|
+
// 4) Clone connect deploy repo into CONNECT_DIR
|
|
113
114
|
|
|
114
|
-
await gitCheckout(
|
|
115
|
+
await gitCheckout(connectDeployRepoName, process.env.CONNECT_DIR);
|
|
115
116
|
|
|
116
117
|
await gitCheckout(
|
|
117
118
|
`${siteSettingsEnvMap[connectToEnv]}-site-settings`,
|
package/src/next/deploy.js
CHANGED
|
@@ -7,6 +7,7 @@ import semver from 'semver';
|
|
|
7
7
|
import { $ } from 'zx';
|
|
8
8
|
import {
|
|
9
9
|
appInfo,
|
|
10
|
+
connectDeployRepoName,
|
|
10
11
|
environmentConfig,
|
|
11
12
|
getDefaultAppInfo,
|
|
12
13
|
getRepUrl,
|
|
@@ -1188,7 +1189,7 @@ export async function deployFromSite(
|
|
|
1188
1189
|
);
|
|
1189
1190
|
if (getComparedVersion) {
|
|
1190
1191
|
console.log('Version to deploy is: ', getComparedVersion);
|
|
1191
|
-
const connectDeployPath = await cloneRepository(
|
|
1192
|
+
const connectDeployPath = await cloneRepository(connectDeployRepoName);
|
|
1192
1193
|
// update target version set to git-commit-${getCommparedVersion}}
|
|
1193
1194
|
await updateAndCommitConnectVersion(
|
|
1194
1195
|
toEnv,
|
package/src/next/deploy.test.js
CHANGED