@docupace/pipeline 1.0.35 → 1.0.37
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/changeset/cli.js +16 -6
- package/src/next/cli.js +29 -4
- package/src/next/copy.js +4 -1
- package/src/next/deploy.js +16 -8
- package/src/next/jira.js +1 -4
package/package.json
CHANGED
package/src/changeset/cli.js
CHANGED
|
@@ -249,14 +249,24 @@ program
|
|
|
249
249
|
}
|
|
250
250
|
const jiraTicketId = jiraTicketMatch[0];
|
|
251
251
|
|
|
252
|
-
|
|
253
|
-
const
|
|
254
|
-
|
|
255
|
-
|
|
252
|
+
const jiraBaseUrl = 'https://docupacellc.atlassian.net';
|
|
253
|
+
const jiraEmail = process.env.JIRA_API_EMAIL;
|
|
254
|
+
const jiraApiKey = process.env.JIRA_API_KEY;
|
|
255
|
+
const jiraFullApiKey = `${jiraEmail}:${jiraApiKey}`;
|
|
256
|
+
const jiraUrl = `${jiraBaseUrl}/rest/api/2/issue/${jiraTicketId}`;
|
|
257
|
+
const jiraResponse = await fetch(jiraUrl, {
|
|
258
|
+
headers: {
|
|
259
|
+
Authorization: `Basic ${Buffer.from(jiraFullApiKey).toString('base64')}`,
|
|
260
|
+
'Content-Type': 'application/json',
|
|
261
|
+
},
|
|
262
|
+
});
|
|
256
263
|
|
|
257
|
-
if (
|
|
258
|
-
throw new Error(
|
|
264
|
+
if (!jiraResponse.ok) {
|
|
265
|
+
throw new Error(
|
|
266
|
+
`Failed to fetch Jira ticket. Status: ${jiraResponse.status}`,
|
|
267
|
+
);
|
|
259
268
|
}
|
|
269
|
+
const jiraTicketData = await jiraResponse.json();
|
|
260
270
|
|
|
261
271
|
const jiraSummary = jiraTicketData.fields.summary;
|
|
262
272
|
|
package/src/next/cli.js
CHANGED
|
@@ -4,7 +4,12 @@ import { Command } from 'commander';
|
|
|
4
4
|
import { pull } from './pull.js';
|
|
5
5
|
import { sonar } from './sonar.js';
|
|
6
6
|
import { publish } from './publish.js';
|
|
7
|
-
import {
|
|
7
|
+
import {
|
|
8
|
+
deployAppWithTag,
|
|
9
|
+
deployFromSite,
|
|
10
|
+
getDefaultDeploySite,
|
|
11
|
+
getDeployTag,
|
|
12
|
+
} from './deploy.js';
|
|
8
13
|
import { deployTemplate } from './deploy.js';
|
|
9
14
|
import { copy } from './copy.js';
|
|
10
15
|
import { vaultAddSiteData } from './vault.js';
|
|
@@ -101,10 +106,30 @@ program
|
|
|
101
106
|
});
|
|
102
107
|
|
|
103
108
|
program
|
|
104
|
-
.command('
|
|
109
|
+
.command('deploy-template')
|
|
105
110
|
.description('Deploy an application for a specific site')
|
|
106
|
-
.action(async (
|
|
107
|
-
await
|
|
111
|
+
.action(async () => {
|
|
112
|
+
const deployTag = await getDeployTag();
|
|
113
|
+
const { env, site } = await getDefaultDeploySite(deployTag);
|
|
114
|
+
await deployTemplate(env, site, deployTag);
|
|
115
|
+
});
|
|
116
|
+
|
|
117
|
+
program
|
|
118
|
+
.command('deployTemplate')
|
|
119
|
+
.description('Deploy an application for a specific site')
|
|
120
|
+
.action(async () => {
|
|
121
|
+
const deployTag = await getDeployTag();
|
|
122
|
+
const { env, site } = await getDefaultDeploySite(deployTag);
|
|
123
|
+
await deployTemplate(env, site, deployTag);
|
|
124
|
+
});
|
|
125
|
+
|
|
126
|
+
program
|
|
127
|
+
.command('deploy-app <application>')
|
|
128
|
+
.description('Deploy an application for a specific site')
|
|
129
|
+
.action(async (application) => {
|
|
130
|
+
const deployTag = await getDeployTag();
|
|
131
|
+
const { env, site } = await getDefaultDeploySite(deployTag);
|
|
132
|
+
await deployAppWithTag(application, env, site, deployTag);
|
|
108
133
|
});
|
|
109
134
|
|
|
110
135
|
program
|
package/src/next/copy.js
CHANGED
|
@@ -30,6 +30,9 @@ export async function copy(application, fromEnv, toEnv, tag) {
|
|
|
30
30
|
}
|
|
31
31
|
|
|
32
32
|
export async function copy2(repositoryName, fromEnv, toEnv, tag) {
|
|
33
|
+
console.log(
|
|
34
|
+
`Copying repository ${repositoryName} from ${fromEnv} to ${toEnv} for tag ${tag}`,
|
|
35
|
+
);
|
|
33
36
|
const envInfo = getEnvInfo();
|
|
34
37
|
const fromRegistry = `${jfRegistryUrl}/${repositoryName}-${fromEnv}-docker-local`;
|
|
35
38
|
const toRegistry = `${jfRegistryUrl}/${repositoryName}-${toEnv}-docker-local`;
|
|
@@ -49,4 +52,4 @@ export async function copy2(repositoryName, fromEnv, toEnv, tag) {
|
|
|
49
52
|
// Login to target registry
|
|
50
53
|
await $`echo ${envInfo[toEnv].jfrog.password} | docker login --username ${envInfo[toEnv].jfrog.username} --password-stdin ${jfRegistryUrl}`;
|
|
51
54
|
await $`docker push ${toFullImageName}`;
|
|
52
|
-
}
|
|
55
|
+
}
|
package/src/next/deploy.js
CHANGED
|
@@ -266,7 +266,7 @@ export async function writeAndPushDeployConfig(
|
|
|
266
266
|
* @param {string} site - The site name.
|
|
267
267
|
*/
|
|
268
268
|
|
|
269
|
-
async function getDeployTag() {
|
|
269
|
+
export async function getDeployTag() {
|
|
270
270
|
const gitTag = (
|
|
271
271
|
await $`git tag --points-at HEAD | grep '^v' | head -n 1`
|
|
272
272
|
).stdout.trim();
|
|
@@ -274,12 +274,17 @@ async function getDeployTag() {
|
|
|
274
274
|
return deployTag;
|
|
275
275
|
}
|
|
276
276
|
|
|
277
|
-
export async function
|
|
278
|
-
const
|
|
277
|
+
export async function getDefaultDeploySite(deployTag) {
|
|
278
|
+
const env = deployTag.includes('alpha') ? 'dev' : 'qa';
|
|
279
|
+
const site = env === 'dev' ? 'financialdev' : 'qa';
|
|
280
|
+
return { env, site };
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
export async function deployTemplate(env, site, deployTag) {
|
|
279
284
|
console.log(`Deploying standard template for site: ${site}`);
|
|
280
285
|
console.log(`Using deployment tag: ${deployTag}`);
|
|
281
286
|
const { repoPath, deployConfigFilePath, deployConfig } =
|
|
282
|
-
await cloneAndReadDeployConfig('graphql-server',
|
|
287
|
+
await cloneAndReadDeployConfig('graphql-server', env, site);
|
|
283
288
|
|
|
284
289
|
deployConfig.graphqlServer.standardConfigRemoteBranch = deployTag;
|
|
285
290
|
|
|
@@ -292,14 +297,17 @@ export async function deployTemplate(site) {
|
|
|
292
297
|
console.log('Deployment completed successfully.');
|
|
293
298
|
}
|
|
294
299
|
|
|
295
|
-
export async function
|
|
296
|
-
const deployTag = getDeployTag();
|
|
297
|
-
|
|
300
|
+
export async function deployAppWithTag(application, env, site, deployTag) {
|
|
298
301
|
console.log(`Deploying application: ${application} for site: ${site}`);
|
|
299
302
|
console.log(`Using deployment tag: ${deployTag}`);
|
|
300
303
|
|
|
304
|
+
if (env !== 'dev') {
|
|
305
|
+
const appDetails = appInfo[application];
|
|
306
|
+
await copy2(appDetails.repositoryName, 'dev', env, deployTag);
|
|
307
|
+
}
|
|
308
|
+
|
|
301
309
|
const { repoPath, deployConfigFilePath, deployConfig } =
|
|
302
|
-
await cloneAndReadDeployConfig(application,
|
|
310
|
+
await cloneAndReadDeployConfig(application, env, site);
|
|
303
311
|
const updatedConfigData = setTag(deployConfig, deployTag);
|
|
304
312
|
await writeAndPushDeployConfig(
|
|
305
313
|
repoPath,
|
package/src/next/jira.js
CHANGED
|
@@ -74,10 +74,7 @@ export async function updateComponentVersion(issueKey, packageName, version) {
|
|
|
74
74
|
*/
|
|
75
75
|
export async function makeJiraRequest(endpoint, options = {}) {
|
|
76
76
|
try {
|
|
77
|
-
const response = await jiraClient(
|
|
78
|
-
url: endpoint,
|
|
79
|
-
...options,
|
|
80
|
-
});
|
|
77
|
+
const response = await jiraClient.get(endpoint, options);
|
|
81
78
|
return response.data;
|
|
82
79
|
} catch (error) {
|
|
83
80
|
console.error(`Error making Jira request: ${error.message}`);
|