@docupace/pipeline 1.0.48 → 1.0.50
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/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 +72 -72
- package/src/auth0/configure.js +783 -783
- package/src/auth0/export.js +43 -43
- package/src/auth0/metadata.js +132 -132
- package/src/auth0/vault.js +107 -107
- package/src/changeset/changeset-config.js +34 -34
- package/src/changeset/cli.js +188 -188
- package/src/changeset/create.js +205 -205
- package/src/changeset/package-util.js +86 -86
- package/src/changeset/util.js +43 -43
- package/src/changeset/validate.js +84 -84
- package/src/changeset/version.js +95 -95
- package/src/jenkins/setParams.groovy +58 -58
- package/src/next/alias.js +53 -53
- package/src/next/apache.js +73 -73
- package/src/next/cli.js +220 -220
- package/src/next/config.js +136 -136
- package/src/next/connect.js +227 -227
- package/src/next/copy.js +61 -61
- package/src/next/deploy.js +553 -553
- package/src/next/haproxy.js +71 -71
- package/src/next/jira.js +80 -80
- 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/util.js +93 -93
- 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
|
@@ -1,84 +1,84 @@
|
|
|
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
|
-
if (isMonoRepo()) {
|
|
21
|
-
await setGitInfo();
|
|
22
|
-
const destBranch = process.env.BITBUCKET_PR_DESTINATION_BRANCH;
|
|
23
|
-
await $`git fetch origin ${destBranch}:${destBranch}`;
|
|
24
|
-
await versionStatus(destBranch);
|
|
25
|
-
/*const changedPackages = await getChangedPackages();
|
|
26
|
-
const releaseNames = releases.map((release) => release.name);
|
|
27
|
-
const changedPackageNames = changedPackages.map(
|
|
28
|
-
(changedPackage) => changedPackage.name,
|
|
29
|
-
);
|
|
30
|
-
|
|
31
|
-
if (!areArraysEqualIgnoringOrder(releaseNames, changedPackageNames)) {
|
|
32
|
-
throw new Error(
|
|
33
|
-
'Changesets must be created for all packages created and for those that have those changed as dependencies',
|
|
34
|
-
);
|
|
35
|
-
}*/
|
|
36
|
-
} else {
|
|
37
|
-
await validateChangesetPath(path.resolve(process.cwd(), CHANGESET_DIR));
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
export async function validateChangesetPath(directoryPath) {
|
|
42
|
-
try {
|
|
43
|
-
// Step 1: Read the directory for md files excluding README.md
|
|
44
|
-
const allFiles = fs.readdirSync(directoryPath);
|
|
45
|
-
const mdFiles = allFiles.filter(
|
|
46
|
-
(file) => file.endsWith('.md') && file !== 'README.md',
|
|
47
|
-
);
|
|
48
|
-
|
|
49
|
-
// Step 2: Check for pre.json and parse it
|
|
50
|
-
const preJsonPath = path.join(directoryPath, 'pre.json');
|
|
51
|
-
let preJson;
|
|
52
|
-
|
|
53
|
-
if (!fs.existsSync(preJsonPath) && mdFiles.length === 0) {
|
|
54
|
-
throw new Error('Error: No pre.json and no md files found.');
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
if (fs.existsSync(preJsonPath)) {
|
|
58
|
-
preJson = JSON.parse(fs.readFileSync(preJsonPath, 'utf-8'));
|
|
59
|
-
|
|
60
|
-
if (preJson.mode == 'pre') {
|
|
61
|
-
// Step 4a: Get list of changesets from pre.json
|
|
62
|
-
const changesets = preJson.changesets || [];
|
|
63
|
-
const changesetNames = changesets.map((change) => change);
|
|
64
|
-
|
|
65
|
-
// Step 4b: Match files with the list of changesets
|
|
66
|
-
const mdFileNamesWithoutExt = mdFiles.map((file) =>
|
|
67
|
-
path.basename(file, '.md'),
|
|
68
|
-
);
|
|
69
|
-
const unmatchedFiles = mdFileNamesWithoutExt.filter(
|
|
70
|
-
(fileName) => !changesetNames.includes(fileName),
|
|
71
|
-
);
|
|
72
|
-
|
|
73
|
-
if (unmatchedFiles.length == 0) {
|
|
74
|
-
throw new Error('Error: No new MD files found:');
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
console.log('Validation successful.');
|
|
80
|
-
} catch (error) {
|
|
81
|
-
console.log(error.message);
|
|
82
|
-
throw error;
|
|
83
|
-
}
|
|
84
|
-
}
|
|
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
|
+
if (isMonoRepo()) {
|
|
21
|
+
await setGitInfo();
|
|
22
|
+
const destBranch = process.env.BITBUCKET_PR_DESTINATION_BRANCH;
|
|
23
|
+
await $`git fetch origin ${destBranch}:${destBranch}`;
|
|
24
|
+
await versionStatus(destBranch);
|
|
25
|
+
/*const changedPackages = await getChangedPackages();
|
|
26
|
+
const releaseNames = releases.map((release) => release.name);
|
|
27
|
+
const changedPackageNames = changedPackages.map(
|
|
28
|
+
(changedPackage) => changedPackage.name,
|
|
29
|
+
);
|
|
30
|
+
|
|
31
|
+
if (!areArraysEqualIgnoringOrder(releaseNames, changedPackageNames)) {
|
|
32
|
+
throw new Error(
|
|
33
|
+
'Changesets must be created for all packages created and for those that have those changed as dependencies',
|
|
34
|
+
);
|
|
35
|
+
}*/
|
|
36
|
+
} else {
|
|
37
|
+
await validateChangesetPath(path.resolve(process.cwd(), CHANGESET_DIR));
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export async function validateChangesetPath(directoryPath) {
|
|
42
|
+
try {
|
|
43
|
+
// Step 1: Read the directory for md files excluding README.md
|
|
44
|
+
const allFiles = fs.readdirSync(directoryPath);
|
|
45
|
+
const mdFiles = allFiles.filter(
|
|
46
|
+
(file) => file.endsWith('.md') && file !== 'README.md',
|
|
47
|
+
);
|
|
48
|
+
|
|
49
|
+
// Step 2: Check for pre.json and parse it
|
|
50
|
+
const preJsonPath = path.join(directoryPath, 'pre.json');
|
|
51
|
+
let preJson;
|
|
52
|
+
|
|
53
|
+
if (!fs.existsSync(preJsonPath) && mdFiles.length === 0) {
|
|
54
|
+
throw new Error('Error: No pre.json and no md files found.');
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
if (fs.existsSync(preJsonPath)) {
|
|
58
|
+
preJson = JSON.parse(fs.readFileSync(preJsonPath, 'utf-8'));
|
|
59
|
+
|
|
60
|
+
if (preJson.mode == 'pre') {
|
|
61
|
+
// Step 4a: Get list of changesets from pre.json
|
|
62
|
+
const changesets = preJson.changesets || [];
|
|
63
|
+
const changesetNames = changesets.map((change) => change);
|
|
64
|
+
|
|
65
|
+
// Step 4b: Match files with the list of changesets
|
|
66
|
+
const mdFileNamesWithoutExt = mdFiles.map((file) =>
|
|
67
|
+
path.basename(file, '.md'),
|
|
68
|
+
);
|
|
69
|
+
const unmatchedFiles = mdFileNamesWithoutExt.filter(
|
|
70
|
+
(fileName) => !changesetNames.includes(fileName),
|
|
71
|
+
);
|
|
72
|
+
|
|
73
|
+
if (unmatchedFiles.length == 0) {
|
|
74
|
+
throw new Error('Error: No new MD files found:');
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
console.log('Validation successful.');
|
|
80
|
+
} catch (error) {
|
|
81
|
+
console.log(error.message);
|
|
82
|
+
throw error;
|
|
83
|
+
}
|
|
84
|
+
}
|
package/src/changeset/version.js
CHANGED
|
@@ -1,95 +1,95 @@
|
|
|
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
|
-
|
|
8
|
-
const changeSetPackage = `{
|
|
9
|
-
"name": "changeset-package",
|
|
10
|
-
"version": "1.0.0",
|
|
11
|
-
"description": "",
|
|
12
|
-
"scripts": {
|
|
13
|
-
},
|
|
14
|
-
"type": "module",
|
|
15
|
-
"keywords": [],
|
|
16
|
-
"author": "",
|
|
17
|
-
"license": "ISC",
|
|
18
|
-
"dependencies": {},
|
|
19
|
-
"devDependencies": {
|
|
20
|
-
"@changesets/cli": "^2.27.10"
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
`;
|
|
24
|
-
|
|
25
|
-
export async function versionStatus(sinceBranch) {
|
|
26
|
-
const outputPath = './changeset-output.json';
|
|
27
|
-
|
|
28
|
-
if (sinceBranch) {
|
|
29
|
-
await $`pnpm changeset status --output=${outputPath} --since=${sinceBranch}`;
|
|
30
|
-
} else {
|
|
31
|
-
await $`pnpm changeset status --output=${outputPath}`;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
// Read the file and parse JSON
|
|
35
|
-
const jsonOutput = JSON.parse(await fs.promises.readFile(outputPath, 'utf8'));
|
|
36
|
-
|
|
37
|
-
await fs.promises.rm(outputPath);
|
|
38
|
-
return jsonOutput.releases;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
export async function versionCommand(closeVersion = false) {
|
|
42
|
-
console.log('📦 Running Changeset versioning...');
|
|
43
|
-
if (!process.env.IS_DEV) {
|
|
44
|
-
await setGitInfo();
|
|
45
|
-
await $`mv package.json package.json.bak`;
|
|
46
|
-
await $`mv pnpm-lock.yaml pnpm-lock.yaml.bak`;
|
|
47
|
-
await fs.promises.writeFile('package.json', changeSetPackage);
|
|
48
|
-
await $`pnpm install`;
|
|
49
|
-
await $`rm package.json pnpm-lock.yaml`;
|
|
50
|
-
await $`mv package.json.bak package.json`;
|
|
51
|
-
await $`mv pnpm-lock.yaml.bak pnpm-lock.yaml`;
|
|
52
|
-
}
|
|
53
|
-
if (closeVersion) {
|
|
54
|
-
await $`pnpm changeset pre exit`;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
let originalBaseBranch;
|
|
58
|
-
try {
|
|
59
|
-
originalBaseBranch = updateBaseBranch();
|
|
60
|
-
const releases = await versionStatus();
|
|
61
|
-
revertBaseBranch(originalBaseBranch);
|
|
62
|
-
await $`pnpm changeset version`;
|
|
63
|
-
|
|
64
|
-
return releases;
|
|
65
|
-
} catch {
|
|
66
|
-
revertBaseBranch(originalBaseBranch);
|
|
67
|
-
return [];
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
export async function updateJiraWithVersion(releases) {
|
|
72
|
-
const lastCommit = (await $`git log -1 --pretty=%B`).stdout.trim();
|
|
73
|
-
console.log(`Last commit '${lastCommit}' being processed to get Jira ticket`);
|
|
74
|
-
|
|
75
|
-
const jiraTicketId = findJiraTicketId(lastCommit);
|
|
76
|
-
|
|
77
|
-
// If we have all the necessary data, update the component version in Jira
|
|
78
|
-
if (jiraTicketId) {
|
|
79
|
-
for (const release of releases) {
|
|
80
|
-
try {
|
|
81
|
-
await updateComponentVersion(
|
|
82
|
-
jiraTicketId,
|
|
83
|
-
release.name,
|
|
84
|
-
release.newVersion,
|
|
85
|
-
);
|
|
86
|
-
} catch (error) {
|
|
87
|
-
console.error(
|
|
88
|
-
`Failed to update Jira component version: ${error.message}`,
|
|
89
|
-
);
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
console.log('✅ Changeset versioning complete.');
|
|
95
|
-
}
|
|
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
|
+
|
|
8
|
+
const changeSetPackage = `{
|
|
9
|
+
"name": "changeset-package",
|
|
10
|
+
"version": "1.0.0",
|
|
11
|
+
"description": "",
|
|
12
|
+
"scripts": {
|
|
13
|
+
},
|
|
14
|
+
"type": "module",
|
|
15
|
+
"keywords": [],
|
|
16
|
+
"author": "",
|
|
17
|
+
"license": "ISC",
|
|
18
|
+
"dependencies": {},
|
|
19
|
+
"devDependencies": {
|
|
20
|
+
"@changesets/cli": "^2.27.10"
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
`;
|
|
24
|
+
|
|
25
|
+
export async function versionStatus(sinceBranch) {
|
|
26
|
+
const outputPath = './changeset-output.json';
|
|
27
|
+
|
|
28
|
+
if (sinceBranch) {
|
|
29
|
+
await $`pnpm changeset status --output=${outputPath} --since=${sinceBranch}`;
|
|
30
|
+
} else {
|
|
31
|
+
await $`pnpm changeset status --output=${outputPath}`;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
// Read the file and parse JSON
|
|
35
|
+
const jsonOutput = JSON.parse(await fs.promises.readFile(outputPath, 'utf8'));
|
|
36
|
+
|
|
37
|
+
await fs.promises.rm(outputPath);
|
|
38
|
+
return jsonOutput.releases;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export async function versionCommand(closeVersion = false) {
|
|
42
|
+
console.log('📦 Running Changeset versioning...');
|
|
43
|
+
if (!process.env.IS_DEV) {
|
|
44
|
+
await setGitInfo();
|
|
45
|
+
await $`mv package.json package.json.bak`;
|
|
46
|
+
await $`mv pnpm-lock.yaml pnpm-lock.yaml.bak`;
|
|
47
|
+
await fs.promises.writeFile('package.json', changeSetPackage);
|
|
48
|
+
await $`pnpm install`;
|
|
49
|
+
await $`rm package.json pnpm-lock.yaml`;
|
|
50
|
+
await $`mv package.json.bak package.json`;
|
|
51
|
+
await $`mv pnpm-lock.yaml.bak pnpm-lock.yaml`;
|
|
52
|
+
}
|
|
53
|
+
if (closeVersion) {
|
|
54
|
+
await $`pnpm changeset pre exit`;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
let originalBaseBranch;
|
|
58
|
+
try {
|
|
59
|
+
originalBaseBranch = updateBaseBranch();
|
|
60
|
+
const releases = await versionStatus();
|
|
61
|
+
revertBaseBranch(originalBaseBranch);
|
|
62
|
+
await $`pnpm changeset version`;
|
|
63
|
+
|
|
64
|
+
return releases;
|
|
65
|
+
} catch {
|
|
66
|
+
revertBaseBranch(originalBaseBranch);
|
|
67
|
+
return [];
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
export async function updateJiraWithVersion(releases) {
|
|
72
|
+
const lastCommit = (await $`git log -1 --pretty=%B`).stdout.trim();
|
|
73
|
+
console.log(`Last commit '${lastCommit}' being processed to get Jira ticket`);
|
|
74
|
+
|
|
75
|
+
const jiraTicketId = findJiraTicketId(lastCommit);
|
|
76
|
+
|
|
77
|
+
// If we have all the necessary data, update the component version in Jira
|
|
78
|
+
if (jiraTicketId) {
|
|
79
|
+
for (const release of releases) {
|
|
80
|
+
try {
|
|
81
|
+
await updateComponentVersion(
|
|
82
|
+
jiraTicketId,
|
|
83
|
+
release.name,
|
|
84
|
+
release.newVersion,
|
|
85
|
+
);
|
|
86
|
+
} catch (error) {
|
|
87
|
+
console.error(
|
|
88
|
+
`Failed to update Jira component version: ${error.message}`,
|
|
89
|
+
);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
console.log('✅ Changeset versioning complete.');
|
|
95
|
+
}
|
|
@@ -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
|
+
|
package/src/next/alias.js
CHANGED
|
@@ -1,53 +1,53 @@
|
|
|
1
|
-
import { BasicAuth, DomainApi } from '@docupace/core-client';
|
|
2
|
-
|
|
3
|
-
const userFilter = (userId) => {
|
|
4
|
-
return {
|
|
5
|
-
orSections: [
|
|
6
|
-
{
|
|
7
|
-
andSections: [
|
|
8
|
-
{
|
|
9
|
-
attrId: 9501,
|
|
10
|
-
'@type': 'string',
|
|
11
|
-
not: false,
|
|
12
|
-
orSections: [
|
|
13
|
-
{ searchType: 'EXACT_MATCH', matchToValues: [userId] },
|
|
14
|
-
],
|
|
15
|
-
},
|
|
16
|
-
],
|
|
17
|
-
},
|
|
18
|
-
],
|
|
19
|
-
};
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
/*
|
|
23
|
-
Example:
|
|
24
|
-
await createAlias(
|
|
25
|
-
'https://www.dev.docupaceinc.com/financialdev',
|
|
26
|
-
'docupace',
|
|
27
|
-
'pw',
|
|
28
|
-
'Connect',
|
|
29
|
-
'qhnospjRjwUAeKFDhucHEabPsfihrGQQ@clients',
|
|
30
|
-
);
|
|
31
|
-
*/
|
|
32
|
-
export async function createAlias(coreUrl, username, password, realm, alias) {
|
|
33
|
-
const coreInfo = {
|
|
34
|
-
url: coreUrl,
|
|
35
|
-
};
|
|
36
|
-
|
|
37
|
-
let auth = new BasicAuth(username, password);
|
|
38
|
-
|
|
39
|
-
const domainApi = new DomainApi(coreInfo, auth);
|
|
40
|
-
|
|
41
|
-
const userResults = await domainApi.listRecords(50, {
|
|
42
|
-
filter: JSON.stringify(userFilter(username)),
|
|
43
|
-
});
|
|
44
|
-
|
|
45
|
-
const record = {
|
|
46
|
-
domainId: 302,
|
|
47
|
-
'5001': userResults.records[0].id,
|
|
48
|
-
'9102': realm,
|
|
49
|
-
'9504': alias,
|
|
50
|
-
};
|
|
51
|
-
|
|
52
|
-
await domainApi.create(record);
|
|
53
|
-
}
|
|
1
|
+
import { BasicAuth, DomainApi } from '@docupace/core-client';
|
|
2
|
+
|
|
3
|
+
const userFilter = (userId) => {
|
|
4
|
+
return {
|
|
5
|
+
orSections: [
|
|
6
|
+
{
|
|
7
|
+
andSections: [
|
|
8
|
+
{
|
|
9
|
+
attrId: 9501,
|
|
10
|
+
'@type': 'string',
|
|
11
|
+
not: false,
|
|
12
|
+
orSections: [
|
|
13
|
+
{ searchType: 'EXACT_MATCH', matchToValues: [userId] },
|
|
14
|
+
],
|
|
15
|
+
},
|
|
16
|
+
],
|
|
17
|
+
},
|
|
18
|
+
],
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
/*
|
|
23
|
+
Example:
|
|
24
|
+
await createAlias(
|
|
25
|
+
'https://www.dev.docupaceinc.com/financialdev',
|
|
26
|
+
'docupace',
|
|
27
|
+
'pw',
|
|
28
|
+
'Connect',
|
|
29
|
+
'qhnospjRjwUAeKFDhucHEabPsfihrGQQ@clients',
|
|
30
|
+
);
|
|
31
|
+
*/
|
|
32
|
+
export async function createAlias(coreUrl, username, password, realm, alias) {
|
|
33
|
+
const coreInfo = {
|
|
34
|
+
url: coreUrl,
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
let auth = new BasicAuth(username, password);
|
|
38
|
+
|
|
39
|
+
const domainApi = new DomainApi(coreInfo, auth);
|
|
40
|
+
|
|
41
|
+
const userResults = await domainApi.listRecords(50, {
|
|
42
|
+
filter: JSON.stringify(userFilter(username)),
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
const record = {
|
|
46
|
+
domainId: 302,
|
|
47
|
+
'5001': userResults.records[0].id,
|
|
48
|
+
'9102': realm,
|
|
49
|
+
'9504': alias,
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
await domainApi.create(record);
|
|
53
|
+
}
|