Repository navigation
deploy: chown release to root so files are not owned by the runner uid 1001 - #238
Open
chaoming0625 wants to merge 1 commit into
Open
chaoming0625 wants to merge 1 commit into
chaoming0625 wants to merge 1 commit into
Conversation
Contributor
Reviewer's guide (collapsed on small PRs)Reviewer's GuideThe deployment workflow now normalizes ownership of scp-action releases to root:root before activation, preventing runner UID/GID 1001 from leaving orphaned files on the VPS. Sequence diagram for root-owned release activationsequenceDiagram
participant Runner as GitHub Runner
participant VPS as VPS
participant Release as Release Directory
Runner->>VPS: scp-action uploads and untars release
VPS->>Release: chown -R root:root release
VPS->>VPS: ln -sfn release current.next
VPS->>VPS: mv -Tf current.next current
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Deploys leave files on the VPS owned by uid/gid 1001 (the GitHub runner's user). Finding from the remote.chaobrain.com hub, record 393 (prod uid 1001 / needrestart orphans).
Cause:
appleboy/scp-actionpacks the files into a tarball on the runner and unpacks it on the server with plaintar -zxf. These deploys log in as root, and GNU tar running as root keeps the owner stored in the archive (--same-owneris the default for root). So every file in the release ends up owned by 1001:1001. The admin deploy also runs its owntar -xzfas root, with the same result.On the VPS, uid 1001 no longer maps to any account since the cbl-release account was removed. gid 1001 is
hubclient, a legacy hub group. Files owned by them are orphans, and they show up in the hub's audits.Fix: make the files owned by the user that deploys (root).
chown -R root:root "$release"in the activate step, before the symlink swap. scp-action has no option to pass--no-same-ownerto the remote tar, because itstar_execinput is also used as the local binary name.tar --no-same-owner -xzf.Nothing else changes. Merging triggers a production deploy, so a human should merge this.
Summary by Sourcery
Ensure deployed documentation files are root-owned to prevent orphaned runner ownership on the VPS.
Bug Fixes:
Deployment: