sfdx-hardis 8.22.0 → 8.23.0

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.
Files changed (78) hide show
  1. package/defaults/ci/.github/workflows/check-deploy.yml +6 -0
  2. package/defaults/ci/.github/workflows/check-major-branch-deploy.yml +116 -0
  3. package/defaults/ci/.github/workflows/megalinter.yml +6 -0
  4. package/defaults/ci/.github/workflows/process-deploy.yml +6 -0
  5. package/defaults/ci/.github/workflows/scratch-pool-refresh.yml +6 -0
  6. package/defaults/ci/.gitlab-ci-config.yml +7 -0
  7. package/defaults/ci/.gitlab-ci.yml +13 -3
  8. package/defaults/ci/Jenkinsfile +53 -0
  9. package/defaults/ci/azure-pipelines-checks.yml +6 -0
  10. package/defaults/ci/azure-pipelines-deployment.yml +6 -0
  11. package/defaults/ci/azure-pipelines-major-branch-check.yml +80 -0
  12. package/defaults/ci/azure-pipelines-scratch-pool.yml +6 -0
  13. package/defaults/ci/bitbucket-pipelines.yml +31 -0
  14. package/defaults/lintonly/.gitlab-ci.yml +6 -0
  15. package/defaults/mkdocs/.github/workflows/build-deploy-docs.yml +6 -0
  16. package/defaults/monitoring/.github/workflows/org-monitoring.yml +6 -0
  17. package/defaults/monitoring/.gitlab-ci.yml +6 -0
  18. package/defaults/monitoring/Jenkinsfile +6 -0
  19. package/defaults/monitoring/azure-pipelines.yml +6 -0
  20. package/defaults/monitoring/bitbucket-pipelines.yml +6 -0
  21. package/defaults/templates/monitoring/AGENTS.md +2 -1
  22. package/lib/commands/hardis/doc/project2markdown.js +2 -4
  23. package/lib/commands/hardis/doc/project2markdown.js.map +1 -1
  24. package/lib/commands/hardis/org/monitor/backup.js +2 -4
  25. package/lib/commands/hardis/org/monitor/backup.js.map +1 -1
  26. package/lib/commands/hardis/project/deploy/smart.js +37 -1
  27. package/lib/commands/hardis/project/deploy/smart.js.map +1 -1
  28. package/lib/commands/hardis/project/promotion/create.js +22 -5
  29. package/lib/commands/hardis/project/promotion/create.js.map +1 -1
  30. package/lib/common/gitProvider/index.js +13 -0
  31. package/lib/common/gitProvider/index.js.map +1 -1
  32. package/lib/common/monitoring/monitoringTemplateLinks.d.ts +10 -0
  33. package/lib/common/monitoring/monitoringTemplateLinks.js +14 -0
  34. package/lib/common/monitoring/monitoringTemplateLinks.js.map +1 -0
  35. package/lib/common/replacementRules/builtInRemovalRule.d.ts +6 -1
  36. package/lib/common/replacementRules/builtInRemovalRule.js +25 -7
  37. package/lib/common/replacementRules/builtInRemovalRule.js.map +1 -1
  38. package/lib/common/replacementRules/engine/replacementReport.js +15 -0
  39. package/lib/common/replacementRules/engine/replacementReport.js.map +1 -1
  40. package/lib/common/replacementRules/engine/ruleEngine.js +2 -1
  41. package/lib/common/replacementRules/engine/ruleEngine.js.map +1 -1
  42. package/lib/common/replacementRules/flowEndsBuiltInRule.d.ts +5 -2
  43. package/lib/common/replacementRules/flowEndsBuiltInRule.js +7 -3
  44. package/lib/common/replacementRules/flowEndsBuiltInRule.js.map +1 -1
  45. package/lib/common/replacementRules/unknownUserPermissionsBuiltInRule.js +2 -2
  46. package/lib/common/replacementRules/unknownUserPermissionsBuiltInRule.js.map +1 -1
  47. package/lib/common/replacementRules/utils/changeNames.d.ts +5 -0
  48. package/lib/common/replacementRules/utils/changeNames.js +19 -0
  49. package/lib/common/replacementRules/utils/changeNames.js.map +1 -0
  50. package/lib/common/replacementRules/utils/xmlPath.d.ts +8 -0
  51. package/lib/common/replacementRules/utils/xmlPath.js +59 -0
  52. package/lib/common/replacementRules/utils/xmlPath.js.map +1 -1
  53. package/lib/common/replacementRules/xmlRemoveReplacementRule.js +10 -2
  54. package/lib/common/replacementRules/xmlRemoveReplacementRule.js.map +1 -1
  55. package/lib/common/replacementRules/xmlValueReplacementRule.js +9 -1
  56. package/lib/common/replacementRules/xmlValueReplacementRule.js.map +1 -1
  57. package/lib/common/utils/majorBranchCheckUtils.d.ts +13 -0
  58. package/lib/common/utils/majorBranchCheckUtils.js +31 -0
  59. package/lib/common/utils/majorBranchCheckUtils.js.map +1 -0
  60. package/lib/common/utils/prePostCommandUtils.js +6 -0
  61. package/lib/common/utils/prePostCommandUtils.js.map +1 -1
  62. package/lib/common/utils/promotionCreateUtils.d.ts +14 -2
  63. package/lib/common/utils/promotionCreateUtils.js +447 -63
  64. package/lib/common/utils/promotionCreateUtils.js.map +1 -1
  65. package/lib/common/utils/pullRequestUtils.js +7 -0
  66. package/lib/common/utils/pullRequestUtils.js.map +1 -1
  67. package/lib/i18n/de.json +24 -0
  68. package/lib/i18n/en.json +24 -0
  69. package/lib/i18n/es.json +24 -0
  70. package/lib/i18n/fr.json +24 -0
  71. package/lib/i18n/it.json +24 -0
  72. package/lib/i18n/ja.json +24 -0
  73. package/lib/i18n/nl.json +24 -0
  74. package/lib/i18n/pl.json +24 -0
  75. package/lib/i18n/pt-BR.json +24 -0
  76. package/oclif.lock +76 -51
  77. package/oclif.manifest.json +9022 -9014
  78. package/package.json +8 -8
