@docupace/pipeline 1.0.84 → 1.0.86
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 +1 -1
- package/src/next/deploy.js +56 -24
package/package.json
CHANGED
package/src/next/cli.js
CHANGED
|
@@ -89,7 +89,7 @@ program
|
|
|
89
89
|
.requiredOption('-t, --to-env <toEnv>', 'Target environment')
|
|
90
90
|
.requiredOption('-F, --from-site <fromSite>', 'Source site')
|
|
91
91
|
.requiredOption('-T, --to-site <toSite>', 'Target site')
|
|
92
|
-
.option('-j, --jira-ticket
|
|
92
|
+
.option('-j, --jira-ticket [jiraTicket]', 'JIRA ticket (optional)')
|
|
93
93
|
.option('-c, --deploy-core <deployCore>', 'Deploy Core', 'false')
|
|
94
94
|
.option('-C, --deploy-connect <deployConnect>', 'Deploy Connect', 'false')
|
|
95
95
|
.action(async (options) => {
|
package/src/next/deploy.js
CHANGED
|
@@ -564,7 +564,14 @@ export async function deployFromSite(
|
|
|
564
564
|
`Deploying changes from ${fromSite} in ${fromEnv} to ${toSite} in ${toEnv}${jiraTicket ? ` approved by JIRA ticket ${jiraTicket}` : ''}`,
|
|
565
565
|
);
|
|
566
566
|
|
|
567
|
-
if (
|
|
567
|
+
if (toEnv === 'prod') {
|
|
568
|
+
if (!jiraTicket) {
|
|
569
|
+
console.error(
|
|
570
|
+
'The deployment to prod environment requires a JIRA ticket to be provided',
|
|
571
|
+
);
|
|
572
|
+
process.exit(1);
|
|
573
|
+
}
|
|
574
|
+
|
|
568
575
|
try {
|
|
569
576
|
const response = await makeJiraRequest(`/rest/api/2/issue/${jiraTicket}`);
|
|
570
577
|
const docupacecInstance = response.fields.customfield_10045.value;
|
|
@@ -595,34 +602,59 @@ export async function deployFromSite(
|
|
|
595
602
|
process.exit(1);
|
|
596
603
|
}
|
|
597
604
|
|
|
598
|
-
if (
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
605
|
+
if (docupacecInstance !== 'Production') {
|
|
606
|
+
console.error(
|
|
607
|
+
`The deployment to prod environment requires Docupace Instance to be "Production", but got "${docupacecInstance}"`,
|
|
608
|
+
);
|
|
609
|
+
console.error(`Please check the JIRA ticket: ${jiraTicketUrl}`);
|
|
610
|
+
process.exit(1);
|
|
611
|
+
}
|
|
612
|
+
|
|
613
|
+
if (fromSite !== toSite) {
|
|
614
|
+
console.error(
|
|
615
|
+
`The deployment to prod environment requires fromSite and toSite to be equal, but fromSite: "${fromSite}", toSite: "${toSite}"`,
|
|
616
|
+
);
|
|
617
|
+
console.error(`Please check the JIRA ticket: ${jiraTicketUrl}`);
|
|
618
|
+
process.exit(1);
|
|
619
|
+
}
|
|
620
|
+
|
|
621
|
+
console.log('Production deployment validations passed');
|
|
622
|
+
} catch (error) {
|
|
623
|
+
console.error(`Failed to make a Jira request: ${error.message}`);
|
|
624
|
+
process.exit(1);
|
|
625
|
+
}
|
|
626
|
+
} else if (jiraTicket) {
|
|
627
|
+
try {
|
|
628
|
+
const response = await makeJiraRequest(`/rest/api/2/issue/${jiraTicket}`);
|
|
629
|
+
const siteUrl = response.fields.customfield_10041;
|
|
630
|
+
const status = response.fields.status.name;
|
|
631
|
+
const jiraBaseUrl = response.self.split('/rest/api')[0];
|
|
632
|
+
const jiraTicketUrl = `${jiraBaseUrl}/browse/${response.key}`;
|
|
633
|
+
|
|
634
|
+
console.log(`Docupace Site URL: ${siteUrl}`);
|
|
635
|
+
console.log(`JIRA Ticket Status: ${status}`);
|
|
636
|
+
console.log(`JIRA Ticket URL: ${jiraTicketUrl}`);
|
|
637
|
+
|
|
638
|
+
const allowedStatuses = ['To Do', 'In Progress'];
|
|
639
|
+
if (!allowedStatuses.includes(status)) {
|
|
640
|
+
console.error(
|
|
641
|
+
`The JIRA ticket status must be "To Do" or "In Progress", but got "${status}"`,
|
|
642
|
+
);
|
|
643
|
+
console.error(`Please check the JIRA ticket: ${jiraTicketUrl}`);
|
|
644
|
+
process.exit(1);
|
|
645
|
+
}
|
|
646
|
+
|
|
647
|
+
if (!siteUrl.includes(toSite)) {
|
|
648
|
+
console.error(
|
|
649
|
+
`The toSite "${toSite}" must be present in the Docupace Site URL: "${siteUrl}"`,
|
|
650
|
+
);
|
|
651
|
+
console.error(`Please check the JIRA ticket: ${jiraTicketUrl}`);
|
|
652
|
+
process.exit(1);
|
|
616
653
|
}
|
|
617
654
|
} catch (error) {
|
|
618
655
|
console.error(`Failed to make a Jira request: ${error.message}`);
|
|
619
656
|
process.exit(1);
|
|
620
657
|
}
|
|
621
|
-
} else if (toEnv === 'prod') {
|
|
622
|
-
console.error(
|
|
623
|
-
'The deployment to prod environment requires a JIRA ticket to be provided',
|
|
624
|
-
);
|
|
625
|
-
process.exit(1);
|
|
626
658
|
}
|
|
627
659
|
|
|
628
660
|
if (isDeployCore === 'true') {
|