# Generated by `sfdt ci init --provider gitlab --type monitor`.
# Merge this job into your .gitlab-ci.yml, then create a pipeline schedule
# (CI/CD > Schedules) with cron '{{cron}}'.
#
# Required CI/CD variables (Settings > CI/CD > Variables, masked):
{{authSecretsDoc}}
#   SLACK_WEBHOOK_URL    (optional) Slack incoming webhook
#   TEAMS_WEBHOOK_URL    (optional) Microsoft Teams incoming webhook
sfdt-monitor:
  image: {{image}}
  rules:
    - if: '$CI_PIPELINE_SOURCE == "schedule"'
  script:
    {{cliSetup}}
    {{authSteps}}
    - {{cli}} monitor all --org {{org}} --backup --notify --json
    # Setup-audit-trail anomalies and critical security changes; exits
    # non-zero on a critical change or a per-user velocity spike.
    - {{cli}} audit all --org {{org}} --notify --json
  artifacts:
    when: always
    paths:
      - logs/monitor-latest.json
