@docupace/pipeline 1.0.77-alpha.2 → 1.0.77
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/.prettierrc.cjs +12 -12
- package/README.md +135 -135
- package/bin/azuread_update_callbacks_for_app.sh +58 -58
- package/bin/next-changeset-validate.sh +8 -8
- package/bitbucket-pipelines.yml +59 -59
- package/eslint.config.js +49 -49
- package/jest.config.js +15 -15
- package/next/changeset.sh +75 -75
- package/next/copy.sh +34 -34
- package/next/deploy.sh +40 -40
- package/next/execute.sh +123 -123
- package/next/sonar.sh +23 -23
- package/package.json +1 -1
- package/src/auth0/alias.js +79 -79
- package/src/auth0/alias.test.js +172 -172
- package/src/auth0/cli.js +82 -82
- package/src/auth0/configure.js +902 -902
- package/src/auth0/configure.test.js +167 -167
- package/src/auth0/export.js +48 -48
- package/src/auth0/export.test.js +103 -103
- package/src/auth0/metadata.js +141 -141
- package/src/auth0/metadata.test.js +186 -186
- package/src/auth0/vault.js +60 -60
- package/src/auth0/vault.test.js +134 -134
- package/src/changeset/changelog-wiki.js +328 -328
- package/src/changeset/changeset-config.js +34 -34
- package/src/changeset/cli.js +237 -237
- package/src/changeset/create.js +215 -215
- package/src/changeset/package-util.js +87 -87
- package/src/changeset/util.js +43 -43
- package/src/changeset/validate.js +91 -91
- package/src/changeset/version.js +102 -102
- package/src/jenkins/setParams.groovy +58 -58
- package/src/lib/merge-driver.js +204 -204
- package/src/merge/cli-merge-all.js +507 -507
- package/src/merge/cli-merge.js +492 -492
- package/src/merge/cli-resolve.js +399 -399
- package/src/merge/cli.js +38 -38
- package/src/merge/merge-changelog.js +87 -87
- package/src/merge/merge-package.js +106 -106
- package/src/merge/merge-types.js +82 -82
- package/src/merge/pr.js +231 -231
- package/src/micro/cli.js +71 -0
- package/src/micro/ms-deploy.js +271 -0
- package/src/micro/{publish-ms.js → ms-publish.js} +6 -8
- package/src/next/alias.js +53 -53
- package/src/next/apache.js +81 -81
- package/src/next/cli.js +1 -10
- package/src/next/config.js +137 -137
- package/src/next/connect.js +226 -226
- package/src/next/copy.js +61 -61
- package/src/next/deploy.js +633 -633
- package/src/next/git-to-semver.js +79 -79
- package/src/next/haproxy.js +76 -76
- package/src/next/jenkins.js +123 -123
- package/src/next/jira.js +84 -84
- package/src/next/logger.js +17 -17
- package/src/next/pipline.js +114 -114
- package/src/next/publish.js +71 -71
- package/src/next/pull.js +7 -7
- package/src/next/sonar.js +23 -23
- package/src/next/test.js +5 -5
- package/src/next/util.js +93 -95
- package/src/next/vault.js +45 -45
- package/terraform/apply.sh +37 -37
- package/terraform/init.sh +72 -72
- package/terraform/plan.sh +76 -76
- package/terraform/validate.sh +17 -17
- package/src/micro/deploy-microservice.js +0 -153
package/src/changeset/util.js
CHANGED
|
@@ -1,43 +1,43 @@
|
|
|
1
|
-
import path from 'path';
|
|
2
|
-
import fs from 'fs';
|
|
3
|
-
|
|
4
|
-
async function fileExists(filePath) {
|
|
5
|
-
try {
|
|
6
|
-
await fs.promises.access(filePath);
|
|
7
|
-
return true;
|
|
8
|
-
} catch {
|
|
9
|
-
return false;
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
export async function getMainPackage() {
|
|
13
|
-
const mainModulePath = process.cwd();
|
|
14
|
-
return getPackage(mainModulePath);
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
export async function getPackage(mainModulePath) {
|
|
18
|
-
if (mainModulePath) {
|
|
19
|
-
const packageJsonPath = path.join(mainModulePath, 'package.json');
|
|
20
|
-
if (await fileExists(packageJsonPath)) {
|
|
21
|
-
const fileContent = await fs.promises.readFile(packageJsonPath, 'utf-8');
|
|
22
|
-
const packageJson = JSON.parse(fileContent);
|
|
23
|
-
return packageJson;
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
throw new Error('Main package.json not found');
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
* Locates and extracts a JIRA Ticket ID from a given string.
|
|
31
|
-
* <p>
|
|
32
|
-
* The JIRA Ticket ID is expected to follow the pattern of uppercase letters (at least two) followed by a hyphen and digits (e.g., DC-1234, INFP-9).
|
|
33
|
-
* @param str the string to search for a JIRA ticket ID
|
|
34
|
-
* @returns {JIRA-TicketID|null}
|
|
35
|
-
*/
|
|
36
|
-
export function findJiraTicketId(str) {
|
|
37
|
-
if (!str) {
|
|
38
|
-
return null;
|
|
39
|
-
}
|
|
40
|
-
const regex = /([A-Z]{2,}-\d+)/;
|
|
41
|
-
const matches = str.match(regex);
|
|
42
|
-
return matches ? matches[0] : null;
|
|
43
|
-
}
|
|
1
|
+
import path from 'path';
|
|
2
|
+
import fs from 'fs';
|
|
3
|
+
|
|
4
|
+
async function fileExists(filePath) {
|
|
5
|
+
try {
|
|
6
|
+
await fs.promises.access(filePath);
|
|
7
|
+
return true;
|
|
8
|
+
} catch {
|
|
9
|
+
return false;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
export async function getMainPackage() {
|
|
13
|
+
const mainModulePath = process.cwd();
|
|
14
|
+
return getPackage(mainModulePath);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export async function getPackage(mainModulePath) {
|
|
18
|
+
if (mainModulePath) {
|
|
19
|
+
const packageJsonPath = path.join(mainModulePath, 'package.json');
|
|
20
|
+
if (await fileExists(packageJsonPath)) {
|
|
21
|
+
const fileContent = await fs.promises.readFile(packageJsonPath, 'utf-8');
|
|
22
|
+
const packageJson = JSON.parse(fileContent);
|
|
23
|
+
return packageJson;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
throw new Error('Main package.json not found');
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Locates and extracts a JIRA Ticket ID from a given string.
|
|
31
|
+
* <p>
|
|
32
|
+
* The JIRA Ticket ID is expected to follow the pattern of uppercase letters (at least two) followed by a hyphen and digits (e.g., DC-1234, INFP-9).
|
|
33
|
+
* @param str the string to search for a JIRA ticket ID
|
|
34
|
+
* @returns {JIRA-TicketID|null}
|
|
35
|
+
*/
|
|
36
|
+
export function findJiraTicketId(str) {
|
|
37
|
+
if (!str) {
|
|
38
|
+
return null;
|
|
39
|
+
}
|
|
40
|
+
const regex = /([A-Z]{2,}-\d+)/;
|
|
41
|
+
const matches = str.match(regex);
|
|
42
|
+
return matches ? matches[0] : null;
|
|
43
|
+
}
|
|
@@ -1,91 +1,91 @@
|
|
|
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
|
+
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
|
+
}
|
package/src/changeset/version.js
CHANGED
|
@@ -1,102 +1,102 @@
|
|
|
1
|
-
import { setGitInfo } from '../next/util.js';
|
|
2
|
-
import { $ } from 'zx';
|
|
3
|
-
import fs from 'fs';
|
|
4
|
-
import { updateComponentVersion } from '../next/jira.js';
|
|
5
|
-
import { findJiraTicketId } from './util.js';
|
|
6
|
-
import { revertBaseBranch, updateBaseBranch } from './changeset-config.js';
|
|
7
|
-
import semver from 'semver';
|
|
8
|
-
|
|
9
|
-
const changeSetPackage = `{
|
|
10
|
-
"name": "changeset-package",
|
|
11
|
-
"version": "1.0.0",
|
|
12
|
-
"description": "",
|
|
13
|
-
"scripts": {
|
|
14
|
-
},
|
|
15
|
-
"type": "module",
|
|
16
|
-
"keywords": [],
|
|
17
|
-
"author": "",
|
|
18
|
-
"license": "ISC",
|
|
19
|
-
"dependencies": {},
|
|
20
|
-
"devDependencies": {
|
|
21
|
-
"@changesets/cli": "^2.27.10"
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
`;
|
|
25
|
-
|
|
26
|
-
export function toShortVersion(version) {
|
|
27
|
-
const parsed = semver.parse(version);
|
|
28
|
-
if (!parsed) return null;
|
|
29
|
-
return `${parsed.major}.${parsed.minor}`;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
export async function versionStatus(sinceBranch) {
|
|
33
|
-
const outputPath = './changeset-output.json';
|
|
34
|
-
|
|
35
|
-
if (sinceBranch) {
|
|
36
|
-
await $`pnpm changeset status --output=${outputPath} --since=${sinceBranch}`;
|
|
37
|
-
} else {
|
|
38
|
-
await $`pnpm changeset status --output=${outputPath}`;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
// Read the file and parse JSON
|
|
42
|
-
const jsonOutput = JSON.parse(await fs.promises.readFile(outputPath, 'utf8'));
|
|
43
|
-
|
|
44
|
-
await fs.promises.rm(outputPath);
|
|
45
|
-
return jsonOutput.releases;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
export async function versionCommand(closeVersion = false) {
|
|
49
|
-
console.log('📦 Running Changeset versioning...');
|
|
50
|
-
if (!process.env.IS_DEV) {
|
|
51
|
-
await setGitInfo();
|
|
52
|
-
await $`mv package.json package.json.bak`;
|
|
53
|
-
await $`mv pnpm-lock.yaml pnpm-lock.yaml.bak`;
|
|
54
|
-
await fs.promises.writeFile('package.json', changeSetPackage);
|
|
55
|
-
await $`pnpm install`;
|
|
56
|
-
await $`rm package.json pnpm-lock.yaml`;
|
|
57
|
-
await $`mv package.json.bak package.json`;
|
|
58
|
-
await $`mv pnpm-lock.yaml.bak pnpm-lock.yaml`;
|
|
59
|
-
}
|
|
60
|
-
if (closeVersion) {
|
|
61
|
-
await $`pnpm changeset pre exit`;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
let originalBaseBranch;
|
|
65
|
-
try {
|
|
66
|
-
originalBaseBranch = updateBaseBranch();
|
|
67
|
-
const releases = await versionStatus();
|
|
68
|
-
revertBaseBranch(originalBaseBranch);
|
|
69
|
-
await $`pnpm changeset version`;
|
|
70
|
-
|
|
71
|
-
return releases;
|
|
72
|
-
} catch {
|
|
73
|
-
revertBaseBranch(originalBaseBranch);
|
|
74
|
-
return [];
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
export async function updateJiraWithVersion(releases) {
|
|
79
|
-
const lastCommit = (await $`git log -1 --pretty=%B`).stdout.trim();
|
|
80
|
-
console.log(`Last commit '${lastCommit}' being processed to get Jira ticket`);
|
|
81
|
-
|
|
82
|
-
const jiraTicketId = findJiraTicketId(lastCommit);
|
|
83
|
-
|
|
84
|
-
// If we have all the necessary data, update the component version in Jira
|
|
85
|
-
if (jiraTicketId) {
|
|
86
|
-
for (const release of releases) {
|
|
87
|
-
try {
|
|
88
|
-
await updateComponentVersion(
|
|
89
|
-
jiraTicketId,
|
|
90
|
-
release.name,
|
|
91
|
-
release.newVersion,
|
|
92
|
-
);
|
|
93
|
-
} catch (error) {
|
|
94
|
-
console.error(
|
|
95
|
-
`Failed to update Jira component version: ${error.message}`,
|
|
96
|
-
);
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
console.log('✅ Changeset versioning complete.');
|
|
102
|
-
}
|
|
1
|
+
import { setGitInfo } from '../next/util.js';
|
|
2
|
+
import { $ } from 'zx';
|
|
3
|
+
import fs from 'fs';
|
|
4
|
+
import { updateComponentVersion } from '../next/jira.js';
|
|
5
|
+
import { findJiraTicketId } from './util.js';
|
|
6
|
+
import { revertBaseBranch, updateBaseBranch } from './changeset-config.js';
|
|
7
|
+
import semver from 'semver';
|
|
8
|
+
|
|
9
|
+
const changeSetPackage = `{
|
|
10
|
+
"name": "changeset-package",
|
|
11
|
+
"version": "1.0.0",
|
|
12
|
+
"description": "",
|
|
13
|
+
"scripts": {
|
|
14
|
+
},
|
|
15
|
+
"type": "module",
|
|
16
|
+
"keywords": [],
|
|
17
|
+
"author": "",
|
|
18
|
+
"license": "ISC",
|
|
19
|
+
"dependencies": {},
|
|
20
|
+
"devDependencies": {
|
|
21
|
+
"@changesets/cli": "^2.27.10"
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
`;
|
|
25
|
+
|
|
26
|
+
export function toShortVersion(version) {
|
|
27
|
+
const parsed = semver.parse(version);
|
|
28
|
+
if (!parsed) return null;
|
|
29
|
+
return `${parsed.major}.${parsed.minor}`;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export async function versionStatus(sinceBranch) {
|
|
33
|
+
const outputPath = './changeset-output.json';
|
|
34
|
+
|
|
35
|
+
if (sinceBranch) {
|
|
36
|
+
await $`pnpm changeset status --output=${outputPath} --since=${sinceBranch}`;
|
|
37
|
+
} else {
|
|
38
|
+
await $`pnpm changeset status --output=${outputPath}`;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
// Read the file and parse JSON
|
|
42
|
+
const jsonOutput = JSON.parse(await fs.promises.readFile(outputPath, 'utf8'));
|
|
43
|
+
|
|
44
|
+
await fs.promises.rm(outputPath);
|
|
45
|
+
return jsonOutput.releases;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export async function versionCommand(closeVersion = false) {
|
|
49
|
+
console.log('📦 Running Changeset versioning...');
|
|
50
|
+
if (!process.env.IS_DEV) {
|
|
51
|
+
await setGitInfo();
|
|
52
|
+
await $`mv package.json package.json.bak`;
|
|
53
|
+
await $`mv pnpm-lock.yaml pnpm-lock.yaml.bak`;
|
|
54
|
+
await fs.promises.writeFile('package.json', changeSetPackage);
|
|
55
|
+
await $`pnpm install`;
|
|
56
|
+
await $`rm package.json pnpm-lock.yaml`;
|
|
57
|
+
await $`mv package.json.bak package.json`;
|
|
58
|
+
await $`mv pnpm-lock.yaml.bak pnpm-lock.yaml`;
|
|
59
|
+
}
|
|
60
|
+
if (closeVersion) {
|
|
61
|
+
await $`pnpm changeset pre exit`;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
let originalBaseBranch;
|
|
65
|
+
try {
|
|
66
|
+
originalBaseBranch = updateBaseBranch();
|
|
67
|
+
const releases = await versionStatus();
|
|
68
|
+
revertBaseBranch(originalBaseBranch);
|
|
69
|
+
await $`pnpm changeset version`;
|
|
70
|
+
|
|
71
|
+
return releases;
|
|
72
|
+
} catch {
|
|
73
|
+
revertBaseBranch(originalBaseBranch);
|
|
74
|
+
return [];
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
export async function updateJiraWithVersion(releases) {
|
|
79
|
+
const lastCommit = (await $`git log -1 --pretty=%B`).stdout.trim();
|
|
80
|
+
console.log(`Last commit '${lastCommit}' being processed to get Jira ticket`);
|
|
81
|
+
|
|
82
|
+
const jiraTicketId = findJiraTicketId(lastCommit);
|
|
83
|
+
|
|
84
|
+
// If we have all the necessary data, update the component version in Jira
|
|
85
|
+
if (jiraTicketId) {
|
|
86
|
+
for (const release of releases) {
|
|
87
|
+
try {
|
|
88
|
+
await updateComponentVersion(
|
|
89
|
+
jiraTicketId,
|
|
90
|
+
release.name,
|
|
91
|
+
release.newVersion,
|
|
92
|
+
);
|
|
93
|
+
} catch (error) {
|
|
94
|
+
console.error(
|
|
95
|
+
`Failed to update Jira component version: ${error.message}`,
|
|
96
|
+
);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
console.log('✅ Changeset versioning complete.');
|
|
102
|
+
}
|
|
@@ -1,58 +1,58 @@
|
|
|
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
|
+
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
|
+
|