Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deployment assistant refactoring + Integration with AI :) #629

Merged
merged 20 commits into from
Jun 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@

Note: Can be used with `sfdx plugins:install sfdx-hardis@beta` and docker image `hardisgroupcom/sfdx-hardis@beta`

- **AI Deployment Assistant**: Integrate with OpenAI ChatGPT to find solutions to deployment issues
- Monitoring: Default 120mn timeout in Azure Workflow
- Backup: Replace colon in package file name

## [4.40.2] 2024-06-18

- hardis:org:diagnose:audittrail: Define new not suspect actions
Expand Down
25 changes: 8 additions & 17 deletions build.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,33 +10,23 @@ class SfdxHardisBuilder {
}

buildDeployTipsDoc() {
console.log("Building deployTips doc...");
const deployTipsDocFile = "./docs/deployTips.md";
console.log("Building salesforce-deployment-assistant-error-list.md doc...");
const deployTipsDocFile = "./docs/salesforce-deployment-assistant-error-list.md";
const deployTips = getAllTips();
const deployTipsMd = [
"---",
"title: How to solve Salesforce DX Deployment errors",
"description: Learn how to fix issues that can happen during sfdx deployments",
"title: Sfdx-hardis deployment assistant list of errors",
"description: List of errors that are handled by sfdx-hardis deployment assistant",
"---",
"<!-- markdownlint-disable MD013 -->",
"",
"# Salesforce deployment errors tips",
"# Salesforce deployment assistant errors list",
"",
"This page summarizes all errors that can be detected by sfdx-hardis wrapper commands",
"sfdx-hardis can help solve solve deployment errors using a predefined list of issues and associated solutions",
"",
"| sfdx command | sfdx-hardis wrapper command |",
"| :----------- | :-------------------------- |",
"| [sfdx force:source:deploy](https://developer.salesforce.com/docs/atlas.en-us.sfdx_cli_reference.meta/sfdx_cli_reference/cli_reference_force_source.htm#cli_reference_force_source_deploy) | [sfdx hardis:source:deploy](https://sfdx-hardis.cloudity.com/hardis/source/deploy/) |",
"| [sfdx force:source:push](https://developer.salesforce.com/docs/atlas.en-us.sfdx_cli_reference.meta/sfdx_cli_reference/cli_reference_force_source.htm#cli_reference_force_source_push) | [sfdx hardis:source:push](https://sfdx-hardis.cloudity.com/hardis/source/push/) |",
"| [sfdx force:mdapi:deploy](https://developer.salesforce.com/docs/atlas.en-us.sfdx_cli_reference.meta/sfdx_cli_reference/cli_reference_force_mdapi.htm#cli_reference_force_mdapi_beta_deploy) | [sfdx hardis:mdapi:deploy](https://sfdx-hardis.cloudity.com/hardis/mdapi/deploy/) |",
"",
"You can also use this function on a [sfdx-hardis Salesforce CI/CD project](https://sfdx-hardis.cloudity.com/salesforce-ci-cd-home/)",
"See how to [setup sfdx-hardis deployment assistant](salesforce-deployment-assistant-setup.md)",
"",
"If you see a deployment error which is not here yet, please [add it in this file](https://github.com/hardisgroupcom/sfdx-hardis/blob/main/src/common/utils/deployTipsList.ts) :)",
"",
"Example:",
"",
"![Deployment Tip example](https://github.com/hardisgroupcom/sfdx-hardis/raw/main/docs/assets/images/deploy-tip-example.jpg)",
""
];
for (const tip of deployTips) {
Expand All @@ -59,6 +49,7 @@ class SfdxHardisBuilder {
deployTipsMd.push(...tip.tip.split("\n"));
deployTipsMd.push("```");
deployTipsMd.push("");
deployTipsMd.push("---");
}
fs.writeFileSync(deployTipsDocFile, deployTipsMd.join("\n") + "\n");
console.log("Written doc file " + deployTipsDocFile);
Expand Down
2 changes: 2 additions & 0 deletions defaults/ci/.github/workflows/check-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ jobs:
JIRA_EMAIL: ${{ secrets.JIRA_EMAIL }}
JIRA_TOKEN: ${{ secrets.JIRA_TOKEN }}
JIRA_PAT: ${{ secrets.JIRA_HOST }}
JIRA_TICKET_REGEX: ${{ secrets.JIRA_TICKET_REGEX }}
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
FORCE_COLOR: "1"
run: |
echo "Simulate SFDX deployment using Hardis against \"$CONFIG_BRANCH\""
Expand Down
1 change: 1 addition & 0 deletions defaults/ci/azure-pipelines-checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ jobs:
JIRA_TOKEN: $(JIRA_TOKEN)
JIRA_PAT: $(JIRA_HOST)
JIRA_TICKET_REGEX: $(JIRA_TICKET_REGEX)
OPENAI_API_KEY: $(OPENAI_API_KEY)
SYSTEM_ACCESSTOKEN: $(System.AccessToken)
CI_SFDX_HARDIS_AZURE_TOKEN: $(System.AccessToken)
SYSTEM_COLLECTIONURI: $(System.CollectionUri)
Expand Down
1 change: 1 addition & 0 deletions defaults/monitoring/azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ jobs:
dependsOn: BackupSfdxHardis
pool:
vmImage: 'ubuntu-latest'
timeoutInMinutes: "120"

steps:
- checkout: self
Expand Down
14 changes: 14 additions & 0 deletions defaults/monitoring/manifest/package-skip-items.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!-- All items matching this file will not be retrieved during the sfdx-hardis backup step -->
<Package xmlns="http://soap.sforce.com/2006/04/metadata">

<!-- Auth provider can contain tokens -->
<types>
<members>*</members>
<name>AuthProvider</name>
</types>

<!-- Certificates are sensitive data -->
<types>
<members>*</members>
<name>Certificate</name>
Expand Down Expand Up @@ -80,6 +88,12 @@
</types>
-->

<!-- SSO Config contain certificates -->
<types>
<members>*</members>
<name>SamlSsoConfig</name>
</types>

<!-- Uncomment if you have too many metadatas
<types>
<members>*</members>
Expand Down
Binary file added docs/assets/images/AI-Assistant.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/assets/images/integrations.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
17 changes: 17 additions & 0 deletions docs/salesforce-ai-setup.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
title: Sfdx-hardis AI assistant setup
description: Learn how to use AI to supercharge sfdx-hardis deployments
---
<!-- markdownlint-disable MD013 -->

# Setup AI for sfdx-hardis

You need to define at least env variable OPENAI_API_KEY and make it available to your CI/CD workflow.

To get an OpenAi API key, [create an OpenAi Platform account](https://platform.openai.com/).

| Variable | Description | Default |
|------------------------|-------------------------------------------------------------------------------------------|----------|
| OPENAI_API_KEY | Your openai account API key | |
| OPENAI_MODEL | OpenAi model used to perform prompts (see [models list](https://openai.com/api/pricing/)) | `gpt-4o` |
| AI_MAXIMUM_CALL_NUMBER | Maximum allowed number of calls to OpenAi API during a single sfdx-hardis command | `10` |
Loading
Loading