Skip to content

Gitlab

Pre-requisites

Create access token

  • Go to Project -> Settings > Access Token (you must have Gitlab authorizations to access this menu)
  • Create an access token with the following info:
    • name: SFDX HARDIS MONITORING
    • role: Developer
    • scopes: read_repository, write_repository
  • Copy the value of the generated token in your clipboard ! (CTRL+C)

Create CI/CD variable

  • Go to Project -> Settings > CI/CD -> Variables (you must have Gitlab authorizations to access this menu)
  • Create the variable with the following info:
    • name: ACCESS_TOKEN
    • value: Paste the value that has been generated when creating the access token in the previous step
    • Select Mask variable
    • Unselect Protected variable

Run sfdx-hardis configuration command

  • Run command Configuration -> Configure Org Monitoring in VsCode SFDX Hardis, then follow instructions.

Define sfdx-hardis environment variables

  • Go to Project -> Settings > CI/CD -> Variables (you must have Gitlab authorizations to access this menu)
  • For each variable sfdx-hardis command Configure org monitoring tells you to define, create with name and value given in sfdx-hardis command logs

Schedule the monitoring job

  • Go to Project -> Build -> Pipeline schedules
  • Click on New schedule
  • Input custom interval pattern as CRON expression, for example:
    • 0 1 * * * will run the monitoring job every day at 1 AM
    • 0 22 * * * will run the monitoring job everyday at 10 PM
  • Select the CRON TimeZone (for example [UTC+2] Paris)
  • Select the target branch corresponding to the org you want to monitor
  • Validate by clicking on Create Pipeline Schedule