@@ -1,4 +1,10 @@
1
1
  ---
2
+ # Source of this file: the sfdx-hardis default template
3
+ # https://github.com/hardisgroupcom/sfdx-hardis/blob/main/defaults/ci/.github/workflows/check-deploy.yml
4
+ # raw: https://raw.githubusercontent.com/hardisgroupcom/sfdx-hardis/main/defaults/ci/.github/workflows/check-deploy.yml
5
+ # To upgrade it, compare it with the latest version of that template and bring in its changes,
6
+ # keeping what is specific to this project (branch names, secrets, runner tags, image, custom jobs).
7
+ # What changed between versions: https://github.com/hardisgroupcom/sfdx-hardis/blob/main/CHANGELOG.md
2
8
  # Manual updates in in job step "Login & Process Deployment" below:
3
9
  # - variables for additional branches: add SFDX_CLIENT_ID / KEY variables
4
10
  # - To use slack notifications, you can also define SLACK_TOKEN and SLACK_CHANNEL_ID
@@ -0,0 +1,116 @@
1
+ ---
2
+ # Source of this file: the sfdx-hardis default template
3
+ # https://github.com/hardisgroupcom/sfdx-hardis/blob/main/defaults/ci/.github/workflows/check-major-branch-deploy.yml
4
+ # raw: https://raw.githubusercontent.com/hardisgroupcom/sfdx-hardis/main/defaults/ci/.github/workflows/check-major-branch-deploy.yml
5
+ # To upgrade it, compare it with the latest version of that template and bring in its changes,
6
+ # keeping what is specific to this project (branch names, secrets, runner tags, image, custom jobs).
7
+ # What changed between versions: https://github.com/hardisgroupcom/sfdx-hardis/blob/main/CHANGELOG.md
8
+ # Major branch deployment check: every night, simulates the full deployment of each major branch to
9
+ # its own org, to know whether an org drifted from its branch (manual changes, refresh, failed
10
+ # deployment). Nothing is deployed, no Pull Request is commented, no deployment action runs.
11
+ #
12
+ # - The major branches are read from config/branches/.sfdx-hardis.*.yml of the default branch:
13
+ # no branch list to maintain here
14
+ # - GitHub runs scheduled workflows from the default branch only: this file must be on it
15
+ # - Manual updates in job step "Login & Check major branch deployment" below: add the
16
+ # SFDX_CLIENT_ID / KEY variables of your major branches, like in check-deploy.yml
17
+ # - Define enableMajorBranchDeploymentCheck: true in config/.sfdx-hardis.yml to see the result of
18
+ # each branch in the VS Code DevOps Pipeline
19
+ # More info at https://sfdx-hardis.cloudity.com/salesforce-devops-setup-major-branch-check/
20
+
21
+ on:
22
+ schedule:
23
+ - cron: "0 1 * * *" # Every night at 1am UTC
24
+ workflow_dispatch:
25
+
26
+ name: Check Major Branch Deployment (sfdx-hardis)
27
+ permissions: read-all
28
+
29
+ concurrency:
30
+ group: ${{ github.workflow }}
31
+ cancel-in-progress: false
32
+
33
+ jobs:
34
+ list_major_branches:
35
+ runs-on: ubuntu-latest
36
+ name: List major branches
37
+ permissions:
38
+ contents: read
39
+ outputs:
40
+ branches: ${{ steps.list.outputs.branches }}
41
+ steps:
42
+ - name: Checkout code
43
+ uses: actions/checkout@v6
44
+ # A branch config file is named after its branch, with / replaced by __ (release/uat -> release__uat)
45
+ - name: List major branches from config/branches
46
+ id: list
47
+ run: |
48
+ branches="[]"
49
+ for file in config/branches/.sfdx-hardis.*.yml; do
50
+ [ -f "$file" ] || continue
51
+ name="$(basename "$file")"
52
+ name="${name#.sfdx-hardis.}"
53
+ name="${name%.yml}"
54
+ branch="${name//__//}"
55
+ branches=$(echo "$branches" | jq -c --arg b "$branch" '. + [$b]')
56
+ done
57
+ echo "Major branches: $branches"
58
+ echo "branches=$branches" >> "$GITHUB_OUTPUT"
59
+
60
+ check_major_branch:
61
+ needs: list_major_branches
62
+ if: ${{ needs.list_major_branches.outputs.branches != '[]' }}
63
+ strategy:
64
+ fail-fast: false # One org that cannot be deployed must not hide the result of the others
65
+ matrix:
66
+ branch: ${{ fromJSON(needs.list_major_branches.outputs.branches) }}
67
+ runs-on: ubuntu-latest
68
+ # Job timeout, in minutes: define the repository variable CI_JOB_TIMEOUT_MINUTES to change it.
69
+ timeout-minutes: ${{ fromJSON(vars.CI_JOB_TIMEOUT_MINUTES || '150') }}
70
+ # Job runs in sfdx-hardis docker image, that includes Salesforce CLI and all required plugins & dependencies.
71
+ # Images are also mirrored on Docker Hub: hardisgroupcom/sfdx-hardis-ubuntu:latest
72
+ container: ghcr.io/hardisgroupcom/sfdx-hardis-ubuntu:latest
73
+ # The VS Code DevOps Pipeline finds the check of a branch by this name: keep "Major Branch" and the branch in it
74
+ name: Check Major Branch Deployment (${{ matrix.branch }})
75
+ permissions:
76
+ contents: read
77
+ steps:
78
+ - name: Checkout code
79
+ uses: actions/checkout@v6
80
+ with:
81
+ ref: ${{ matrix.branch }}
82
+ fetch-depth: 0
83
+ - name: Login & Check major branch deployment
84
+ env:
85
+ SFDX_CLIENT_ID_INTEGRATION: ${{ secrets.SFDX_CLIENT_ID_INTEGRATION}}
86
+ SFDX_CLIENT_KEY_INTEGRATION: ${{ secrets.SFDX_CLIENT_KEY_INTEGRATION}}
87
+ SFDX_CLIENT_ID_UAT: ${{ secrets.SFDX_CLIENT_ID_UAT}}
88
+ SFDX_CLIENT_KEY_UAT: ${{ secrets.SFDX_CLIENT_KEY_UAT}}
89
+ SFDX_CLIENT_ID_PREPROD: ${{ secrets.SFDX_CLIENT_ID_PREPROD}}
90
+ SFDX_CLIENT_KEY_PREPROD: ${{ secrets.SFDX_CLIENT_KEY_PREPROD}}
91
+ SFDX_CLIENT_ID_MAIN: ${{ secrets.SFDX_CLIENT_ID_MAIN}}
92
+ SFDX_CLIENT_KEY_MAIN: ${{ secrets.SFDX_CLIENT_KEY_MAIN}}
93
+ # Secrets read by replacementRules (secret: NAME): NAME_<BRANCH> is read first, then NAME
94
+ # PAYMENT_API_PASSWORD_UAT: ${{ secrets.PAYMENT_API_PASSWORD_UAT }}
95
+ SFDX_AUTH_URL_TECHNICAL_ORG: ${{ secrets.SFDX_AUTH_URL_TECHNICAL_ORG }}
96
+ SFDX_DEPLOY_WAIT_MINUTES: ${{ vars.SFDX_DEPLOY_WAIT_MINUTES || '120' }}
97
+ SFDX_TEST_WAIT_MINUTES: ${{ vars.SFDX_TEST_WAIT_MINUTES || '120' }}
98
+ CI_COMMIT_REF_NAME: ${{ matrix.branch }} # The checked major branch
99
+ ORG_ALIAS: ${{ matrix.branch }}
100
+ CONFIG_BRANCH: ${{ matrix.branch }}
101
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
102
+ FORCE_COLOR: "1"
103
+ run: |
104
+ echo "Check deployment of major branch \"$CI_COMMIT_REF_NAME\" to its org"
105
+ # The job runs in a container, where git runs as another user than the owner of the checkout
106
+ git config --global --add safe.directory "$GITHUB_WORKSPACE"
107
+ sf hardis:auth:login
108
+ sf hardis:project:deploy:smart --check --major-branch-check
109
+
110
+ # Upload sfdx-hardis reports, including the complete deployment result JSON
111
+ - name: Archive sfdx-hardis reports
112
+ if: always() # Also when the job was stopped by the timeout
113
+ uses: actions/upload-artifact@v4
114
+ with:
115
+ name: sfdx-hardis reports ${{ strategy.job-index }}
116
+ path: hardis-report
@@ -1,4 +1,10 @@
1
1
  ---
