Pipelines
damdit-cli ci audit runs one audit of an address without a project. Give it the report of the previous run as a baseline and it compares the two; the step fails only when an issue is new or came back.
Set up the pipeline
Section titled “Set up the pipeline”- Store your CI key as a secret of the pipeline and pass it as
DAMDIT_CI_KEY. See Add your CI key. - Install Damdit CLI in the job. The runner needs Docker:
curl -fsSL https://download.damdit.com/cli/install.sh | shexport PATH="$HOME/.local/bin:$PATH"Audit and compare
Section titled “Audit and compare”damdit-cli ci audit https://staging.example.com \ --baseline previous.dpk --out current.dpk \ --fail-on new,reappeared --fail-severity high \ --report client.pdf--outsaves this run’s report:.dpk, as the app saves audits, or.json. Keep it, for example as a pipeline artifact or in a cache, and give it as--baselinenext time.--baselineis the report of the run to compare with. On the first run there is none: leave out--baselineand--fail-on.--fail-onisnew,reappearedor both, and needs--baseline.--fail-severitycounts only issues of this severity or higher:critical,high,mediumorlow.--reportwrites a report for people:clientordeveloper, then a.pdf,.htmlor.mdfile, for example--report client:handover.pdfor--report developer:site.html. A file namedclient.pdfordeveloper.htmlneeds no prefix:--report client.pdf. Give--reportmore than once for several reports.
Paths are relative to the current folder, which ci always sees. An --out file elsewhere works too: its folder is added for that run.
The log shows the score, the comparison (new, resolved, reappeared, inconclusive and still detected) and each issue that fails the step.
Other options
Section titled “Other options”| Option | What it does |
|---|---|
--pages N |
Audit at most this many pages |
--urls URL,URL |
Audit only these pages. Can’t be combined with --pages or --baseline. |
--format json |
The result as JSON on stdout; the readable summary goes to stderr |
--language en-US |
The language pages are asked for |
--webflow-site ID |
The Webflow site, with DAMDIT_WEBFLOW_TOKEN (or set DAMDIT_WEBFLOW_SITE) |
--gsc-property sc-domain:example.com |
Search Console, with DAMDIT_GSC_CREDENTIALS (or set DAMDIT_GSC_PROPERTY) |
Keys and passwords come from environment variables, never from options. An audit that runs longer than 60 minutes is stopped.
Exit codes
Section titled “Exit codes”| Code | Meaning |
|---|---|
| 0 | The audit is done, and nothing failed it |
| 1 | The audit could not finish |
| 2 | An option is wrong, or the baseline can’t be read |
| 6 | The licence: no key, an invalid key, or no active licence |
| 7 | Nothing responds at the address |
| 8 | The website blocked Damdit, or the locked website’s access is missing |
| 9 | The audit is done and found what --fail-on asks to fail on |
Several websites: damdit.yml
Section titled “Several websites: damdit.yml”damdit-cli ci run audits every website listed in damdit.yml in the current folder, one after another, and compares each with its previous run. damdit-cli ci serve runs their schedules until you stop it.
state: ./damdit-state # where each site keeps its history, runs and reportssites: - name: Northwind url: https://northwind.example pages: 200 schedule: daily 03:00 # or "weekly mon 06:00", "monthly 1 03:00" (ci serve) pageSpeed: true reports: [client.pdf, developer.html] failOn: [new, reappeared] failSeverity: high- Keep the
statefolder between runs: it holds each site’s history, its latest runs and its reports. --site NAMEaudits only that site;--configreads another file.- A site can also take
language,webflow,searchConsoleandaccessfor a locked website. They name environment variables, never secrets, for exampleaccess: { kind: basic, usernameEnv: NORTHWIND_USER, passwordEnv: NORTHWIND_PASSWORD }. ci runends with 1 when an audit failed, 9 when a site found what itsfailOnasks to fail on, and 0 otherwise.
Locked websites
Section titled “Locked websites”For a staging site behind a password or an access rule, set one kind of access:
| Kind | Variables |
|---|---|
| HTTP Basic | DAMDIT_SITE_USERNAME and DAMDIT_SITE_PASSWORD |
| Vercel Deployment Protection | DAMDIT_VERCEL_BYPASS |
| Cloudflare Access | DAMDIT_CF_ACCESS_CLIENT_ID and DAMDIT_CF_ACCESS_CLIENT_SECRET |
| Webflow site password | DAMDIT_WEBFLOW_PASSWORD |
If the start page is locked and the access is missing or wrong, the audit ends with exit code 8 and names the variables to set.