@docupace/pipeline 1.0.43 → 1.0.45
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/bin/azuread_update_callbacks_for_app.sh +54 -0
- package/bin/next-changeset-validate.sh +8 -8
- package/commit-message +41 -0
- package/next/changeset.sh +75 -75
- package/next/copy.sh +34 -34
- package/next/deploy.sh +40 -40
- package/next/execute.sh +117 -117
- package/next/sonar.sh +23 -23
- package/package.json +1 -1
- package/pull-request-sum +42 -0
- package/pull-request-summary +34 -0
- package/pull-request-title +66 -0
- package/src/auth0/alias.js +72 -72
- package/src/auth0/cli.js +76 -76
- 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/cli.js +334 -334
- package/src/changeset/validate.js +47 -47
- package/src/jenkins/setParams.groovy +59 -59
- package/src/next/alias.js +53 -53
- package/src/next/config.js +99 -99
- package/src/next/copy.js +55 -55
- package/src/next/jira.js +83 -83
- package/src/next/pipline.js +114 -114
- package/src/next/publish.js +48 -48
- package/src/next/pull.js +7 -7
- package/src/next/sonar.js +23 -23
- package/src/next/vault.js +43 -43
- package/terraform/apply.sh +37 -26
- package/terraform/init.sh +72 -61
- package/terraform/plan.sh +76 -63
- package/terraform/validate.sh +17 -17
|
@@ -1,47 +1,47 @@
|
|
|
1
|
-
import fs from 'fs';
|
|
2
|
-
import path from 'path';
|
|
3
|
-
|
|
4
|
-
export async function validateChangesets(directoryPath) {
|
|
5
|
-
try {
|
|
6
|
-
// Step 1: Read the directory for md files excluding README.md
|
|
7
|
-
const allFiles = fs.readdirSync(directoryPath);
|
|
8
|
-
const mdFiles = allFiles.filter(
|
|
9
|
-
(file) => file.endsWith('.md') && file !== 'README.md',
|
|
10
|
-
);
|
|
11
|
-
|
|
12
|
-
// Step 2: Check for pre.json and parse it
|
|
13
|
-
const preJsonPath = path.join(directoryPath, 'pre.json');
|
|
14
|
-
let preJson;
|
|
15
|
-
|
|
16
|
-
if (!fs.existsSync(preJsonPath) && mdFiles.length === 0) {
|
|
17
|
-
throw new Error('Error: No pre.json and no md files found.');
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
if (fs.existsSync(preJsonPath)) {
|
|
21
|
-
preJson = JSON.parse(fs.readFileSync(preJsonPath, 'utf-8'));
|
|
22
|
-
|
|
23
|
-
if (preJson.mode == 'pre') {
|
|
24
|
-
// Step 4a: Get list of changesets from pre.json
|
|
25
|
-
const changesets = preJson.changesets || [];
|
|
26
|
-
const changesetNames = changesets.map((change) => change);
|
|
27
|
-
|
|
28
|
-
// Step 4b: Match files with the list of changesets
|
|
29
|
-
const mdFileNamesWithoutExt = mdFiles.map((file) =>
|
|
30
|
-
path.basename(file, '.md'),
|
|
31
|
-
);
|
|
32
|
-
const unmatchedFiles = mdFileNamesWithoutExt.filter(
|
|
33
|
-
(fileName) => !changesetNames.includes(fileName),
|
|
34
|
-
);
|
|
35
|
-
|
|
36
|
-
if (unmatchedFiles.length == 0) {
|
|
37
|
-
throw new Error('Error: No new MD files found:');
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
console.log('Validation successful.');
|
|
43
|
-
} catch (error) {
|
|
44
|
-
console.log(error.message);
|
|
45
|
-
throw error;
|
|
46
|
-
}
|
|
47
|
-
}
|
|
1
|
+
import fs from 'fs';
|
|
2
|
+
import path from 'path';
|
|
3
|
+
|
|
4
|
+
export async function validateChangesets(directoryPath) {
|
|
5
|
+
try {
|
|
6
|
+
// Step 1: Read the directory for md files excluding README.md
|
|
7
|
+
const allFiles = fs.readdirSync(directoryPath);
|
|
8
|
+
const mdFiles = allFiles.filter(
|
|
9
|
+
(file) => file.endsWith('.md') && file !== 'README.md',
|
|
10
|
+
);
|
|
11
|
+
|
|
12
|
+
// Step 2: Check for pre.json and parse it
|
|
13
|
+
const preJsonPath = path.join(directoryPath, 'pre.json');
|
|
14
|
+
let preJson;
|
|
15
|
+
|
|
16
|
+
if (!fs.existsSync(preJsonPath) && mdFiles.length === 0) {
|
|
17
|
+
throw new Error('Error: No pre.json and no md files found.');
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
if (fs.existsSync(preJsonPath)) {
|
|
21
|
+
preJson = JSON.parse(fs.readFileSync(preJsonPath, 'utf-8'));
|
|
22
|
+
|
|
23
|
+
if (preJson.mode == 'pre') {
|
|
24
|
+
// Step 4a: Get list of changesets from pre.json
|
|
25
|
+
const changesets = preJson.changesets || [];
|
|
26
|
+
const changesetNames = changesets.map((change) => change);
|
|
27
|
+
|
|
28
|
+
// Step 4b: Match files with the list of changesets
|
|
29
|
+
const mdFileNamesWithoutExt = mdFiles.map((file) =>
|
|
30
|
+
path.basename(file, '.md'),
|
|
31
|
+
);
|
|
32
|
+
const unmatchedFiles = mdFileNamesWithoutExt.filter(
|
|
33
|
+
(fileName) => !changesetNames.includes(fileName),
|
|
34
|
+
);
|
|
35
|
+
|
|
36
|
+
if (unmatchedFiles.length == 0) {
|
|
37
|
+
throw new Error('Error: No new MD files found:');
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
console.log('Validation successful.');
|
|
43
|
+
} catch (error) {
|
|
44
|
+
console.log(error.message);
|
|
45
|
+
throw error;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
@@ -1,59 +1,59 @@
|
|
|
1
|
-
import groovy.json.JsonSlurper
|
|
2
|
-
|
|
3
|
-
import hudson.model.*;
|
|
4
|
-
|
|
5
|
-
def build = Thread.currentThread().executable
|
|
6
|
-
def params = build.getEnvironment(listener)
|
|
7
|
-
|
|
8
|
-
def site = params.get('site')
|
|
9
|
-
def server = "jboss7"
|
|
10
|
-
def environment = params.get('environment')
|
|
11
|
-
|
|
12
|
-
def buildFile=new File("D:\\Docupace\\CustomFolders\\" + environment + "\\" + site + "\\" + server + "\\buildApp.properties")
|
|
13
|
-
|
|
14
|
-
List<String> jboss7controllerResult = []
|
|
15
|
-
|
|
16
|
-
def controllersReport = new File("D:\\Docupace\\controllers_report.json")
|
|
17
|
-
def inputJSON = new JsonSlurper().parseText(controllersReport.text)
|
|
18
|
-
def props = new Properties()
|
|
19
|
-
buildFile.withInputStream { stream -> props.load(stream) }
|
|
20
|
-
def webRootContext = props["web.root.context"]
|
|
21
|
-
if (webRootContext == null || webRootContext =="core") webRootContext = props["docupace.config.client.id"].toLowerCase()
|
|
22
|
-
|
|
23
|
-
webRootContext = webRootContext.replaceFirst('_sso','')
|
|
24
|
-
def map = inputJSON.'content'
|
|
25
|
-
|
|
26
|
-
def Boolean enabled
|
|
27
|
-
|
|
28
|
-
map.each {k,v ->
|
|
29
|
-
v.each{vk, vv -> if (vk == webRootContext ) {
|
|
30
|
-
enabled = false
|
|
31
|
-
if(vv.deploymentsProperty.size()>0) enabled = vv.deploymentsProperty[0].isEnabled
|
|
32
|
-
if (enabled) jboss7controllerResult.push(k)
|
|
33
|
-
else jboss7controllerResult << k
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
if (jboss7controllerResult.size()>0) {
|
|
39
|
-
if (environment == 'preprod') {
|
|
40
|
-
jboss7controllerResult.remove("dev-corjbdc10.corp.docupace.com")
|
|
41
|
-
jboss7controllerResult.remove("usdoc-s-jbdc1.corp.docupace.com")
|
|
42
|
-
}
|
|
43
|
-
if (environment == 'dev') {
|
|
44
|
-
jboss7controllerResult.remove("qa-corjbdc10.corp.docupace.com")
|
|
45
|
-
jboss7controllerResult.remove("qa-corjbdc20.corp.docupace.com")
|
|
46
|
-
jboss7controllerResult.remove("usdoc-s-jbdc2.corp.docupace.com")
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
println jboss7controllerResult[0]
|
|
51
|
-
|
|
52
|
-
env.jboss7controller = jboss7controllerResult[0]
|
|
53
|
-
|
|
54
|
-
def serverGroup = inputJSON.'content'."${jboss7controller}"."${webRootContext}".'serverGroup'
|
|
55
|
-
|
|
56
|
-
println serverGroup
|
|
57
|
-
|
|
58
|
-
params.put("serverGroup", serverGroup)
|
|
59
|
-
|
|
1
|
+
import groovy.json.JsonSlurper
|
|
2
|
+
|
|
3
|
+
import hudson.model.*;
|
|
4
|
+
|
|
5
|
+
def build = Thread.currentThread().executable
|
|
6
|
+
def params = build.getEnvironment(listener)
|
|
7
|
+
|
|
8
|
+
def site = params.get('site')
|
|
9
|
+
def server = "jboss7"
|
|
10
|
+
def environment = params.get('environment')
|
|
11
|
+
|
|
12
|
+
def buildFile=new File("D:\\Docupace\\CustomFolders\\" + environment + "\\" + site + "\\" + server + "\\buildApp.properties")
|
|
13
|
+
|
|
14
|
+
List<String> jboss7controllerResult = []
|
|
15
|
+
|
|
16
|
+
def controllersReport = new File("D:\\Docupace\\controllers_report.json")
|
|
17
|
+
def inputJSON = new JsonSlurper().parseText(controllersReport.text)
|
|
18
|
+
def props = new Properties()
|
|
19
|
+
buildFile.withInputStream { stream -> props.load(stream) }
|
|
20
|
+
def webRootContext = props["web.root.context"]
|
|
21
|
+
if (webRootContext == null || webRootContext =="core") webRootContext = props["docupace.config.client.id"].toLowerCase()
|
|
22
|
+
|
|
23
|
+
webRootContext = webRootContext.replaceFirst('_sso','')
|
|
24
|
+
def map = inputJSON.'content'
|
|
25
|
+
|
|
26
|
+
def Boolean enabled
|
|
27
|
+
|
|
28
|
+
map.each {k,v ->
|
|
29
|
+
v.each{vk, vv -> if (vk == webRootContext ) {
|
|
30
|
+
enabled = false
|
|
31
|
+
if(vv.deploymentsProperty.size()>0) enabled = vv.deploymentsProperty[0].isEnabled
|
|
32
|
+
if (enabled) jboss7controllerResult.push(k)
|
|
33
|
+
else jboss7controllerResult << k
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
if (jboss7controllerResult.size()>0) {
|
|
39
|
+
if (environment == 'preprod') {
|
|
40
|
+
jboss7controllerResult.remove("dev-corjbdc10.corp.docupace.com")
|
|
41
|
+
jboss7controllerResult.remove("usdoc-s-jbdc1.corp.docupace.com")
|
|
42
|
+
}
|
|
43
|
+
if (environment == 'dev') {
|
|
44
|
+
jboss7controllerResult.remove("qa-corjbdc10.corp.docupace.com")
|
|
45
|
+
jboss7controllerResult.remove("qa-corjbdc20.corp.docupace.com")
|
|
46
|
+
jboss7controllerResult.remove("usdoc-s-jbdc2.corp.docupace.com")
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
println jboss7controllerResult[0]
|
|
51
|
+
|
|
52
|
+
env.jboss7controller = jboss7controllerResult[0]
|
|
53
|
+
|
|
54
|
+
def serverGroup = inputJSON.'content'."${jboss7controller}"."${webRootContext}".'serverGroup'
|
|
55
|
+
|
|
56
|
+
println serverGroup
|
|
57
|
+
|
|
58
|
+
params.put("serverGroup", serverGroup)
|
|
59
|
+
|
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
|
+
}
|
package/src/next/config.js
CHANGED
|
@@ -1,99 +1,99 @@
|
|
|
1
|
-
export const environments = ['dev', 'qa', 'uat', 'stage', 'prod'];
|
|
2
|
-
|
|
3
|
-
export const environmentConfig = {
|
|
4
|
-
dev: {
|
|
5
|
-
newUrl: (site) => `https://${site}.dev.dpai.tech`,
|
|
6
|
-
oldUrl: (site) => `https://www.dev.docupaceinc.com/${site}`,
|
|
7
|
-
docupaceHost: () => 'www.dev.docupaceinc.com',
|
|
8
|
-
ccUrl: (site) => `https://${site}-cc.dev.dpai.tech`,
|
|
9
|
-
},
|
|
10
|
-
qa: {
|
|
11
|
-
newUrl: (site) => `https://${site}.qa.dpai.tech`,
|
|
12
|
-
oldUrl: (site) => `https://www.preprod.docupaceinc.com/${site}`,
|
|
13
|
-
docupaceHost: () => 'www.preprod.docupaceinc.com',
|
|
14
|
-
ccUrl: (site) => `https://${site}-cc.qa.dpai.tech`,
|
|
15
|
-
},
|
|
16
|
-
uat: {
|
|
17
|
-
newUrl: (site) => `https://${site}.uat.dpai.tech`,
|
|
18
|
-
oldUrl: (site) => `https://www2.paperout.com/${site}_uat`,
|
|
19
|
-
docupaceHost: () => 'www2.paperout.com',
|
|
20
|
-
ccUrl: (site) => `https://${site}-cc.uat.dpai.tech`,
|
|
21
|
-
},
|
|
22
|
-
stage: {
|
|
23
|
-
newUrl: (site) => `https://${site}.stg.dpai.tech`,
|
|
24
|
-
oldUrl: (site) => `https://www2.paperout.com/${site}_staging`,
|
|
25
|
-
docupaceHost: () => 'www2.paperout.com',
|
|
26
|
-
ccUrl: (site) => `https://${site}-cc.stg.dpai.tech`,
|
|
27
|
-
},
|
|
28
|
-
prod: {
|
|
29
|
-
newUrl: (site) => `https://${site}.dpai.tech`,
|
|
30
|
-
oldUrl: (site) => `https://www2.paperout.com/${site}`,
|
|
31
|
-
docupaceHost: () => 'www2.paperout.com',
|
|
32
|
-
ccUrl: (site) => `https://${site}-cc.dpai.tech`,
|
|
33
|
-
},
|
|
34
|
-
};
|
|
35
|
-
|
|
36
|
-
export const appInfo = {
|
|
37
|
-
'graphql-server': {
|
|
38
|
-
repositoryName: 'docupace-graphql-server',
|
|
39
|
-
deployAttributes: [
|
|
40
|
-
'image.tag',
|
|
41
|
-
'graphqlServer.siteConfigRemoteBranch',
|
|
42
|
-
'graphqlServer.standardConfigRemoteBranch',
|
|
43
|
-
],
|
|
44
|
-
},
|
|
45
|
-
ui: {
|
|
46
|
-
repositoryName: 'docupace-ui-main',
|
|
47
|
-
deployAttributes: ['image.tag'],
|
|
48
|
-
},
|
|
49
|
-
};
|
|
50
|
-
|
|
51
|
-
export const getEnvInfo = () => {
|
|
52
|
-
const envInfo = Object.fromEntries(
|
|
53
|
-
environments.map((env) => [
|
|
54
|
-
env,
|
|
55
|
-
{
|
|
56
|
-
jfrog: {
|
|
57
|
-
username: process.env[`JF_REGISTRY_${env.toUpperCase()}_USERNAME`],
|
|
58
|
-
password: process.env[`JF_REGISTRY_${env.toUpperCase()}_PASSWORD`],
|
|
59
|
-
},
|
|
60
|
-
},
|
|
61
|
-
]),
|
|
62
|
-
);
|
|
63
|
-
|
|
64
|
-
return envInfo;
|
|
65
|
-
};
|
|
66
|
-
|
|
67
|
-
export const getBitbucketInfo = () => {
|
|
68
|
-
return {
|
|
69
|
-
username: process.env.BITBUCKET_USERNAME,
|
|
70
|
-
password: process.env.BITBUCKET_APP_PASSWORD,
|
|
71
|
-
workspace: 'dp-cloud',
|
|
72
|
-
};
|
|
73
|
-
};
|
|
74
|
-
|
|
75
|
-
export const getRepUrl = (repoName) => {
|
|
76
|
-
const { username, password, workspace } = getBitbucketInfo();
|
|
77
|
-
return `https://${username}:${password}@bitbucket.org/${workspace}/${repoName}.git`;
|
|
78
|
-
};
|
|
79
|
-
|
|
80
|
-
export const jfRegistryUrl = 'registry.paperout.com';
|
|
81
|
-
|
|
82
|
-
export const getVaultSecretsConfigs = (site) => {
|
|
83
|
-
return {
|
|
84
|
-
commonSecretsPath: 'secret/data/common/config',
|
|
85
|
-
siteCommonSecretsPath: `secret/data/${site}/common/config`,
|
|
86
|
-
graphqlServerSecretsPath: `secret/data/${site}/graphql-server/config`,
|
|
87
|
-
uiSecretsPath: `secret/data/${site}/ui/config`,
|
|
88
|
-
ccUISecretsPath: `secret/data/${site}/ui-cc/config`,
|
|
89
|
-
awsSecretsPath: `secret/data/${site}/aws/config`,
|
|
90
|
-
};
|
|
91
|
-
};
|
|
92
|
-
|
|
93
|
-
export const coreSiteEnvMap = {
|
|
94
|
-
dev: 'dev',
|
|
95
|
-
qa: 'preprod',
|
|
96
|
-
stg: 'staging',
|
|
97
|
-
uat: 'uat',
|
|
98
|
-
prd: 'prod',
|
|
99
|
-
};
|
|
1
|
+
export const environments = ['dev', 'qa', 'uat', 'stage', 'prod'];
|
|
2
|
+
|
|
3
|
+
export const environmentConfig = {
|
|
4
|
+
dev: {
|
|
5
|
+
newUrl: (site) => `https://${site}.dev.dpai.tech`,
|
|
6
|
+
oldUrl: (site) => `https://www.dev.docupaceinc.com/${site}`,
|
|
7
|
+
docupaceHost: () => 'www.dev.docupaceinc.com',
|
|
8
|
+
ccUrl: (site) => `https://${site}-cc.dev.dpai.tech`,
|
|
9
|
+
},
|
|
10
|
+
qa: {
|
|
11
|
+
newUrl: (site) => `https://${site}.qa.dpai.tech`,
|
|
12
|
+
oldUrl: (site) => `https://www.preprod.docupaceinc.com/${site}`,
|
|
13
|
+
docupaceHost: () => 'www.preprod.docupaceinc.com',
|
|
14
|
+
ccUrl: (site) => `https://${site}-cc.qa.dpai.tech`,
|
|
15
|
+
},
|
|
16
|
+
uat: {
|
|
17
|
+
newUrl: (site) => `https://${site}.uat.dpai.tech`,
|
|
18
|
+
oldUrl: (site) => `https://www2.paperout.com/${site}_uat`,
|
|
19
|
+
docupaceHost: () => 'www2.paperout.com',
|
|
20
|
+
ccUrl: (site) => `https://${site}-cc.uat.dpai.tech`,
|
|
21
|
+
},
|
|
22
|
+
stage: {
|
|
23
|
+
newUrl: (site) => `https://${site}.stg.dpai.tech`,
|
|
24
|
+
oldUrl: (site) => `https://www2.paperout.com/${site}_staging`,
|
|
25
|
+
docupaceHost: () => 'www2.paperout.com',
|
|
26
|
+
ccUrl: (site) => `https://${site}-cc.stg.dpai.tech`,
|
|
27
|
+
},
|
|
28
|
+
prod: {
|
|
29
|
+
newUrl: (site) => `https://${site}.dpai.tech`,
|
|
30
|
+
oldUrl: (site) => `https://www2.paperout.com/${site}`,
|
|
31
|
+
docupaceHost: () => 'www2.paperout.com',
|
|
32
|
+
ccUrl: (site) => `https://${site}-cc.dpai.tech`,
|
|
33
|
+
},
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
export const appInfo = {
|
|
37
|
+
'graphql-server': {
|
|
38
|
+
repositoryName: 'docupace-graphql-server',
|
|
39
|
+
deployAttributes: [
|
|
40
|
+
'image.tag',
|
|
41
|
+
'graphqlServer.siteConfigRemoteBranch',
|
|
42
|
+
'graphqlServer.standardConfigRemoteBranch',
|
|
43
|
+
],
|
|
44
|
+
},
|
|
45
|
+
ui: {
|
|
46
|
+
repositoryName: 'docupace-ui-main',
|
|
47
|
+
deployAttributes: ['image.tag'],
|
|
48
|
+
},
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
export const getEnvInfo = () => {
|
|
52
|
+
const envInfo = Object.fromEntries(
|
|
53
|
+
environments.map((env) => [
|
|
54
|
+
env,
|
|
55
|
+
{
|
|
56
|
+
jfrog: {
|
|
57
|
+
username: process.env[`JF_REGISTRY_${env.toUpperCase()}_USERNAME`],
|
|
58
|
+
password: process.env[`JF_REGISTRY_${env.toUpperCase()}_PASSWORD`],
|
|
59
|
+
},
|
|
60
|
+
},
|
|
61
|
+
]),
|
|
62
|
+
);
|
|
63
|
+
|
|
64
|
+
return envInfo;
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
export const getBitbucketInfo = () => {
|
|
68
|
+
return {
|
|
69
|
+
username: process.env.BITBUCKET_USERNAME,
|
|
70
|
+
password: process.env.BITBUCKET_APP_PASSWORD,
|
|
71
|
+
workspace: 'dp-cloud',
|
|
72
|
+
};
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
export const getRepUrl = (repoName) => {
|
|
76
|
+
const { username, password, workspace } = getBitbucketInfo();
|
|
77
|
+
return `https://${username}:${password}@bitbucket.org/${workspace}/${repoName}.git`;
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
export const jfRegistryUrl = 'registry.paperout.com';
|
|
81
|
+
|
|
82
|
+
export const getVaultSecretsConfigs = (site) => {
|
|
83
|
+
return {
|
|
84
|
+
commonSecretsPath: 'secret/data/common/config',
|
|
85
|
+
siteCommonSecretsPath: `secret/data/${site}/common/config`,
|
|
86
|
+
graphqlServerSecretsPath: `secret/data/${site}/graphql-server/config`,
|
|
87
|
+
uiSecretsPath: `secret/data/${site}/ui/config`,
|
|
88
|
+
ccUISecretsPath: `secret/data/${site}/ui-cc/config`,
|
|
89
|
+
awsSecretsPath: `secret/data/${site}/aws/config`,
|
|
90
|
+
};
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
export const coreSiteEnvMap = {
|
|
94
|
+
dev: 'dev',
|
|
95
|
+
qa: 'preprod',
|
|
96
|
+
stg: 'staging',
|
|
97
|
+
uat: 'uat',
|
|
98
|
+
prd: 'prod',
|
|
99
|
+
};
|
package/src/next/copy.js
CHANGED
|
@@ -1,55 +1,55 @@
|
|
|
1
|
-
import { $ } from 'zx';
|
|
2
|
-
import { appInfo, getEnvInfo, jfRegistryUrl } from './config.js';
|
|
3
|
-
|
|
4
|
-
/*
|
|
5
|
-
TARGET_ENV
|
|
6
|
-
PUBLISH_TAG
|
|
7
|
-
REPOSITORY_NAME
|
|
8
|
-
*/
|
|
9
|
-
export async function copy(application, fromEnv, toEnv, tag) {
|
|
10
|
-
const envInfo = getEnvInfo();
|
|
11
|
-
const repositoryName = appInfo[application].repositoryName;
|
|
12
|
-
const fromRegistry = `${jfRegistryUrl}/${repositoryName}-${fromEnv}-docker-local`;
|
|
13
|
-
const toRegistry = `${jfRegistryUrl}/${repositoryName}-${toEnv}-docker-local`;
|
|
14
|
-
const imageName = `${repositoryName}:${tag}`;
|
|
15
|
-
const fromFullImageName = `${fromRegistry}/${imageName}`;
|
|
16
|
-
const toFullImageName = `${toRegistry}/${imageName}`;
|
|
17
|
-
|
|
18
|
-
console.log(
|
|
19
|
-
`Copying Docker image: ${fromFullImageName} -> ${toFullImageName}`,
|
|
20
|
-
);
|
|
21
|
-
|
|
22
|
-
// Login to source registry
|
|
23
|
-
await $`echo ${envInfo[fromEnv].jfrog.password} | docker login --username ${envInfo[fromEnv].jfrog.username} --password-stdin ${jfRegistryUrl}`;
|
|
24
|
-
await $`docker pull ${fromFullImageName}`;
|
|
25
|
-
await $`docker tag ${fromFullImageName} ${toFullImageName}`;
|
|
26
|
-
|
|
27
|
-
// Login to target registry
|
|
28
|
-
await $`echo ${envInfo[toEnv].jfrog.password} | docker login --username ${envInfo[toEnv].jfrog.username} --password-stdin ${jfRegistryUrl}`;
|
|
29
|
-
await $`docker push ${toFullImageName}`;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
export async function copy2(repositoryName, fromEnv, toEnv, tag) {
|
|
33
|
-
console.log(
|
|
34
|
-
`Copying repository ${repositoryName} from ${fromEnv} to ${toEnv} for tag ${tag}`,
|
|
35
|
-
);
|
|
36
|
-
const envInfo = getEnvInfo();
|
|
37
|
-
const fromRegistry = `${jfRegistryUrl}/${repositoryName}-${fromEnv}-docker-local`;
|
|
38
|
-
const toRegistry = `${jfRegistryUrl}/${repositoryName}-${toEnv}-docker-local`;
|
|
39
|
-
const imageName = `${repositoryName}:${tag}`;
|
|
40
|
-
const fromFullImageName = `${fromRegistry}/${imageName}`;
|
|
41
|
-
const toFullImageName = `${toRegistry}/${imageName}`;
|
|
42
|
-
|
|
43
|
-
console.log(
|
|
44
|
-
`Copying Docker image: ${fromFullImageName} -> ${toFullImageName}`,
|
|
45
|
-
);
|
|
46
|
-
|
|
47
|
-
// Login to source registry
|
|
48
|
-
await $`echo ${envInfo[fromEnv].jfrog.password} | docker login --username ${envInfo[fromEnv].jfrog.username} --password-stdin ${jfRegistryUrl}`;
|
|
49
|
-
await $`docker pull ${fromFullImageName}`;
|
|
50
|
-
await $`docker tag ${fromFullImageName} ${toFullImageName}`;
|
|
51
|
-
|
|
52
|
-
// Login to target registry
|
|
53
|
-
await $`echo ${envInfo[toEnv].jfrog.password} | docker login --username ${envInfo[toEnv].jfrog.username} --password-stdin ${jfRegistryUrl}`;
|
|
54
|
-
await $`docker push ${toFullImageName}`;
|
|
55
|
-
}
|
|
1
|
+
import { $ } from 'zx';
|
|
2
|
+
import { appInfo, getEnvInfo, jfRegistryUrl } from './config.js';
|
|
3
|
+
|
|
4
|
+
/*
|
|
5
|
+
TARGET_ENV
|
|
6
|
+
PUBLISH_TAG
|
|
7
|
+
REPOSITORY_NAME
|
|
8
|
+
*/
|
|
9
|
+
export async function copy(application, fromEnv, toEnv, tag) {
|
|
10
|
+
const envInfo = getEnvInfo();
|
|
11
|
+
const repositoryName = appInfo[application].repositoryName;
|
|
12
|
+
const fromRegistry = `${jfRegistryUrl}/${repositoryName}-${fromEnv}-docker-local`;
|
|
13
|
+
const toRegistry = `${jfRegistryUrl}/${repositoryName}-${toEnv}-docker-local`;
|
|
14
|
+
const imageName = `${repositoryName}:${tag}`;
|
|
15
|
+
const fromFullImageName = `${fromRegistry}/${imageName}`;
|
|
16
|
+
const toFullImageName = `${toRegistry}/${imageName}`;
|
|
17
|
+
|
|
18
|
+
console.log(
|
|
19
|
+
`Copying Docker image: ${fromFullImageName} -> ${toFullImageName}`,
|
|
20
|
+
);
|
|
21
|
+
|
|
22
|
+
// Login to source registry
|
|
23
|
+
await $`echo ${envInfo[fromEnv].jfrog.password} | docker login --username ${envInfo[fromEnv].jfrog.username} --password-stdin ${jfRegistryUrl}`;
|
|
24
|
+
await $`docker pull ${fromFullImageName}`;
|
|
25
|
+
await $`docker tag ${fromFullImageName} ${toFullImageName}`;
|
|
26
|
+
|
|
27
|
+
// Login to target registry
|
|
28
|
+
await $`echo ${envInfo[toEnv].jfrog.password} | docker login --username ${envInfo[toEnv].jfrog.username} --password-stdin ${jfRegistryUrl}`;
|
|
29
|
+
await $`docker push ${toFullImageName}`;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export async function copy2(repositoryName, fromEnv, toEnv, tag) {
|
|
33
|
+
console.log(
|
|
34
|
+
`Copying repository ${repositoryName} from ${fromEnv} to ${toEnv} for tag ${tag}`,
|
|
35
|
+
);
|
|
36
|
+
const envInfo = getEnvInfo();
|
|
37
|
+
const fromRegistry = `${jfRegistryUrl}/${repositoryName}-${fromEnv}-docker-local`;
|
|
38
|
+
const toRegistry = `${jfRegistryUrl}/${repositoryName}-${toEnv}-docker-local`;
|
|
39
|
+
const imageName = `${repositoryName}:${tag}`;
|
|
40
|
+
const fromFullImageName = `${fromRegistry}/${imageName}`;
|
|
41
|
+
const toFullImageName = `${toRegistry}/${imageName}`;
|
|
42
|
+
|
|
43
|
+
console.log(
|
|
44
|
+
`Copying Docker image: ${fromFullImageName} -> ${toFullImageName}`,
|
|
45
|
+
);
|
|
46
|
+
|
|
47
|
+
// Login to source registry
|
|
48
|
+
await $`echo ${envInfo[fromEnv].jfrog.password} | docker login --username ${envInfo[fromEnv].jfrog.username} --password-stdin ${jfRegistryUrl}`;
|
|
49
|
+
await $`docker pull ${fromFullImageName}`;
|
|
50
|
+
await $`docker tag ${fromFullImageName} ${toFullImageName}`;
|
|
51
|
+
|
|
52
|
+
// Login to target registry
|
|
53
|
+
await $`echo ${envInfo[toEnv].jfrog.password} | docker login --username ${envInfo[toEnv].jfrog.username} --password-stdin ${jfRegistryUrl}`;
|
|
54
|
+
await $`docker push ${toFullImageName}`;
|
|
55
|
+
}
|