2
+ # Source of this file: the sfdx-hardis default template
3
+ # https://github.com/hardisgroupcom/sfdx-hardis/blob/main/defaults/ci/.github/workflows/megalinter.yml
4
+ # raw: https://raw.githubusercontent.com/hardisgroupcom/sfdx-hardis/main/defaults/ci/.github/workflows/megalinter.yml
5
+ # To upgrade it, compare it with the latest version of that template and bring in its changes,
6
+ # keeping what is specific to this project (branch names, secrets, runner tags, image, custom jobs).
7
+ # What changed between versions: https://github.com/hardisgroupcom/sfdx-hardis/blob/main/CHANGELOG.md
2
8
  # Mega-Linter GitHub Action configuration file
3
9
  # More info at https://megalinter.io
4
10
  name: Mega-Linter
@@ -1,4 +1,10 @@
1
1
  ---
2
+ # Source of this file: the sfdx-hardis default template
3
+ # https://github.com/hardisgroupcom/sfdx-hardis/blob/main/defaults/ci/.github/workflows/process-deploy.yml
4
+ # raw: https://raw.githubusercontent.com/hardisgroupcom/sfdx-hardis/main/defaults/ci/.github/workflows/process-deploy.yml
5
+ # To upgrade it, compare it with the latest version of that template and bring in its changes,
6
+ # keeping what is specific to this project (branch names, secrets, runner tags, image, custom jobs).
7
+ # What changed between versions: https://github.com/hardisgroupcom/sfdx-hardis/blob/main/CHANGELOG.md
2
8
  # Manual updates in in job step "Login & Process Deployment" below:
3
9
  # - variables for additional branches: add SFDX_CLIENT_ID / KEY variables
4
10
  # - To use slack notifications, you can also define SLACK_TOKEN and SLACK_CHANNEL_ID
@@ -1,4 +1,10 @@
1
1
  ---
2
+ # Source of this file: the sfdx-hardis default template
3
+ # https://github.com/hardisgroupcom/sfdx-hardis/blob/main/defaults/ci/.github/workflows/scratch-pool-refresh.yml
4
+ # raw: https://raw.githubusercontent.com/hardisgroupcom/sfdx-hardis/main/defaults/ci/.github/workflows/scratch-pool-refresh.yml
5
+ # To upgrade it, compare it with the latest version of that template and bring in its changes,
6
+ # keeping what is specific to this project (branch names, secrets, runner tags, image, custom jobs).
7
+ # What changed between versions: https://github.com/hardisgroupcom/sfdx-hardis/blob/main/CHANGELOG.md
2
8
  # Scratch org pool refresh: deletes the scratch orgs about to expire and creates new ones, so jobs
3
9
  # and developers get a scratch org in seconds.
4
10
  #
