@docupace/pipeline 1.0.35 → 1.0.36

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@docupace/pipeline",
3
- "version": "1.0.35",
3
+ "version": "1.0.36",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -249,14 +249,24 @@ program
249
249
  }
250
250
  const jiraTicketId = jiraTicketMatch[0];
251
251
 
252
- // Step 3: Fetch Jira ticket information
253
- const jiraTicketData = await makeJiraRequest(
254
- `/rest/api/2/issue/${jiraTicketId}`,
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 (jiraTicketData.fields.customfield_10107?.value !== 'Product') {
258
- throw new Error('Issue Type of Work must be Product');
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 { deployFromSite } from './deploy.js';
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('deployTemplate <site>')
109
+ .command('deploy-template')
105
110
  .description('Deploy an application for a specific site')
106
- .action(async (site) => {
107
- await deployTemplate(site);
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
@@ -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 deployTemplate(site) {
278
- const deployTag = await getDeployTag();
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', 'dev', site);
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 deploy(application, site) {
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, 'dev', site);
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}`);