Skip to content

Commit 72b25d4

Browse files
committed
doc: document checkout-/build-/packageAuditFiles
1 parent 35c31d6 commit 72b25d4

File tree

2 files changed

+70
-0
lines changed

2 files changed

+70
-0
lines changed

doc/manual/audit-trail.rst

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,9 @@ Example of a single audit record::
7474
"c5b2a8231156f43728af34f3a2dcb731ade2f76a"
7575
]
7676
},
77+
"files" : {
78+
"hashes" : "0dd432edfab90223f22e49c02e2124f87d6f0a56 ./COPYING"
79+
},
7780
"meta" : {
7881
"language" : "bash",
7982
"recipe" : "root",
@@ -309,3 +312,16 @@ found under the ``build`` key and contains the following fields:
309312
information. The ``os-release`` field, if present, is more reliable in this
310313
case.
311314

315+
Audit files
316+
~~~~~~~~~~~
317+
318+
Additional files can be included in the audit trail by using
319+
:ref:`configuration-recipes-auditfiles`. Essentially, they are included as is
320+
as strings into a key/value mapping under the ``files`` key. Example::
321+
322+
{
323+
"files" : {
324+
"hashes" : "0dd432edfab90223f22e49c02e2124f87d6f0a56 ./COPYING"
325+
},
326+
}
327+

doc/manual/configuration.rst

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -489,6 +489,60 @@ can be configured.
489489
Recipe and class keywords
490490
-------------------------
491491

492+
.. _configuration-recipes-auditfiles:
493+
494+
{checkout,build,package}AuditFiles
495+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
496+
497+
Type: Dictionary (String -> String | AuditFileDefinition)
498+
499+
The :ref:`audit-trail` records where and when a package was built, the state of
500+
the recipes and the checked out sources. Additionally, selected files of a step
501+
can be included into the audit trail too. Example::
502+
503+
# Create a checksum of all files except the ".bob" folder.
504+
checkoutDeterministic: True
505+
checkoutScript: |
506+
...
507+
mkdir .bob
508+
find . -path ./bob -prune -o \( -type f -print \) | xargs sha1sum > .bob/file-hashes
509+
510+
checkoutAuditFiles:
511+
FILE_HASHES: .bob/file-hashes
512+
513+
This will include the content of ``.bob/file-hashes`` into the audit trail::
514+
515+
{
516+
"files" : {
517+
"FILE_HASHES" : "0dd432edfab90223f22e49c02e2124f87d6f0a56 ./COPYING"
518+
},
519+
}
520+
521+
By default, the named file(s) must be present and are read with UTF-8 encoding.
522+
Both properties can be changed with the long format::
523+
524+
packageAuditFiles:
525+
COPYING:
526+
filename: COPYING
527+
encoding: latin1
528+
if: "$INCLUDE_COPYING"
529+
530+
The file is only added to the audit trail when the ``if`` :ref:`condition
531+
<configuration-principle-booleans>` is true. The file name must always be a
532+
relative path. File names and encodings can use
533+
:ref:`configuration-principle-subst`. There is a special encoding ``"base64"``
534+
which can read binary file and includes them base64 encoded into the audit
535+
trail. See the `Python standard encodings
536+
<https://docs.python.org/3/library/codecs.html#standard-encodings>`_ for a list
537+
of possible encodings.
538+
539+
Note that changing any of the audit files properties does not lead to a rebuild
540+
of affected packages. These settings do not influence the build result and
541+
therefore also do not contribute to variant management. If two identical
542+
packages use different audit file settings it is unspecified which setting is
543+
applied. Therefore, keep the audit file settings static or ensure that they
544+
are configured consistent between package variants.
545+
492546
.. _configuration-recipes-scripts:
493547

494548
{checkout,build,package}Script[{Bash,Pwsh}]

0 commit comments

Comments
 (0)