hardisgroupcom / sfdx-hardis

Swiss-army-knife Toolbox for Salesforce. Orchestrates base commands and assist users with interactive wizards to make much more than native sfdx + Allows you to define a complete CI/CD Pipeline and Schedule a daily Metadata backup & monitoring of your orgs
https://sfdx-hardis.cloudity.com
GNU Affero General Public License v3.0
194 stars 35 forks source link

Skip post-deployment notifications when empty package.xml, simplify JIRA error logging #557

Closed legetz closed 7 months ago

legetz commented 7 months ago

Skip notification providers if there was nothing to deploy (in delta mode)

legetz commented 7 months ago

Added another improvement to simplify/prettify JIRA error logging. Tested the change locally and here is output comparison.

Old output:

[sfdx-hardis] [JiraProvider] Try to post comments on 1 tickets...
[sfdx-hardis] [JiraProvider] Error while posting comment on ABC-826
This is a probably a config/rights errors as the response contain HTML
[sfdx-hardis] [JiraProvider] Error while adding label DEV_DEPLOYED on ABC-826
"<!doctype html><html lang=\"en\"><head><title>HTTP Status 405 – Method Not Allowed</title><style type=\"text/css\">body {font-family:Tahoma,Arial,sans-serif;} h1, h2, h3, b {color:white;background-color:#525D76;} h1 {font-size:22px;} h2 {font-size:16px;} h3 {font-size:14px;} p {font-size:12px;} a {color:black;} .line {height:1px;background-color:#525D76;border:none;}</style></head><body><h1>HTTP Status 405 – Method Not Allowed</h1><hr class=\"line\" /><p><b>Type</b> Status Report</p><p><b>Description</b> The method received in the request-line is known by the origin server but not supported by the target resource.</p><hr class=\"line\" /><h3>Apache Tomcat/9.0.80</h3></body></html>"
Error: "<!doctype html><html lang=\"en\"><head><title>HTTP Status 405 – Method Not Allowed</title><style type=\"text/css\">body {font-family:Tahoma,Arial,sans-serif;} h1, h2, h3, b {color:white;background-color:#525D76;} h1 {font-size:22px;} h2 {font-size:16px;} h3 {font-size:14px;} p {font-size:12px;} a {color:black;} .line {height:1px;background-color:#525D76;border:none;}</style></head><body><h1>HTTP Status 405 – Method Not Allowed</h1><hr class=\"line\" /><p><b>Type</b> Status Report</p><p><b>Description</b> The method received in the request-line is known by the origin server but not supported by the target resource.</p><hr class=\"line\" /><h3>Apache Tomcat/9.0.80</h3></body></html>"
    at JiraApi.doRequest (/root/.local/share/sf/node_modules/jira-client/lib/jira.js:347:13)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async JiraProvider.postDeploymentComments (/root/.local/share/sf/node_modules/sfdx-hardis/lib/common/ticketProvider/jiraProvider.js:171:21)
    at async TicketProvider.postDeploymentActions (/root/.local/share/sf/node_modules/sfdx-hardis/lib/common/ticketProvider/index.js:50:17)
    at async DxSources.run (/root/.local/share/sf/node_modules/sfdx-hardis/lib/commands/hardis/project/deploy/sources/dx.js:191:17)
    at async DxSources._run (/root/.local/share/sf/node_modules/sfdx-hardis/node_modules/@salesforce/command/lib/sfdxCommand.js:81:40)
    at async Config.runCommand (/usr/local/lib/node_modules/@salesforce/cli/node_modules/@oclif/core/lib/config/config.js:417:25)
    at async run (/usr/local/lib/node_modules/@salesforce/cli/node_modules/@oclif/core/lib/main.js:85:16)
[sfdx-hardis] [JiraProvider] Posted comments on 0 ticket(s): 
[sfdx-hardis] [JiraProvider] Added label DEV_DEPLOYED on 0 ticket(s): 

Simplified/new output:

[sfdx-hardis] [JiraProvider] Try to post comments on 1 tickets...
[sfdx-hardis] [JiraProvider] Error while posting comment on ABC-826: Probably config/access error since response is HTML
[sfdx-hardis] [JiraProvider] Error while adding label DEV_DEPLOYED on ABC-826: Probably config/access error since response is HTML
nvuillam commented 7 months ago

@legetz next time please think to also add entries in CHANGELOG.md :)