Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support umask for git repos (try 2) #574

Merged
merged 1 commit into from
Oct 24, 2022
Merged

Conversation

bugfood
Copy link

@bugfood bugfood commented Oct 19, 2022

This is a re-attempt of: #541

I can't re-open that PR (see: #541 (comment)).

@jordanbreen28 can you please either check this one or re-open the original PR, if possible now?

Differences from the last revision of the original PR are:

  • rebased
  • fixed integration test

Thanks,
Corey

@bugfood bugfood requested a review from a team as a code owner October 19, 2022 16:39
@puppet-community-rangefinder
Copy link

vcsrepo is a type

Breaking changes to this file WILL impact these 178 modules (exact match):
Breaking changes to this file MAY impact these 66 modules (near match):

This module is declared in 110 of 579 indexed public Puppetfiles.


These results were generated with Rangefinder, a tool that helps predict the downstream impact of breaking changes to elements used in Puppet modules. You can run this on the command line to get a full report.

Exact matches are those that we can positively identify via namespace and the declaring modules' metadata. Non-namespaced items, such as Puppet 3.x functions, will always be reported as near matches only.

When cloning a repo, it can be useful to have shared access such that
other members of the cloning user's group are able to manage the repo as
well. This requires two components:

1. The setgid bit to be set on directories; this can be accomplished by
   puppet code which creates the repo directory before calling vcsrepo.
2. A umask that allows group writeability to be used during the clone.

This patch implements the second component. Note that for git,
specifically, there is a core.sharedRepository option, but this only
seems to be respected on 'git init', not 'git clone'. By default, git
will respect the umask anyhow.

I do not have ready access to the other version control systems, so I
only implemented this for git, but using a umask is likely portable to
other version control systems as well.

For the umask rspec test, documentation is here:
https://serverspec.org/resource_types.html#file
Despite the documentation saying that this "supports 3 and 4 number
octet matching", the backend implementation is finnicky.
https://github.com/mizzy/specinfra/blob/6e4460cbc46033add002d41266719bf157dbed63/lib/specinfra/command/base/file.rb#L55
This shells out to the stat and grep commands, and the specified stat
output format results in a representation that is not zero-padded.
@bugfood
Copy link
Author

bugfood commented Oct 19, 2022

Updated to fix the rubocop style check failure.

-Corey

@jordanbreen28
Copy link

Thank you @bugfood, and again, apologies for any inconvenience!
I noticed there was a couple of PR testing failures, but I've rekicked the tests as I suspect they may be transient.

Copy link

@jordanbreen28 jordanbreen28 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bugfood as suspected all tests are now passing :-)
Happy to merge this change now - thanks again for your work on this one!

@jordanbreen28 jordanbreen28 merged commit 769444a into puppetlabs:main Oct 24, 2022
@bugfood
Copy link
Author

bugfood commented Oct 24, 2022

Nice, thank you. I'm glad we can get this through.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants