@docupace/pipeline 1.0.49 → 1.0.51
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/package.json +1 -1
- package/src/next/cli.js +16 -8
- package/src/next/config.js +36 -0
- package/src/next/deploy.js +33 -3
package/package.json
CHANGED
package/src/next/cli.js
CHANGED
|
@@ -109,8 +109,10 @@ program
|
|
|
109
109
|
.description('Deploy an application for a specific site')
|
|
110
110
|
.action(async (tagPrefix) => {
|
|
111
111
|
const deployTag = await getDeployTag(tagPrefix);
|
|
112
|
-
const
|
|
113
|
-
|
|
112
|
+
const sites = await getDefaultDeploySite(deployTag);
|
|
113
|
+
for (const { env, site } of sites) {
|
|
114
|
+
await deployTemplate(env, site, deployTag);
|
|
115
|
+
}
|
|
114
116
|
});
|
|
115
117
|
|
|
116
118
|
program
|
|
@@ -118,8 +120,10 @@ program
|
|
|
118
120
|
.description('Deploy an application for a specific site')
|
|
119
121
|
.action(async () => {
|
|
120
122
|
const deployTag = await getDeployTag();
|
|
121
|
-
const
|
|
122
|
-
|
|
123
|
+
const sites = await getDefaultDeploySite(deployTag);
|
|
124
|
+
for (const { env, site } of sites) {
|
|
125
|
+
await deployTemplate(env, site, deployTag);
|
|
126
|
+
}
|
|
123
127
|
});
|
|
124
128
|
|
|
125
129
|
program
|
|
@@ -127,8 +131,10 @@ program
|
|
|
127
131
|
.description('Deploy an application for a specific site')
|
|
128
132
|
.action(async (application) => {
|
|
129
133
|
const deployTag = await getDeployTag();
|
|
130
|
-
const
|
|
131
|
-
|
|
134
|
+
const sites = await getDefaultDeploySite(deployTag);
|
|
135
|
+
for (const { env, site } of sites) {
|
|
136
|
+
await deployAppWithTag(application, env, site, deployTag);
|
|
137
|
+
}
|
|
132
138
|
});
|
|
133
139
|
|
|
134
140
|
program
|
|
@@ -137,8 +143,10 @@ program
|
|
|
137
143
|
.action(async (tag, application) => {
|
|
138
144
|
const deployTag = await getDeployTag(tag);
|
|
139
145
|
const version = 'v' + deployTag.split('@')[1];
|
|
140
|
-
const
|
|
141
|
-
|
|
146
|
+
const sites = await getDefaultDeploySite(version);
|
|
147
|
+
for (const { env, site } of sites) {
|
|
148
|
+
await deployAppWithTag(application, env, site, version);
|
|
149
|
+
}
|
|
142
150
|
});
|
|
143
151
|
|
|
144
152
|
program
|
package/src/next/config.js
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
|
+
import semver from 'semver';
|
|
2
|
+
|
|
1
3
|
export const environments = ['dev', 'qa', 'uat', 'stage', 'prod'];
|
|
2
4
|
|
|
5
|
+
const UI_MONO_VERSION = '1.4.0-alpha.0';
|
|
6
|
+
|
|
3
7
|
export const environmentConfig = {
|
|
4
8
|
dev: {
|
|
5
9
|
newUrl: (site) => `https://${site}.dev.dpai.tech`,
|
|
@@ -36,15 +40,47 @@ export const environmentConfig = {
|
|
|
36
40
|
export const appInfo = {
|
|
37
41
|
'graphql-server': {
|
|
38
42
|
repositoryName: 'docupace-graphql-server',
|
|
43
|
+
imageName: 'docupace-graphql-server',
|
|
39
44
|
deployAttributes: [
|
|
40
45
|
'image.tag',
|
|
41
46
|
'graphqlServer.siteConfigRemoteBranch',
|
|
42
47
|
'graphqlServer.standardConfigRemoteBranch',
|
|
43
48
|
],
|
|
44
49
|
},
|
|
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
|
+
},
|
|
45
59
|
ui: {
|
|
46
60
|
repositoryName: 'docupace-ui-main',
|
|
61
|
+
imageName: 'enterprise-ui-app',
|
|
47
62
|
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
|
+
},
|
|
48
84
|
},
|
|
49
85
|
};
|
|
50
86
|
|
package/src/next/deploy.js
CHANGED
|
@@ -274,10 +274,40 @@ export async function getDeployTag(prefix = 'v') {
|
|
|
274
274
|
return deployTag;
|
|
275
275
|
}
|
|
276
276
|
|
|
277
|
+
function getDeploymentTargets(tag, config) {
|
|
278
|
+
const semverRegex = /^v?(\d+)\.(\d+)\.(\d+)(?:-([\w.\-]+))?$/;
|
|
279
|
+
const match = tag.match(semverRegex);
|
|
280
|
+
|
|
281
|
+
if (!match) {
|
|
282
|
+
throw new Error(`Invalid tag format: ${tag}`);
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
const [_, major, minor, patch, preRelease] = match;
|
|
286
|
+
const isAlpha = preRelease && preRelease.toLowerCase().includes('alpha');
|
|
287
|
+
|
|
288
|
+
return config
|
|
289
|
+
.filter((entry) => {
|
|
290
|
+
if (entry.version.toLowerCase() === 'alpha' && isAlpha) {
|
|
291
|
+
return true;
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
const [entryMajor, entryMinor] = entry.version.split('.');
|
|
295
|
+
return (
|
|
296
|
+
!isAlpha &&
|
|
297
|
+
parseInt(entryMajor) === parseInt(major) &&
|
|
298
|
+
parseInt(entryMinor) === parseInt(minor)
|
|
299
|
+
);
|
|
300
|
+
})
|
|
301
|
+
.map((entry) => ({ env: entry.env, site: entry.site }));
|
|
302
|
+
}
|
|
303
|
+
|
|
277
304
|
export async function getDefaultDeploySite(deployTag) {
|
|
278
|
-
const
|
|
279
|
-
const
|
|
280
|
-
|
|
305
|
+
const repPath = await cloneEnvRepository('dev');
|
|
306
|
+
const autoDeployConfigPath = path.resolve(repPath, 'auto-deploy.yaml');
|
|
307
|
+
const autoDeployConfig = yaml.load(
|
|
308
|
+
fs.readFileSync(autoDeployConfigPath, 'utf8'),
|
|
309
|
+
);
|
|
310
|
+
return getDeploymentTargets(deployTag, autoDeployConfig);
|
|
281
311
|
}
|
|
282
312
|
|
|
283
313
|
export async function deployTemplate(env, site, deployTag) {
|