chainguard-dev/melange

buildlogs do not get written.

smoser opened this issue · 3 comments

Llogs do not get written as desired with --log-policy. Below is Inside wolfi-dev/os, it uses melange as shown. Specifically note --log-policy builtin:stderr,packages/x86_64/buildlogs/petname-2.11-r7.log, but that does not produce any packages/x86_64/buildlogs/ files .

$ make package/petname 2>&1 | tee out.log
...
@SOURCE_DATE_EPOCH=1715193445 /usr/bin/melange build ./petname.yaml 
  --repository-append /home/user/src/wolfi-os/packages 
  --keyring-append local-melange.rsa.pub --signing-key local-melange.rsa 
  --arch x86_64 --env-file build-x86_64.env --namespace wolfi 
  --generate-index false  --pipeline-dir ./pipelines/  
  -k https://packages.wolfi.dev/os/wolfi-signing.rsa.pub 
  -r https://packages.wolfi.dev/os --source-dir 
  ./petname --log-policy builtin:stderr,packages/x86_64/buildlogs/petname-2.11-r7.log
...
wrote packages/x86_64/petname-2.11-r7.apk
signed index packages/x86_64/APKINDEX.tar.gz with key local-melange.rsa

$ ls -l packages/x86_64/petname-2.11-r7.apk 
-rw-r--r-- 1 user  docker   710126 May 22 13:27 packages/x86_64/petname-2.11-r7.apk
$ ls -l packages/x86_64/buildlogs/
total 0

I've done some testing. It appears that the logs are always written to the default value, even when the --log-policy flag is set. This behavior should not happen.

cmd.PersistentFlags().StringSliceVar(&logPolicy, "log-policy", []string{"builtin:stderr"}, "log policy (e.g. builtin:stderr, /tmp/log/foo)")

re: buildlogs not getting written. my PR to remove ability to set logging policy was merged: #1274 and chainguard-dev/apko#1168 (comment).

The purpose of --log-policy was to pass those values to apko's log writer which understands them. It looks like removing the value of --log-writer shows it was never used by anything.

So we simplified the codebase