@docupace/pipeline 1.0.35-matttest.4 → 1.0.35

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-matttest.4",
3
+ "version": "1.0.35",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -249,29 +249,14 @@ program
249
249
  }
250
250
  const jiraTicketId = jiraTicketMatch[0];
251
251
 
252
- console.debug('JIRA_API_EMAIL:', process.env.JIRA_API_EMAIL);
253
- console.debug('JIRA_API_KEY:', process.env.JIRA_API_KEY);
254
- const url = `/rest/api/2/issue/${jiraTicketId}`;
255
- console.debug('url: ', url);
256
-
257
- const jiraBaseUrl = 'https://docupacellc.atlassian.net';
258
- const jiraEmail = process.env.JIRA_API_EMAIL;
259
- const jiraApiKey = process.env.JIRA_API_KEY;
260
- const jiraFullApiKey = `${jiraEmail}:${jiraApiKey}`;
261
- const jiraUrl = `${jiraBaseUrl}/rest/api/2/issue/${jiraTicketId}`;
262
- const jiraResponse = await fetch(jiraUrl, {
263
- headers: {
264
- Authorization: `Basic ${Buffer.from(jiraFullApiKey).toString('base64')}`,
265
- 'Content-Type': 'application/json',
266
- },
267
- });
252
+ // Step 3: Fetch Jira ticket information
253
+ const jiraTicketData = await makeJiraRequest(
254
+ `/rest/api/2/issue/${jiraTicketId}`,
255
+ );
268
256
 
269
- if (!jiraResponse.ok) {
270
- throw new Error(
271
- `Failed to fetch Jira ticket. Status: ${jiraResponse.status}`,
272
- );
257
+ if (jiraTicketData.fields.customfield_10107?.value !== 'Product') {
258
+ throw new Error('Issue Type of Work must be Product');
273
259
  }
274
- const jiraTicketData = await jiraResponse.json();
275
260
 
276
261
  const jiraSummary = jiraTicketData.fields.summary;
277
262
 
package/src/next/cli.js CHANGED
@@ -4,12 +4,7 @@ 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 {
8
- deployAppWithTag,
9
- deployFromSite,
10
- getDefaultDeploySite,
11
- getDeployTag,
12
- } from './deploy.js';
7
+ import { deployFromSite } from './deploy.js';
13
8
  import { deployTemplate } from './deploy.js';
14
9
  import { copy } from './copy.js';
15
10
  import { vaultAddSiteData } from './vault.js';
@@ -106,30 +101,10 @@ program
106
101
  });
107
102
 
108
103
  program
109
- .command('deploy-template')
104
+ .command('deployTemplate <site>')
110
105
  .description('Deploy an application for a specific 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);
106
+ .action(async (site) => {
107
+ await deployTemplate(site);
133
108
  });
134
109
 
135
110
  program
@@ -266,7 +266,7 @@ export async function writeAndPushDeployConfig(
266
266
  * @param {string} site - The site name.
267
267
  */
268
268
 
269
- export async function getDeployTag() {
269
+ 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,17 +274,12 @@ export async function getDeployTag() {
274
274
  return deployTag;
275
275
  }
276
276
 
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) {
277
+ export async function deployTemplate(site) {
278
+ const deployTag = await getDeployTag();
284
279
  console.log(`Deploying standard template for site: ${site}`);
285
280
  console.log(`Using deployment tag: ${deployTag}`);
286
281
  const { repoPath, deployConfigFilePath, deployConfig } =
287
- await cloneAndReadDeployConfig('graphql-server', env, site);
282
+ await cloneAndReadDeployConfig('graphql-server', 'dev', site);
288
283
 
289
284
  deployConfig.graphqlServer.standardConfigRemoteBranch = deployTag;
290
285
 
@@ -297,17 +292,14 @@ export async function deployTemplate(env, site, deployTag) {
297
292
  console.log('Deployment completed successfully.');
298
293
  }
299
294
 
300
- export async function deployAppWithTag(application, env, site, deployTag) {
295
+ export async function deploy(application, site) {
296
+ const deployTag = getDeployTag();
297
+
301
298
  console.log(`Deploying application: ${application} for site: ${site}`);
302
299
  console.log(`Using deployment tag: ${deployTag}`);
303
300
 
304
- if (env !== 'dev') {
305
- const appDetails = appInfo[application];
306
- await copy2(appDetails.repositoryName, 'dev', env, deployTag);
307
- }
308
-
309
301
  const { repoPath, deployConfigFilePath, deployConfig } =
310
- await cloneAndReadDeployConfig(application, env, site);
302
+ await cloneAndReadDeployConfig(application, 'dev', site);
311
303
  const updatedConfigData = setTag(deployConfig, deployTag);
312
304
  await writeAndPushDeployConfig(
313
305
  repoPath,
package/src/next/jira.js CHANGED
@@ -74,7 +74,10 @@ 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.get(endpoint, options);
77
+ const response = await jiraClient({
78
+ url: endpoint,
79
+ ...options,
80
+ });
78
81
  return response.data;
79
82
  } catch (error) {
80
83
  console.error(`Error making Jira request: ${error.message}`);