@@ -1,3 +1,10 @@
1
+ # Source of this file: the sfdx-hardis default template
2
+ # https://github.com/hardisgroupcom/sfdx-hardis/blob/main/defaults/ci/.gitlab-ci-config.yml
3
+ # raw: https://raw.githubusercontent.com/hardisgroupcom/sfdx-hardis/main/defaults/ci/.gitlab-ci-config.yml
4
+ # To upgrade it, compare it with the latest version of that template and bring in its changes,
5
+ # keeping what is specific to this project (branch names, secrets, runner tags, image, custom jobs).
6
+ # This file holds the values of this project: bring in new keys only, never replace existing values.
7
+ # What changed between versions: https://github.com/hardisgroupcom/sfdx-hardis/blob/main/CHANGELOG.md
1
8
  # You can customize your pipeline process here
2
9
  variables:
3
10
  DEPLOY_BRANCHES: /^(development|integration|recette|preprod|main|master)$/ # Regex contenant la liste des branches où un push va déclencher un déploiement
@@ -1,4 +1,10 @@
1
1
  ---
2
+ # Source of this file: the sfdx-hardis default template
3
+ # https://github.com/hardisgroupcom/sfdx-hardis/blob/main/defaults/ci/.gitlab-ci.yml
4
+ # raw: https://raw.githubusercontent.com/hardisgroupcom/sfdx-hardis/main/defaults/ci/.gitlab-ci.yml
5
+ # To upgrade it, compare it with the latest version of that template and bring in its changes,
6
+ # keeping what is specific to this project (branch names, secrets, runner tags, image, custom jobs).
7
+ # What changed between versions: https://github.com/hardisgroupcom/sfdx-hardis/blob/main/CHANGELOG.md
2
8
  ##################################################################
3
9
  # Test and deployment pipeline for a Salesforce CI/CD Project #
4
10
  # Update it only if you know what you are doing :) #
@@ -252,8 +258,12 @@ clean:
252
258
  - sf hardis:auth:login --scratchorg || true
253
259
  - sf org delete scratch --no-prompt || true
254
260
 
255
- # Simulate deployment to related org
256
- # Is triggered only when scheduled, or via manual launch
261
+ # Major branch deployment check: simulates the full deployment of a major branch to its own org,
262
+ # to know whether the org drifted from its branch. Nothing is deployed, no Merge Request is commented.
263
+ # Is triggered only when scheduled, or via manual launch:
264
+ # create one schedule per major branch in CI/CD > Schedules (ex: every night at 1am)
265
+ # Define enableMajorBranchDeploymentCheck: true in config/.sfdx-hardis.yml to see the result in VS Code DevOps Pipeline
266
+ # More info at https://sfdx-hardis.cloudity.com/salesforce-devops-setup-major-branch-check/
257
267
  check_deploy_to_current_branch_org:
258
268
  stage: check_deploy
259
269
  timeout: 150 minutes # Raise it if the job is killed before the deployment ends
@@ -285,7 +295,7 @@ check_deploy_to_current_branch_org:
285
295
  # echo "[sfdx-hardis] GitLab push/MR auth enabled for coding agents"
286
296
  # fi
287
297
  - sf hardis:auth:login
288
- - sf hardis:project:deploy:smart --check
298
+ - sf hardis:project:deploy:smart --check --major-branch-check
289
299
  artifacts:
290
300
  when: always
291
301
  paths:
@@ -1,3 +1,9 @@
1
+ // Source of this file: the sfdx-hardis default template
2
+ // https://github.com/hardisgroupcom/sfdx-hardis/blob/main/defaults/ci/Jenkinsfile
3
+ // raw: https://raw.githubusercontent.com/hardisgroupcom/sfdx-hardis/main/defaults/ci/Jenkinsfile
4
+ // To upgrade it, compare it with the latest version of that template and bring in its changes,
5
+ // keeping what is specific to this project (branch names, secrets, runner tags, image, custom jobs).
6
+ // What changed between versions: https://github.com/hardisgroupcom/sfdx-hardis/blob/main/CHANGELOG.md
1
7
  // Pipeline for Salesforce CI/CD using sfdx-hardis
2
8
  //
3
9
  // SETUP (do a CTRL+F on "MANUAL"):
@@ -269,6 +275,51 @@ pipeline {
269
275
  }
270
276
  }
271
277
 
278
+ ///////////////////////////////////////////////////////////////////////////////////
279
+ // Major branch deployment check: simulates the full deployment of a major //
280
+ // branch to its own org, to know whether the org drifted from its branch. //
281
+ // Nothing is deployed, no Pull Request is commented. Runs only when //
282
+ // MAJOR_BRANCH_DEPLOYMENT_CHECK is "true": create a dedicated Jenkins job on //
283
+ // this Jenkinsfile, scheduled every night on each major branch, that sets this //
284
+ // environment variable. The VS Code DevOps Pipeline finds the check by the //
285
+ // name of the commit status it posts, which must contain "major branch check" //
286
+ // (ex: major-branch-check). A multibranch job posts a generic status name //
287
+ // (continuous-integration/jenkins/branch) whatever the job is called: set a //
288
+ // custom status name in the job (ex: GitHub Branch Source, trait "Custom //
289
+ // GitHub Notification Context"), or the check result replaces the deployment //
290
+ // status of the commit. More info at //
291
+ // https://sfdx-hardis.cloudity.com/salesforce-devops-setup-major-branch-check/ //
292
+ ///////////////////////////////////////////////////////////////////////////////////
293
+ stage('Check Major Branch Deployment') {
294
+ when {
295
+ allOf {
296
+ environment name: 'MAJOR_BRANCH_DEPLOYMENT_CHECK', value: 'true'
297
+ expression { DEPLOYMENT_BRANCHES.contains(env.BRANCH_NAME_CLEAN) }
298
+ not { changeRequest() }
299
+ }
300
+ }
301
+ steps {
302
+ withCredentials([
303
+ // ----------------------------------------------------------------
304
+ // MANUAL: Add one pair of credentials per deployment org.
305
+ // Same credential pairs as in the Deployment stage below.
306
+ //
307
+ // string(credentialsId: 'SFDX_CLIENT_ID_INTEGRATION', variable: 'SFDX_CLIENT_ID_INTEGRATION'),
308
+ // string(credentialsId: 'SFDX_CLIENT_KEY_INTEGRATION', variable: 'SFDX_CLIENT_KEY_INTEGRATION'),
309
+ // ----------------------------------------------------------------
310
+ string(credentialsId: 'SFDX_AUTH_URL_TECHNICAL_ORG', variable: 'SFDX_AUTH_URL_TECHNICAL_ORG', optional: true),
311
+ ]) {
312
+ sh 'sf hardis:auth:login'
313
+ sh 'sf hardis:project:deploy:smart --check --major-branch-check'
314
+ }
315
+ }
316
+ post {
317
+ always {
318
+ archiveArtifacts allowEmptyArchive: true, artifacts: 'hardis-report/**', defaultExcludes: false, followSymlinks: false
319
+ }
320
+ }
321
+ }
322
+
272
323
  /////////////////////////////////////////////////////////////////////////////////
