@docupace/pipeline 1.0.5-4.ervins → 1.0.5-alpha.0
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/next-changeset-validate.sh +8 -8
- package/eslint.config.js +1 -1
- package/next/changeset.sh +75 -75
- package/next/copy.sh +34 -34
- package/next/deploy.sh +40 -40
- package/next/execute.sh +117 -123
- package/next/sonar.sh +23 -23
- package/package.json +35 -50
- package/src/changeset/cli.js +254 -200
- package/src/changeset/validate.js +47 -84
- package/src/next/cli.js +72 -228
- package/src/next/config.js +0 -96
- package/src/next/copy.js +30 -61
- package/src/next/deploy.js +249 -595
- package/src/next/publish.js +48 -71
- package/src/next/pull.js +7 -7
- package/src/next/sonar.js +23 -23
- package/README.md +0 -136
- package/bin/azuread_update_callbacks_for_app.sh +0 -58
- package/src/auth0/alias.js +0 -72
- package/src/auth0/cli.js +0 -76
- package/src/auth0/configure.js +0 -783
- package/src/auth0/export.js +0 -43
- package/src/auth0/metadata.js +0 -132
- package/src/auth0/vault.js +0 -107
- package/src/changeset/changeset-config.js +0 -34
- package/src/changeset/create.js +0 -205
- package/src/changeset/package-util.js +0 -86
- package/src/changeset/util.js +0 -43
- package/src/changeset/version.js +0 -102
- package/src/jenkins/setParams.groovy +0 -58
- package/src/next/alias.js +0 -53
- package/src/next/apache.js +0 -73
- package/src/next/connect.js +0 -227
- package/src/next/haproxy.js +0 -71
- package/src/next/jenkins.js +0 -123
- package/src/next/jira.js +0 -84
- package/src/next/logger.js +0 -17
- package/src/next/pipline.js +0 -114
- package/src/next/util.js +0 -93
- package/src/next/vault.js +0 -45
- package/terraform/apply.sh +0 -37
- package/terraform/init.sh +0 -72
- package/terraform/plan.sh +0 -76
- package/terraform/validate.sh +0 -17
|
@@ -1,84 +1,47 @@
|
|
|
1
|
-
import fs from 'fs';
|
|
2
|
-
import path from 'path';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
const
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
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
|
+
|
|
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
|
+
}
|
package/src/next/cli.js
CHANGED
|
@@ -1,228 +1,72 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
import { Command } from 'commander';
|
|
4
|
-
import { pull } from './pull.js';
|
|
5
|
-
import { sonar } from './sonar.js';
|
|
6
|
-
import { publish } from './publish.js';
|
|
7
|
-
import {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
import {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
.
|
|
46
|
-
.
|
|
47
|
-
.
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
.
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
.
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
.
|
|
67
|
-
.
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
.action(async (options) => {
|
|
74
|
-
const { siteName, siteConfigRemotePath } = options;
|
|
75
|
-
await vaultAddSiteData(siteName, siteConfigRemotePath);
|
|
76
|
-
});
|
|
77
|
-
|
|
78
|
-
program
|
|
79
|
-
.command('publish')
|
|
80
|
-
.description('Publish a Docker image')
|
|
81
|
-
.action(async () => {
|
|
82
|
-
await publish(GIT_SHA);
|
|
83
|
-
});
|
|
84
|
-
|
|
85
|
-
program
|
|
86
|
-
.command('deploy-from-site')
|
|
87
|
-
.description('Deploy an application for a specific site')
|
|
88
|
-
.requiredOption('-f, --from-env <fromEnv>', 'Source environment')
|
|
89
|
-
.requiredOption('-t, --to-env <toEnv>', 'Target environment')
|
|
90
|
-
.requiredOption('-F, --from-site <fromSite>', 'Source site')
|
|
91
|
-
.requiredOption('-T, --to-site <toSite>', 'Target site')
|
|
92
|
-
.option('-c, --deploy-core <deployCore>', 'Deploy Core', 'false')
|
|
93
|
-
.option('-C, --deploy-connect <deployConnect>', 'Deploy Connect', 'false')
|
|
94
|
-
.action(async (options) => {
|
|
95
|
-
const { fromEnv, fromSite, toEnv, toSite, deployCore, deployConnect } =
|
|
96
|
-
options;
|
|
97
|
-
await deployFromSite(
|
|
98
|
-
fromEnv,
|
|
99
|
-
fromSite,
|
|
100
|
-
toEnv,
|
|
101
|
-
toSite,
|
|
102
|
-
deployCore,
|
|
103
|
-
deployConnect,
|
|
104
|
-
);
|
|
105
|
-
});
|
|
106
|
-
|
|
107
|
-
program
|
|
108
|
-
.command('deploy-template [tagPrefix]')
|
|
109
|
-
.description('Deploy an application for a specific site')
|
|
110
|
-
.action(async (tagPrefix) => {
|
|
111
|
-
const deployTag = await getDeployTag(tagPrefix);
|
|
112
|
-
const sites = await getDefaultDeploySite(deployTag);
|
|
113
|
-
for (const { env, site } of sites) {
|
|
114
|
-
await deployTemplate(env, site, deployTag);
|
|
115
|
-
}
|
|
116
|
-
});
|
|
117
|
-
|
|
118
|
-
program
|
|
119
|
-
.command('deployTemplate')
|
|
120
|
-
.description('Deploy an application for a specific site')
|
|
121
|
-
.action(async () => {
|
|
122
|
-
const deployTag = await getDeployTag();
|
|
123
|
-
const sites = await getDefaultDeploySite(deployTag);
|
|
124
|
-
for (const { env, site } of sites) {
|
|
125
|
-
await deployTemplate(env, site, deployTag);
|
|
126
|
-
}
|
|
127
|
-
});
|
|
128
|
-
|
|
129
|
-
program
|
|
130
|
-
.command('deploy-app <application>')
|
|
131
|
-
.description('Deploy an application for a specific site')
|
|
132
|
-
.action(async (application) => {
|
|
133
|
-
const deployTag = await getDeployTag();
|
|
134
|
-
const sites = await getDefaultDeploySite(deployTag);
|
|
135
|
-
for (const { env, site } of sites) {
|
|
136
|
-
await deployAppWithTag(application, env, site, deployTag);
|
|
137
|
-
}
|
|
138
|
-
});
|
|
139
|
-
|
|
140
|
-
program
|
|
141
|
-
.command('deploy-mono-app <tag> <application>')
|
|
142
|
-
.description('Deploy an application for a specific site')
|
|
143
|
-
.action(async (tag, application) => {
|
|
144
|
-
const deployTag = await getDeployTag(tag);
|
|
145
|
-
const version = 'v' + deployTag.split('@')[1];
|
|
146
|
-
const sites = await getDefaultDeploySite(version);
|
|
147
|
-
for (const { env, site } of sites) {
|
|
148
|
-
await deployAppWithTag(application, env, site, version);
|
|
149
|
-
}
|
|
150
|
-
});
|
|
151
|
-
|
|
152
|
-
program
|
|
153
|
-
.command('deploy-core <env> <site>')
|
|
154
|
-
.description('Deploy Core')
|
|
155
|
-
.option('-l, --liquibase <liquibase>', 'Application name', 'true')
|
|
156
|
-
.option('-b, --branch <branch>', 'Branch', 'master')
|
|
157
|
-
.action(async (env, site, options) => {
|
|
158
|
-
await deployCore(env, site, options.liquibase, options.branch);
|
|
159
|
-
});
|
|
160
|
-
|
|
161
|
-
program
|
|
162
|
-
.command('deploy-connect <env> <site>')
|
|
163
|
-
.description('Deploy Core')
|
|
164
|
-
.option('-l, --liquibase <liquibase>', 'Application name', 'true')
|
|
165
|
-
.option('-b, --branch <branch>', 'Branch', 'master')
|
|
166
|
-
.action(async (env, site, options) => {
|
|
167
|
-
await deployConnect(env, site, options.liquibase, options.branch);
|
|
168
|
-
});
|
|
169
|
-
|
|
170
|
-
program
|
|
171
|
-
.command('deploy-core-pipeline <env> <site>')
|
|
172
|
-
.description('Deploy Core')
|
|
173
|
-
.option('-l, --liquibase <liquibase>', 'Application name', 'true')
|
|
174
|
-
.option('-b, --branch <branch>', 'Branch', 'master')
|
|
175
|
-
.action(async (env, site, options) => {
|
|
176
|
-
await runPipeline('site-deploy', 'deploy-core', 'main', {
|
|
177
|
-
ENV: env,
|
|
178
|
-
SITE: site,
|
|
179
|
-
LIQUIBASE: options.liquibase,
|
|
180
|
-
BRANCH: options.branch,
|
|
181
|
-
});
|
|
182
|
-
});
|
|
183
|
-
|
|
184
|
-
program
|
|
185
|
-
.command('copy')
|
|
186
|
-
.description('Copy a Docker image between registries')
|
|
187
|
-
.requiredOption('-r, --repository <repository>', 'Repostory name')
|
|
188
|
-
.requiredOption('-f, --from-env <fromEnv>', 'Source environment')
|
|
189
|
-
.requiredOption('-t, --to-env <toEnv>', 'Target environment')
|
|
190
|
-
.requiredOption('-g, --tag <tag>', 'Image tag')
|
|
191
|
-
.requiredOption('-a, --application <application>', 'Application name')
|
|
192
|
-
.action(async (options) => {
|
|
193
|
-
const { repository, fromEnv, toEnv, tag, application } = options;
|
|
194
|
-
await copy2(repository, fromEnv, toEnv, tag, application);
|
|
195
|
-
});
|
|
196
|
-
|
|
197
|
-
program
|
|
198
|
-
.command('run-pipeline')
|
|
199
|
-
.description('Trigger a pipeline by name')
|
|
200
|
-
.requiredOption('-r, --repository <repository>', 'Repository name')
|
|
201
|
-
.requiredOption('-p, --pipeline-name <pipelineName>', 'Pipeline name')
|
|
202
|
-
.requiredOption('-b, --branch <branch>', 'Branch name')
|
|
203
|
-
.option(
|
|
204
|
-
'-v, --variables <key=value>',
|
|
205
|
-
'Pipeline variable as key=value pair',
|
|
206
|
-
(value, previous) => {
|
|
207
|
-
const [key, val] = value.split('=');
|
|
208
|
-
if (!key || val === undefined) {
|
|
209
|
-
throw new Error(`Invalid variable format: ${value}. Use key=value.`);
|
|
210
|
-
}
|
|
211
|
-
return { ...previous, [key]: val };
|
|
212
|
-
},
|
|
213
|
-
{},
|
|
214
|
-
)
|
|
215
|
-
.option('-w, --wait', 'Wait for the pipeline to complete', false) // Defaults to false
|
|
216
|
-
.action(async (cmdObj) => {
|
|
217
|
-
try {
|
|
218
|
-
const { repository, pipelineName, branch, variables, wait } = cmdObj;
|
|
219
|
-
|
|
220
|
-
// Call the triggerPipelineByName function
|
|
221
|
-
await runPipeline(repository, pipelineName, branch, variables, wait);
|
|
222
|
-
} catch (error) {
|
|
223
|
-
console.error('Error triggering pipeline:', error.message);
|
|
224
|
-
process.exit(1);
|
|
225
|
-
}
|
|
226
|
-
});
|
|
227
|
-
|
|
228
|
-
program.parse(process.argv);
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
import { Command } from 'commander';
|
|
4
|
+
import { pull } from './pull.js';
|
|
5
|
+
import { sonar } from './sonar.js';
|
|
6
|
+
import { publish } from './publish.js';
|
|
7
|
+
import {deploy, deployFromSite} from './deploy.js';
|
|
8
|
+
import { deployTemplate } from './deploy.js';
|
|
9
|
+
import { copy } from './copy.js';
|
|
10
|
+
import dotenv from 'dotenv';
|
|
11
|
+
|
|
12
|
+
dotenv.config({ path: ['.env.pipeline.local', 'config/.env.pipeline.local'] });
|
|
13
|
+
|
|
14
|
+
const program = new Command();
|
|
15
|
+
|
|
16
|
+
// GIT SHA computation
|
|
17
|
+
import { $ } from 'zx';
|
|
18
|
+
const GIT_SHA = (await $`git log --pretty=format:'%h' -n 1`).stdout.trim();
|
|
19
|
+
|
|
20
|
+
program
|
|
21
|
+
.command('pull <imageName>')
|
|
22
|
+
.description('Pull a Docker image from the registry')
|
|
23
|
+
.action(async (imageName) => {
|
|
24
|
+
await pull(imageName);
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
program
|
|
28
|
+
.command('sonar')
|
|
29
|
+
.description('Run Sonar analysis')
|
|
30
|
+
.action(async () => {
|
|
31
|
+
await sonar(GIT_SHA);
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
program
|
|
35
|
+
.command('publish')
|
|
36
|
+
.description('Publish a Docker image')
|
|
37
|
+
.action(async () => {
|
|
38
|
+
await publish(GIT_SHA);
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
program
|
|
42
|
+
.command('deploy-from-site')
|
|
43
|
+
.description('Deploy an application for a specific site')
|
|
44
|
+
.requiredOption('-f, --from-env <fromEnv>', 'Source environment')
|
|
45
|
+
.requiredOption('-t, --to-env <toEnv>', 'Target environment')
|
|
46
|
+
.requiredOption('-F, --from-site <fromSite>', 'Source site')
|
|
47
|
+
.requiredOption('-T, --to-site <toSite>', 'Target site')
|
|
48
|
+
.action(async (options) => {
|
|
49
|
+
const { fromEnv, fromSite, toEnv, toSite } = options;
|
|
50
|
+
await deployFromSite(fromEnv, fromSite, toEnv, toSite);
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
program
|
|
54
|
+
.command('deployTemplate <site>')
|
|
55
|
+
.description('Deploy an application for a specific site')
|
|
56
|
+
.action(async (site) => {
|
|
57
|
+
await deployTemplate(site);
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
program
|
|
61
|
+
.command('copy')
|
|
62
|
+
.description('Copy a Docker image between registries')
|
|
63
|
+
.requiredOption('-a, --application <application>', 'Application name')
|
|
64
|
+
.requiredOption('-f, --from-env <fromEnv>', 'Source environment')
|
|
65
|
+
.requiredOption('-t, --to-env <toEnv>', 'Target environment')
|
|
66
|
+
.requiredOption('-g, --tag <tag>', 'Image tag')
|
|
67
|
+
.action(async (options) => {
|
|
68
|
+
const { application, fromEnv, toEnv, tag } = options;
|
|
69
|
+
await copy(application, fromEnv, toEnv, tag);
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
program.parse(process.argv);
|
package/src/next/config.js
CHANGED
|
@@ -1,86 +1,17 @@
|
|
|
1
|
-
import semver from 'semver';
|
|
2
|
-
|
|
3
1
|
export const environments = ['dev', 'qa', 'uat', 'stage', 'prod'];
|
|
4
2
|
|
|
5
|
-
const UI_MONO_VERSION = '1.4.0-alpha.0';
|
|
6
|
-
|
|
7
|
-
export const environmentConfig = {
|
|
8
|
-
dev: {
|
|
9
|
-
newUrl: (site) => `https://${site}.dev.dpai.tech`,
|
|
10
|
-
oldUrl: (site) => `https://www.dev.docupaceinc.com/${site}`,
|
|
11
|
-
docupaceHost: () => 'www.dev.docupaceinc.com',
|
|
12
|
-
ccUrl: (site) => `https://${site}-cc.dev.dpai.tech`,
|
|
13
|
-
},
|
|
14
|
-
qa: {
|
|
15
|
-
newUrl: (site) => `https://${site}.qa.dpai.tech`,
|
|
16
|
-
oldUrl: (site) => `https://www.preprod.docupaceinc.com/${site}`,
|
|
17
|
-
docupaceHost: () => 'www.preprod.docupaceinc.com',
|
|
18
|
-
ccUrl: (site) => `https://${site}-cc.qa.dpai.tech`,
|
|
19
|
-
},
|
|
20
|
-
uat: {
|
|
21
|
-
newUrl: (site) => `https://${site}.uat.dpai.tech`,
|
|
22
|
-
oldUrl: (site) => `https://uat.paperout.com/${site}`,
|
|
23
|
-
docupaceHost: () => 'uat.paperout.com',
|
|
24
|
-
ccUrl: (site) => `https://${site}-cc.uat.dpai.tech`,
|
|
25
|
-
},
|
|
26
|
-
stage: {
|
|
27
|
-
newUrl: (site) => `https://${site}.stage.dpai.tech`,
|
|
28
|
-
oldUrl: (site) => `https://stage.paperout.com/${site}`,
|
|
29
|
-
docupaceHost: () => 'stage.paperout.com',
|
|
30
|
-
ccUrl: (site) => `https://${site}-cc.stage.dpai.tech`,
|
|
31
|
-
},
|
|
32
|
-
prod: {
|
|
33
|
-
newUrl: (site) => `https://${site}.dpai.tech`,
|
|
34
|
-
oldUrl: (site) => `https://www3.paperout.com/${site}`,
|
|
35
|
-
docupaceHost: () => 'www3.paperout.com',
|
|
36
|
-
ccUrl: (site) => `https://${site}-cc.dpai.tech`,
|
|
37
|
-
},
|
|
38
|
-
};
|
|
39
|
-
|
|
40
3
|
export const appInfo = {
|
|
41
4
|
'graphql-server': {
|
|
42
5
|
repositoryName: 'docupace-graphql-server',
|
|
43
|
-
imageName: 'docupace-graphql-server',
|
|
44
6
|
deployAttributes: [
|
|
45
7
|
'image.tag',
|
|
46
8
|
'graphqlServer.siteConfigRemoteBranch',
|
|
47
9
|
'graphqlServer.standardConfigRemoteBranch',
|
|
48
10
|
],
|
|
49
11
|
},
|
|
50
|
-
cc: {
|
|
51
|
-
repositoryName: 'docupace-ui-main',
|
|
52
|
-
imageName: 'cc-ui-app',
|
|
53
|
-
deployAttributes: ['image.tag'],
|
|
54
|
-
getAppRevision: (config) => {
|
|
55
|
-
const version = config.image.tag.slice(1);
|
|
56
|
-
return 'cc-ui-app@' + version;
|
|
57
|
-
},
|
|
58
|
-
},
|
|
59
12
|
ui: {
|
|
60
13
|
repositoryName: 'docupace-ui-main',
|
|
61
|
-
imageName: 'enterprise-ui-app',
|
|
62
14
|
deployAttributes: ['image.tag'],
|
|
63
|
-
getAppRevision: (config) => {
|
|
64
|
-
const tag = config.image.tag;
|
|
65
|
-
const version = tag.startsWith('v') ? tag.slice(1) : tag;
|
|
66
|
-
if (semver.gt(version, UI_MONO_VERSION)) {
|
|
67
|
-
return 'enterprise-ui-app@' + version;
|
|
68
|
-
} else {
|
|
69
|
-
return tag;
|
|
70
|
-
}
|
|
71
|
-
},
|
|
72
|
-
updateConfigFunction: (config) => {
|
|
73
|
-
if (config.image.repository.endsWith('/docupace-ui-main')) {
|
|
74
|
-
const tag = config.image.tag;
|
|
75
|
-
const version = tag.startsWith('v') ? tag.slice(1) : tag;
|
|
76
|
-
if (semver.gt(version, UI_MONO_VERSION)) {
|
|
77
|
-
const parts = config.image.repository.split('/');
|
|
78
|
-
parts[2] = 'enterprise-ui-app';
|
|
79
|
-
config.image.repository = parts.join('/');
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
return config;
|
|
83
|
-
},
|
|
84
15
|
},
|
|
85
16
|
};
|
|
86
17
|
|
|
@@ -104,34 +35,7 @@ export const getBitbucketInfo = () => {
|
|
|
104
35
|
return {
|
|
105
36
|
username: process.env.BITBUCKET_USERNAME,
|
|
106
37
|
password: process.env.BITBUCKET_APP_PASSWORD,
|
|
107
|
-
workspace: 'dp-cloud',
|
|
108
38
|
};
|
|
109
39
|
};
|
|
110
40
|
|
|
111
|
-
export const getRepUrl = (repoName) => {
|
|
112
|
-
const { username, password, workspace } = getBitbucketInfo();
|
|
113
|
-
return `https://${username}:${password}@bitbucket.org/${workspace}/${repoName}.git`;
|
|
114
|
-
};
|
|
115
|
-
|
|
116
41
|
export const jfRegistryUrl = 'registry.paperout.com';
|
|
117
|
-
|
|
118
|
-
export const getVaultSecretsConfigs = (site) => {
|
|
119
|
-
return {
|
|
120
|
-
commonSecretsPath: 'secret/data/common/config',
|
|
121
|
-
siteCommonSecretsPath: `secret/data/${site}/common/config`,
|
|
122
|
-
graphqlServerSecretsPath: `secret/data/${site}/graphql-server/config`,
|
|
123
|
-
uiSecretsPath: `secret/data/${site}/ui/config`,
|
|
124
|
-
ccUISecretsPath: `secret/data/${site}/ui-cc/config`,
|
|
125
|
-
awsSecretsPath: `secret/data/${site}/aws/config`,
|
|
126
|
-
};
|
|
127
|
-
};
|
|
128
|
-
|
|
129
|
-
export const coreSiteEnvMap = {
|
|
130
|
-
dev: 'dev',
|
|
131
|
-
qa: 'preprod',
|
|
132
|
-
stg: 'staging',
|
|
133
|
-
stage: 'staging',
|
|
134
|
-
uat: 'uat',
|
|
135
|
-
prd: 'prod',
|
|
136
|
-
prod: 'prod',
|
|
137
|
-
};
|
package/src/next/copy.js
CHANGED
|
@@ -1,61 +1,30 @@
|
|
|
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 = `${
|
|
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(
|
|
33
|
-
repositoryName,
|
|
34
|
-
fromEnv,
|
|
35
|
-
toEnv,
|
|
36
|
-
tag,
|
|
37
|
-
applicationName,
|
|
38
|
-
) {
|
|
39
|
-
console.log(
|
|
40
|
-
`Copying repository ${repositoryName} from ${fromEnv} to ${toEnv} for tag ${tag}`,
|
|
41
|
-
);
|
|
42
|
-
const envInfo = getEnvInfo();
|
|
43
|
-
const fromRegistry = `${jfRegistryUrl}/${repositoryName}-${fromEnv}-docker-local`;
|
|
44
|
-
const toRegistry = `${jfRegistryUrl}/${repositoryName}-${toEnv}-docker-local`;
|
|
45
|
-
const imageName = `${applicationName ?? repositoryName}:${tag}`;
|
|
46
|
-
const fromFullImageName = `${fromRegistry}/${imageName}`;
|
|
47
|
-
const toFullImageName = `${toRegistry}/${imageName}`;
|
|
48
|
-
|
|
49
|
-
console.log(
|
|
50
|
-
`Copying Docker image: ${fromFullImageName} -> ${toFullImageName}`,
|
|
51
|
-
);
|
|
52
|
-
|
|
53
|
-
// Login to source registry
|
|
54
|
-
await $`echo ${envInfo[fromEnv].jfrog.password} | docker login --username ${envInfo[fromEnv].jfrog.username} --password-stdin ${jfRegistryUrl}`;
|
|
55
|
-
await $`docker pull ${fromFullImageName}`;
|
|
56
|
-
await $`docker tag ${fromFullImageName} ${toFullImageName}`;
|
|
57
|
-
|
|
58
|
-
// Login to target registry
|
|
59
|
-
await $`echo ${envInfo[toEnv].jfrog.password} | docker login --username ${envInfo[toEnv].jfrog.username} --password-stdin ${jfRegistryUrl}`;
|
|
60
|
-
await $`docker push ${toFullImageName}`;
|
|
61
|
-
}
|
|
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
|
+
}
|