fix: bundle README/LICENSE and set explicit file modes in rpm/deb packages and fix files permissions issue. - #447
Conversation
The rpm and deb packages built by goreleaser's `nfpms` block shipped only the binary, unit file, config, and SBOM. Install the project documentation and license alongside them: - `README.md` -> `/usr/share/doc/pgedge-control-plane/README.md` - `LICENSE.md` -> `/usr/share/licenses/pgedge-control-plane/LICENSE.md` nfpm's `doc` and `license` content types are rpm-only — it filters entries of those types out of non-rpm packages — so each file gets two `contents` entries scoped with `packager`: a typed entry for rpm, so the spec carries the `%doc`/`%license` markers, and a plain entry for deb. Both land at the same path. The entries sit on the `&nfpm_defaults` anchor, so all nine per-distro package definitions inherit them. Verified with a snapshot release: `rpm -qdp`/`rpm -qLp` report the markers on the el9 package, and both paths appear in the noble deb's `data.tar.gz` and `md5sums`. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
📝 WalkthroughWalkthroughChangesGoReleaser now sets deterministic modes for packaged files and includes Package contents
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Up to standards ✅🟢 Issues
|
nfpm packages the mode of each source file as it exists on the builder
when no `file_info.mode` is given. CI checks out with `umask 002`, so git
created the files 0664 and that mode shipped in the packages:
-rw-rw-r-- root root /usr/lib/systemd/system/pgedge-control-plane.service
-rw-rw-r-- root root /etc/pgedge-control-plane/config.json
Set `file_info.mode` on every `contents` entry so the packaged modes are
deterministic regardless of the builder's umask. The unit file is 0644.
config.json is 0640, since it may hold credentials and the service runs
as root, so root-only read access is sufficient. The SBOM, README, and
LICENSE entries are 0644, which they were already getting by accident.
Verified by chmod'ing the sources to 0664 to reproduce the CI umask and
rebuilding: `rpm -qlvp` on the el9 and el10 packages and `tar tzvf` on
the noble deb all report 0644 for the unit and 0640 for config.json.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@changes/unreleased/Fixed-20260729-000000.yaml`:
- Line 2: Update the release note body to describe the previous 0664 permissions
as “group-writable” instead of “world-writable-group,” while preserving the
stated deterministic permissions for the systemd service and configuration
files.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: fbab0f76-d1e2-47d5-a039-c00055b60eab
📒 Files selected for processing (2)
.goreleaser.yamlchanges/unreleased/Fixed-20260729-000000.yaml
`0664` is group-writable, not world-writable — the world bits are read-only. Correct the changelog entry to say so. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
| @@ -0,0 +1,3 @@ | |||
| kind: Fixed | |||
There was a problem hiding this comment.
These unreleased comments should be moved to the v0.10.0.md if they're still valid. Otherwise, we can skip them.
Problem
Two packaging defects found in the released rpm and deb packages.
1.
README.mdandLICENSE.mdnot bundledThe packages shipped only the binary, the systemd unit, the config file, and the SBOM:
README.md/usr/share/doc/pgedge-control-plane/README.mdLICENSE.md/usr/share/licenses/pgedge-control-plane/LICENSE.mdBoth are already in the release tarballs via
archives.files, but thenfpmscontents:list had no entries for them.2. Files installed with
0664instead of0644/0640When no
file_info.modeis given, nfpm packages the mode of the source file as it exists on the builder. CI checks out withumask 002, so git creates the files0664and that mode shipped in the packages. Group-writable for a systemd unit and a config file that may hold credentials.Fix
Both fixes are in the
contents:list on the&nfpm_defaultsanchor, so all nine per-distro package definitions (el9, el10, jammy, noble, bullseye, bookworm, trixie, resolute) inherit them.Docs and license. Each file needs two entries. nfpm's
docandlicensecontent types are rpm-only —isRelevantForPackagerfilters entries of those types out of non-rpm packages — so a single typed entry would have fixed the rpm and silently left the deb unchanged. The entries are scoped withpackager:: a typed one for rpm, so the spec carries the%doc/%licensemarkers, and a plain one for deb. Both land at the same path.Modes.
file_info.modeis now set explicitly on every entry, so the packaged modes no longer depend on the builder's umask.0640forconfig.json(it may hold credentials, and the unit runs as root so root-only read access is sufficient),0644for everything else.Verification
Built snapshot releases locally with the pinned goreleaser (
v2.13.3, percommon.mk) and inspected the packages. For the mode fix the sources were firstchmod 664'd to reproduce the CI umask.rpm (
el9.x86_64, inspected in arockylinux:9container;el10.aarch64identical):deb (
noble_amd64):README and LICENSE also appear in the deb's
md5sums.Note
For Debian the conventional license path is
/usr/share/doc/pgedge-control-plane/copyright, so lintian will still flagno-copyright-file. This PR uses/usr/share/licenses/...for both formats as specified; happy to add the Debian-native path alongside it if we want lintian clean.🤖 Generated with Claude Code