273
324
  // Deploy to the target org when a commit lands on a deployment branch //
274
325
  /////////////////////////////////////////////////////////////////////////////////
@@ -279,6 +330,8 @@ pipeline {
279
330
  not { changeRequest() }
280
331
  // The job that refreshes the scratch org pool does not deploy
281
332
  not { environment name: 'SCRATCH_ORG_POOL', value: 'true' }
333
+ // The job that checks a major branch against its org does not deploy
334
+ not { environment name: 'MAJOR_BRANCH_DEPLOYMENT_CHECK', value: 'true' }
282
335
  }
283
336
  }
284
337
  steps {
@@ -1,3 +1,9 @@
1
+ # Source of this file: the sfdx-hardis default template
2
+ # https://github.com/hardisgroupcom/sfdx-hardis/blob/main/defaults/ci/azure-pipelines-checks.yml
3
+ # raw: https://raw.githubusercontent.com/hardisgroupcom/sfdx-hardis/main/defaults/ci/azure-pipelines-checks.yml
4
+ # To upgrade it, compare it with the latest version of that template and bring in its changes,
5
+ # keeping what is specific to this project (branch names, secrets, runner tags, image, custom jobs).
6
+ # What changed between versions: https://github.com/hardisgroupcom/sfdx-hardis/blob/main/CHANGELOG.md
1
7
  # Pipeline for Salesforce deployment check & MegaLinter check
2
8
  #
3
9
  # This pipeline is triggered when a commit is added to a Pull Request
@@ -1,3 +1,9 @@
1
+ # Source of this file: the sfdx-hardis default template
2
+ # https://github.com/hardisgroupcom/sfdx-hardis/blob/main/defaults/ci/azure-pipelines-deployment.yml
3
+ # raw: https://raw.githubusercontent.com/hardisgroupcom/sfdx-hardis/main/defaults/ci/azure-pipelines-deployment.yml
4
+ # To upgrade it, compare it with the latest version of that template and bring in its changes,
5
+ # keeping what is specific to this project (branch names, secrets, runner tags, image, custom jobs).
6
+ # What changed between versions: https://github.com/hardisgroupcom/sfdx-hardis/blob/main/CHANGELOG.md
1
7
  # Pipeline for Salesforce deployment check & MegaLinter check
2
8
  #
3
9
  # This pipeline is triggered when a commit is added to a Pull Request
@@ -0,0 +1,80 @@
1
+ # Source of this file: the sfdx-hardis default template
2
+ # https://github.com/hardisgroupcom/sfdx-hardis/blob/main/defaults/ci/azure-pipelines-major-branch-check.yml
3
+ # raw: https://raw.githubusercontent.com/hardisgroupcom/sfdx-hardis/main/defaults/ci/azure-pipelines-major-branch-check.yml
4
+ # To upgrade it, compare it with the latest version of that template and bring in its changes,
5
+ # keeping what is specific to this project (branch names, secrets, runner tags, image, custom jobs).
6
+ # What changed between versions: https://github.com/hardisgroupcom/sfdx-hardis/blob/main/CHANGELOG.md
7
+ # Pipeline for Salesforce major branch deployment check
8
+ #
9
+ # Simulates the full deployment of a major branch to its own org, to know whether the org drifted from
10
+ # its branch (manual changes, refresh, failed deployment). Nothing is deployed, no Pull Request is
11
+ # commented, no deployment action runs.
12
+ #
13
+ # Setup:
14
+ # - Go to Pipelines
15
+ # - Create a new pipeline from this file (Create new -> Existing Azure Pipelines YAML file)
16
+ # - Rename it "Check Major Branch Deployment": the VS Code DevOps Pipeline finds the check by this name
17
+ # - Add the variables of your major branches (SFDX_CLIENT_ID_<BRANCH>, SFDX_CLIENT_KEY_<BRANCH>), like in the deployment pipeline
18
+ # - Edit the pipeline, open the menu ⋮ and select Triggers
19
+ # - In "Scheduled", add a schedule (ex: every night at 1am) and "Include" all your major branches,
20
+ # as in the branch filter of the deployment pipeline
21
+ # - Define enableMajorBranchDeploymentCheck: true in config/.sfdx-hardis.yml to see the result of each
22
+ # branch in the VS Code DevOps Pipeline
23
+ #
24
+ # More info at https://sfdx-hardis.cloudity.com/salesforce-devops-setup-major-branch-check/
25
+
26
+ name: Check Major Branch Deployment
27
+
28
+ # Only started by its schedule (defined in the pipeline Triggers) or by hand
29
+ trigger: none
30
+ pr: none
31
+
32
+ # Mandatory variables, used by jobs
33
+ variables:
34
+ - name: FORCE_COLOR
35
+ value: "1"
36
+ - name: BRANCH_NAME
37
+ value: $[replace(variables['Build.SourceBranch'], 'refs/heads/', '')]
38
+
39
+ jobs:
40
+ - job: MajorBranchDeploymentCheck
41
+ displayName: Check Major Branch Deployment
42
+ timeoutInMinutes: 150
43
+ pool:
44
+ vmImage: ubuntu-latest
45
+ # Job runs in sfdx-hardis docker image, that includes Salesforce CLI and all required plugins & dependencies.
46
+ # Images are also mirrored on Docker Hub: hardisgroupcom/sfdx-hardis-ubuntu:latest
47
+ container: ghcr.io/hardisgroupcom/sfdx-hardis-ubuntu:latest
48
+ steps:
49
+ - checkout: self
50
+ fetchDepth: 0
51
+ displayName: Git Checkout
52
+
53
+ - script: |
54
+ echo "Check deployment of major branch \"${BRANCH_NAME}\" to its org"
55
+ sf hardis:auth:login
56
+ sf hardis:project:deploy:smart --check --major-branch-check
57
+ env:
58
+ SFDX_CLIENT_ID_INTEGRATION: $(SFDX_CLIENT_ID_INTEGRATION)
59
+ SFDX_CLIENT_KEY_INTEGRATION: $(SFDX_CLIENT_KEY_INTEGRATION)
60
+ CI_COMMIT_REF_NAME: $(BRANCH_NAME)
61
+ CONFIG_BRANCH: $(BRANCH_NAME)
62
+ ORG_ALIAS: $(BRANCH_NAME)
63
+ SFDX_DEPLOY_WAIT_MINUTES: $(SFDX_DEPLOY_WAIT_MINUTES)
64
+ SFDX_AUTH_URL_TECHNICAL_ORG: $(SFDX_AUTH_URL_TECHNICAL_ORG)
65
+ CI: "true"
66
+ SYSTEM_ACCESSTOKEN: $(System.AccessToken)
67
+ CI_SFDX_HARDIS_AZURE_TOKEN: $(System.AccessToken)
68
+ SYSTEM_COLLECTIONURI: $(System.CollectionUri)
69
+ SYSTEM_TEAMPROJECT: $(System.TeamProject)
70
+ BUILD_REPOSITORY_ID: $(Build.Repository.ID)
71
+ BUILD_REPOSITORYNAME: $(Build.Repository.Name)
72
+ BUILD_SOURCEBRANCHNAME: $(Build.SourceBranchName)
73
+ BUILD_BUILD_ID: $(Build.BuildId)
74
+ displayName: "Check major branch deployment to its SF Org"
75
+ # Publish sfdx-hardis reports, including the complete deployment result JSON
76
+ - publish: $(System.DefaultWorkingDirectory)/hardis-report/
77
+ condition: succeededOrFailed()
78
+ continueOnError: true
79
+ artifact: hardis-report
80
+ displayName: Publish sfdx-hardis reports
@@ -1,3 +1,9 @@
1
+ # Source of this file: the sfdx-hardis default template
2
+ # https://github.com/hardisgroupcom/sfdx-hardis/blob/main/defaults/ci/azure-pipelines-scratch-pool.yml
3
+ # raw: https://raw.githubusercontent.com/hardisgroupcom/sfdx-hardis/main/defaults/ci/azure-pipelines-scratch-pool.yml
4
+ # To upgrade it, compare it with the latest version of that template and bring in its changes,
5
+ # keeping what is specific to this project (branch names, secrets, runner tags, image, custom jobs).
6
+ # What changed between versions: https://github.com/hardisgroupcom/sfdx-hardis/blob/main/CHANGELOG.md
1
7
  # Pipeline for the scratch org pool refresh
2
8
  #
3
9
  # Deletes the scratch orgs about to expire and creates new ones, so jobs and developers get a
@@ -1,3 +1,9 @@
1
+ # Source of this file: the sfdx-hardis default template
2
+ # https://github.com/hardisgroupcom/sfdx-hardis/blob/main/defaults/ci/bitbucket-pipelines.yml
3
+ # raw: https://raw.githubusercontent.com/hardisgroupcom/sfdx-hardis/main/defaults/ci/bitbucket-pipelines.yml
4
+ # To upgrade it, compare it with the latest version of that template and bring in its changes,
5
+ # keeping what is specific to this project (branch names, secrets, runner tags, image, custom jobs).
6
+ # What changed between versions: https://github.com/hardisgroupcom/sfdx-hardis/blob/main/CHANGELOG.md
1
7
  # You might add new branch names in pipeline "branches"
2
8
 
3
9
  # Steps run in sfdx-hardis docker image, that includes Salesforce CLI and all required plugins & dependencies.
@@ -132,6 +138,31 @@ pipelines:
132
138
  artifacts:
133
139
  - hardis-report/**
134
140
 
141
+ # Major branch deployment check: simulates the full deployment of a major branch to its own org,
142
+ # to know whether the org drifted from its branch. Nothing is deployed, no Pull Request is commented.
143
+ # Schedule it every night on each major branch (Pipelines -> Schedules -> New schedule ->
144
+ # check-major-branch-deployment), and define enableMajorBranchDeploymentCheck: true in
145
+ # config/.sfdx-hardis.yml to see the result in the VS Code DevOps Pipeline.
146
+ # The DevOps Pipeline finds the check by the name of this custom pipeline: keep it.
147
+ # More info at https://sfdx-hardis.cloudity.com/salesforce-devops-setup-major-branch-check/
148
+ check-major-branch-deployment:
149
+ - step:
150
+ name: Check Major Branch Deployment
151
+ max-time: 120
152
+ clone:
153
+ depth: full
154
+ script:
155
+ - export BRANCH_NAME=$(echo "$BITBUCKET_BRANCH" | sed
156
+ 's/refs\/heads\///')
157
+ - export CI_COMMIT_REF_NAME=$BRANCH_NAME
158
+ - export CONFIG_BRANCH=$BRANCH_NAME
159
+ - export ORG_ALIAS=$BRANCH_NAME
160
+ - export FORCE_COLOR=1
161
+ - sf hardis:auth:login
162
+ - sf hardis:project:deploy:smart --check --major-branch-check
163
+ artifacts:
164
+ - hardis-report/**
165
+
135
166
  branches:
136
167
  # Add all your major branches here
137
168
  "{integration,uat,preprod,production,main}":
@@ -1,4 +1,10 @@
1
1
  ---
2
+ # Source of this file: the sfdx-hardis default template
3
+ # https://github.com/hardisgroupcom/sfdx-hardis/blob/main/defaults/lintonly/.gitlab-ci.yml
4
+ # raw: https://raw.githubusercontent.com/hardisgroupcom/sfdx-hardis/main/defaults/lintonly/.gitlab-ci.yml
5
+ # To upgrade it, compare it with the latest version of that template and bring in its changes,
6
+ # keeping what is specific to this project (branch names, secrets, runner tags, image, custom jobs).
7
+ # What changed between versions: https://github.com/hardisgroupcom/sfdx-hardis/blob/main/CHANGELOG.md
2
8
  # Pipeline pour tester la qualité du code Apex / Aura / LWC d'un repository
3
9
 
4
10
  # Liste ordonnée des étapes du pipeline
@@ -1,3 +1,9 @@
1
+ # Source of this file: the sfdx-hardis default template
2
+ # https://github.com/hardisgroupcom/sfdx-hardis/blob/main/defaults/mkdocs/.github/workflows/build-deploy-docs.yml
3
+ # raw: https://raw.githubusercontent.com/hardisgroupcom/sfdx-hardis/main/defaults/mkdocs/.github/workflows/build-deploy-docs.yml
4
+ # To upgrade it, compare it with the latest version of that template and bring in its changes,
5
+ # keeping what is specific to this project (branch names, secrets, runner tags, image, custom jobs).
6
+ # What changed between versions: https://github.com/hardisgroupcom/sfdx-hardis/blob/main/CHANGELOG.md
1
7
  name: "DOC - Build and deploy with sfdx-hardis"
2
8
  on:
3
9
  push:
@@ -1,3 +1,9 @@
1
+ # Source of this file: the sfdx-hardis default template
2
+ # https://github.com/hardisgroupcom/sfdx-hardis/blob/main/defaults/monitoring/.github/workflows/org-monitoring.yml
3
+ # raw: https://raw.githubusercontent.com/hardisgroupcom/sfdx-hardis/main/defaults/monitoring/.github/workflows/org-monitoring.yml
4
+ # To upgrade it, compare it with the latest version of that template and bring in its changes,
5
+ # keeping what is specific to this project (branch names, secrets, runner tags, image, custom jobs).
6
+ # What changed between versions: https://github.com/hardisgroupcom/sfdx-hardis/blob/main/CHANGELOG.md
1
7
  # Pipeline for Salesforce monitoring using sfdx-hardis
2
8
  #
3
9
  # WARNING: Scheduling can be run only on main branch on GitHub Actions, so there is a specific config.
@@ -1,3 +1,9 @@
1
+ # Source of this file: the sfdx-hardis default template
2
+ # https://github.com/hardisgroupcom/sfdx-hardis/blob/main/defaults/monitoring/.gitlab-ci.yml
3
+ # raw: https://raw.githubusercontent.com/hardisgroupcom/sfdx-hardis/main/defaults/monitoring/.gitlab-ci.yml
4
+ # To upgrade it, compare it with the latest version of that template and bring in its changes,
5
+ # keeping what is specific to this project (branch names, secrets, runner tags, image, custom jobs).
6
+ # What changed between versions: https://github.com/hardisgroupcom/sfdx-hardis/blob/main/CHANGELOG.md
1
7
  #######################################
2
8
  ### sfdx-hardis monitoring pipeline ###
3
9
  #######################################
@@ -1,3 +1,9 @@
1
+ // Source of this file: the sfdx-hardis default template
2
+ // https://github.com/hardisgroupcom/sfdx-hardis/blob/main/defaults/monitoring/Jenkinsfile
3
+ // raw: https://raw.githubusercontent.com/hardisgroupcom/sfdx-hardis/main/defaults/monitoring/Jenkinsfile
4
+ // To upgrade it, compare it with the latest version of that template and bring in its changes,
5
+ // keeping what is specific to this project (branch names, secrets, runner tags, image, custom jobs).
6
+ // What changed between versions: https://github.com/hardisgroupcom/sfdx-hardis/blob/main/CHANGELOG.md
1
7
  // Pipeline for Salesforce monitoring using sfdx-hardis
2
8
  //
3
9
  // SETUP (do a CTRL+F on "MANUAL"):
@@ -1,3 +1,9 @@
1
+ # Source of this file: the sfdx-hardis default template
2
+ # https://github.com/hardisgroupcom/sfdx-hardis/blob/main/defaults/monitoring/azure-pipelines.yml
3
+ # raw: https://raw.githubusercontent.com/hardisgroupcom/sfdx-hardis/main/defaults/monitoring/azure-pipelines.yml
4
+ # To upgrade it, compare it with the latest version of that template and bring in its changes,
5
+ # keeping what is specific to this project (branch names, secrets, runner tags, image, custom jobs).
6
+ # What changed between versions: https://github.com/hardisgroupcom/sfdx-hardis/blob/main/CHANGELOG.md
1
7
  # Pipeline for Salesforce monitoring using sfdx-hardis
2
8
  #
3
9
  # You need to (do a CTRL+F on "MANUAL")
@@ -1,3 +1,9 @@
1
+ # Source of this file: the sfdx-hardis default template
2
+ # https://github.com/hardisgroupcom/sfdx-hardis/blob/main/defaults/monitoring/bitbucket-pipelines.yml
3
+ # raw: https://raw.githubusercontent.com/hardisgroupcom/sfdx-hardis/main/defaults/monitoring/bitbucket-pipelines.yml
4
+ # To upgrade it, compare it with the latest version of that template and bring in its changes,
5
+ # keeping what is specific to this project (branch names, secrets, runner tags, image, custom jobs).
6
+ # What changed between versions: https://github.com/hardisgroupcom/sfdx-hardis/blob/main/CHANGELOG.md
1
7
  # You may:
2
8
  # - Update manifest/package-skip-items.xml to filter elements to retrieve
3
9
 
@@ -148,6 +148,7 @@ Read the configuration from the deployment branch itself (`git -C ../<name> show
148
148
  - While it is open, the pipeline runs `sf hardis:project:deploy:smart --check`: a validation (check-only deployment with the Apex tests) against the org of the target branch. On GitHub it is the `check-deploy.yml` workflow, on GitLab the check job of `.gitlab-ci.yml`, on Azure DevOps `azure-pipelines-checks.yml`.
149
149
  - Once merged, the pipeline runs `sf hardis:project:deploy:smart` on the target branch and deploys to its org (`process-deploy.yml` on GitHub, `azure-pipelines-deployment.yml` on Azure DevOps). It uses a Quick Deploy of the validation when it can.
150
150
  - sfdx-hardis comments the Pull Request with the result of the check, the deployment errors and their fix tips, the Flow visual differences and the deployment actions. Read those comments first: they explain a failure better than the raw logs.
151
+ - A project can also schedule a nightly major branch deployment check (`sf hardis:project:deploy:smart --check --major-branch-check`): a full check-only deployment of each major branch to its own org, with no Pull Request comment and no deployment action. A red check means the org drifted from its branch (a change made by hand, a refresh, a failed deployment). It is not a deployment: never count it as one. Its job is `check_deploy_to_current_branch_org` on GitLab, the `check-major-branch-deploy.yml` workflow on GitHub, `azure-pipelines-major-branch-check.yml` on Azure DevOps.
151
152
 
152
153
  #### What gets deployed
153
154
 
@@ -372,7 +373,7 @@ Any other command against an org counts as a write: do not run it, even when the
372
373
  | `mkdocs.yml` | Menu and settings of the documentation site built from `docs/`. |
373
374
  | `.sfdx-hardis.yml` | sfdx-hardis configuration of the branch: monitored org, notification settings, custom `monitoringCommands` and `monitoringDisable`, the `deploymentRepository` (and optional `deploymentBranch`) that deploys to the org, and the `grafanaUrl` (and optional datasource uids) that receives the monitoring results. Never a secret. |
374
375
  | `sfdx-project.json` | Salesforce DX project definition, including the API version used for the retrieve. |
375
- | `.gitlab-ci.yml`, `.github/workflows/`, `azure-pipelines.yml`, `bitbucket-pipelines.yml`, `Jenkinsfile` | The monitoring pipeline for each CI/CD platform. Only one of them is used. On GitHub, the workflow lives on the default branch and runs all monitoring branches. |
376
+ | `.gitlab-ci.yml`, `.github/workflows/`, `azure-pipelines.yml`, `bitbucket-pipelines.yml`, `Jenkinsfile` | The monitoring pipeline for each CI/CD platform. Only one of them is used. On GitHub, the workflow lives on the default branch and runs all monitoring branches. Each one starts with the URL of the sfdx-hardis template it comes from: to upgrade it, compare it with that template. |
376
377
  | `.mega-linter.yml`, `.jscpd.json` | MegaLinter and copy-paste detection settings. The backup adds `DISABLE_ERRORS: true` to `.mega-linter.yml` when the key is missing, so that MegaLinter findings do not fail its job, and creates the file when the repository has none. |
377
378
  | `THIS_IS_MONITORING`, `DO_NOT_DEPLOY_FROM_THIS_REPO` | Empty marker files: this repository is for monitoring only. |
378
379
 
@@ -49,6 +49,7 @@ import { UtilsAi } from '../../../common/aiProvider/utils/utils.js';
49
49
  import ExcelJS from 'exceljs';
50
50
  import { t } from '../../../common/utils/i18n.js';
51
51
  import { writeReportFile } from '../../../common/utils/reportFileWriteUtils.js';
52
+ import { getMonitoringFetchDepthLinksMarkdown } from '../../../common/monitoring/monitoringTemplateLinks.js';
52
53
  Messages.importMessagesDirectoryFromMetaUrl(import.meta.url);
53
54
  const messages = Messages.loadMessages('sfdx-hardis', 'org');
54
55
  // Assets owned by sfdx-hardis, rewritten on every run so styling and behavior fixes reach a
@@ -128,10 +129,7 @@ _The alpine-based sfdx-hardis docker image does not succeed to run mermaid/puppe
128
129
 
129
130
  If Flow history doc always display a single state, you probably need to update your workflow configuration:
130
131
 
131
- - on Gitlab: Env variable [\`GIT_FETCH_EXTRA_FLAGS: --depth 10000\`](https://github.com/hardisgroupcom/sfdx-hardis/blob/main/defaults/monitoring/.gitlab-ci.yml#L11)
132
- - on GitHub: [\`fetch-depth: 0\`](https://github.com/hardisgroupcom/sfdx-hardis/blob/main/defaults/monitoring/.github/workflows/org-monitoring.yml#L62)
133
- - on Azure: [\`fetchDepth: "0"\`](https://github.com/hardisgroupcom/sfdx-hardis/blob/main/defaults/monitoring/azure-pipelines.yml#L46)
134
- - on Bitbucket: [\`step: clone: depth: full\`](https://github.com/hardisgroupcom/sfdx-hardis/blob/main/defaults/monitoring/bitbucket-pipelines.yml#L23)
132
+ ${getMonitoringFetchDepthLinksMarkdown()}
135
133
 
136
134
  ![Screenshot flow doc](https://github.com/hardisgroupcom/sfdx-hardis/raw/main/docs/assets/images/screenshot-flow-doc.jpg)
137
135