Repository navigation
v0.5.0
Breaking changes
- errata check runs program and generated checks that last took a second or more in copies of the repository in the user's cache, ignored files included up to 32 MiB
- a program check that writes a file a later check reads needs in_place: true
- SIGTERM and SIGHUP stop errata check as an interrupt does
Changes
- errata --version prints the version, the same line as errata version, and exits 0.
- In a container on cgroup v2 whose CPU limit is not a whole number of cores, or is one core, errata check runs as many rules at once as the limit's whole cores, at least one, where it ran one more and was throttled; set GOMAXPROCS to choose the number yourself.
- A PHP array() with one element, such as array('x'), now reads as a list of one, as the short form does; it read as the bare value before, so a path that takes each member of it selected nothing.
- New: an extractor kind errata does not build in is a plugin, an executable named
errata-ext-NAMEthat provides the kindNAMEunderextract:. Its entry takesfile,filesandmax_bytesas any kind does, plus the keys the plugin declares, and errata decodes it as strictly as a built in kind's. The first two plugins arecsvandhcl, released on tags of their own; the README's Plugins section shows how to install one. A plugin's release is taggederrata-ext-NAME/vX.Y.Z, holds an executable for each platform and a checksums file, and is never marked latest, so errata's own release stays the latest. - New:
errata plugin install NAMEdownloadserrata-ext-NAMEfor your system from errata's GitHub releases, checks it against the checksums file of its release, sends it the describe request, keeps it in the user's cache under its sha256, and writes its version and the sha256 of every platform's build intoerrata.lock. Commit the lock. Without a version it installs the version the lock pins, else the newest release that is neither a draft nor a prerelease. With no name it installs every plugin the lock pins, which is what a CI job runs beforeerrata check. errata plugin install --vendoralso writes every platform's build the lock pins, the release's notices file and errata's LICENSE into.errata/plugins, so CI with no network runs from the commit. Once.errata/pluginsexists, a run looks there alone, so every install vendors as--vendordoes and says so.errata plugin installrefuses a release or a mirror that serves other bytes than the lock pins, and never rewrites a pin: delete the plugin's lines fromerrata.lockto pin it anew. It writes the lock last, only when every plugin installed, and otherwise exits 2 with the lock unchanged. A download is at most 256 MiB, and fails when the server sends no answer within 30 s or nothing for 60 s.- To install from a mirror of the releases, set
ERRATA_PLUGIN_SOURCEor pass--source, an https URL with no user name or password, or afile:///directory. A mirror holds each release's files in a directory named by its tag, such aserrata-ext-csv/v0.1.0/. It installs only versions the lock already pins; pass--trust-sourceto let it choose a new pin, or pin each version once from GitHub.GITHUB_TOKENis sent to api.github.com alone, when errata looks up the newest release. - A plugin from elsewhere installs from a file with
errata plugin install --file ./errata-ext-NAME, or from an https URL with--urland the--sha256you give, which errata checks before it keeps the file.--platformadds another platform's build of a URL pin, and--replacelets either take the place of a release the lock pins. Such a plugin speaks plugin protocol 1, which docs/plugin-protocol.md specifies. errata.lock, at the top of the repository, pins one plugin build a line: name, version, platform and sha256, thensource=fileorsource=url:for a plugin from elsewhere. errata reads it whenever the config loads. A repository without one uses no plugin and loads as before; a line errata cannot read, or a file over 1 MiB, makes the config fail to load, naming the line.errata plugin installkeeps the comment lines at the top of the file and drops every other comment.- A run never downloads a plugin and never looks on PATH. It runs the build the lock pins from
.errata/pluginswhen the repository has that directory, else fromerrata/pluginsin the user's cache directory, and checks its sha256 against the lock first. errata does not start a build that is missing, is a symbolic link or lies below one, has another sha256 (the message names both), or is not pinned for the platform errata runs on; every rule with an entry of its kind is then unknown, naming the plugin, the path and theerrata plugin installcommand to run. - errata starts a plugin once for each request, in an empty directory of its own, with an environment that holds only
GOMAXPROCS,GOMEMLIMITandGOGCwhen errata has them, andSYSTEMROOTon Windows. A CI job's tokens,HOMEandPATHdo not reach it. On Linux and macOS errata kills the plugin's process group when the request ends. - A plugin has 10 s to describe itself and to build its entries, and 30 s for each extract. Its stdout is bounded at 1 MiB for describe, 32 MiB for build and an amount set by
max_bytesfor extract, and its stderr at 1 MiB, of which a message quotes the last 256 bytes. Past a bound errata stops the plugin and the rule is unknown, naming the bound; for describe and build, every rule with an entry of its kind is. - A plugin that fails to describe itself, or speaks no protocol version errata speaks, makes every rule with an entry of its kind unknown; the message names the versions each side speaks. An entry the plugin refuses makes the config fail to load, quoting the plugin. A reply errata refuses makes the rule unknown, and so do more than 100000 values, or values past
max_bytes, where a plugin's key and condition count too. Such a rule still loads, and errata refuses none of its extractors as unused. - New: the
csvplugin,errata-ext-csv, reads a cell of a CSV or TSV file as Go's encoding/csv parses RFC 4180.columnnames the column of the value, andwheremaps columns to the text the row must hold; each matching row gives a value, and with nowhereevery row does.header: falsereads the first row as data and names columns by number from 1, written as a string such ascolumn: "2".dialectiscsvortsv, anddelimitertakes another single character, such as a semicolon. - The
csvplugin makes the rule unknown, naming the file and the line, for a row that does not parse, a header that lacks the column or awherekey or names one twice, a file with no header row, a value's cell that is not UTF-8, and more than 100000 values. Awherethat matches no row finds no value, soallow_emptydecides. A lone CR does not end a row, so a file saved as Excel for Mac's CSV (Macintosh) is one row: save it with LF or CRLF line ends. A UTF-8 byte order mark is not part of the first cell. - New: the
hclplugin,errata-ext-hcl, reads an attribute of a Terraform.tfor.tfvarsfile, a Packer.pkr.hclfile or a Nomad job file with HashiCorp's hcl/v2 native syntax, and evaluates nothing. Its keypathwalks dotted names through attributes, block types and each label in turn, as invariable.region.defaultorresource.aws_instance.web.ami. A quoted name in brackets reads a name with a dot, a number in brackets a list element, and a star in brackets every attribute, label, item or element. - The
hclplugin returns a literal as the file writes it: a number as written,true,false,null, or a string with no interpolation, its escapes read. It returns anything else as the file wrote it, marked not literal: a reference, an interpolation, a function call, an operator, a conditional, a for expression, and a value the path goes past, such as a key inside amergecall. With a star in the path, each value's condition is the path it matched. A path that selects nothing finds no value, soallow_emptydecides; one that ends at a block, an object or a list makes the rule unknown. - The
hclplugin makes the rule unknown, naming the file and the line, for a file HCL cannot parse, and before parsing for a file nested more than 1000 levels deep, a number longer than 1000 bytes, a template that costs more than 128 timesmax_bytesto join, or more tokens than one for every 16 bytes ofmax_bytes, 2097152 at the default. An ordinary file of about 4.5 MB or more passes the token limit: raisemax_byteson its entry. More than 100000 values make the rule unknown too. - The
hclplugin reads one request's files for at most 20 s, below errata's 30 s for an extract, and past that the rule is unknown with the plugin's message naming the file and the 20 s. This bound depends on the machine, unlike the others, so a file that parses in close to 20 s can pass on a fast runner and fail on a slow or busy one. - When an interrupt, SIGTERM or SIGHUP stops errata, each program check, generated check, rule and plugin that had not finished is unknown with a message that starts
cancelled:and names the signal. A program check said before that it did not finish within its timeout, which it had not reached. An interrupt while the config loads stops the plugins describing and building in the same way. - The html reader, and HTML in Markdown, read a frameset and a frame tag as a browser does. A frameset replaces the page's body only while the body holds nothing but blanks and elements such as a div or a heading; errata then reads nothing after it but comments, so a
code,sectionortabletarget there finds no value. Anywhere else both tags are ignored and open no element, where errata read them as ordinary elements and took text a browser drops. - A regex whose best literal is a single byte, such as the colon of a token pattern of digits, a colon and word characters, now searches only the lines that hold both that byte and a run of four or more characters of one ASCII class the pattern needs, when the pattern cannot cross a line. Such a rule reads a large source tree in less time.
- A record field whose path selects more than 100000 values is refused with a message that names the file once, at its start, where it named it twice.
errata listprintsin_placefor a check that sets it, and the JSON listing gives every program check and generated check anin_placekey, false when the check sets none.- errata records how long each program and generated check took in
durations.json, in the repository's directory of the user's cache (errataunder$XDG_CACHE_HOME,~/.cache,~/Library/Cachesor%LocalAppData%), and copies a check only when the record is missing or its last run took 1 s or more. A CI job that starts with an empty cache copies every such check. - errata check runs every check in the repository, as before, when a copy cannot pay or cannot match the tree: fewer than two program or generated checks that took a second or more, a pool of one worker, no
giton the PATH as in errata's image, a repository with no commit, submodules, a sparse checkout, afilterattribute such as Git LFS, ignored files over 32 MiB, orGIT_DIRand its kin set, as a git hook sets them. - A check in a copy sees the copy's path as its working directory and
ERRATA_ROOT, files modified when the copy was made, and the copy's git config, in which anincludeIf "gitdir:..."section or a relativeinclude.pathmay not apply. A copy errata cannot make, such as on a full disk, leaves its check unknown, saying why.
All commits since v0.4.2: https://github.com/f-klement/errata/compare/v0.4.2..v0.5.0