Git-Auto-Deploy icon indicating copy to clipboard operation
Git-Auto-Deploy copied to clipboard

permission issue

Open AndrewAPAC opened this issue 7 years ago • 5 comments

I have a requirement where some of the files in my deployed repo need to be read only. I set up a pre- and post-install script to recursively chmod the directory - the pre allowing write permission and post removing it. Sounds good in theory!

When GAD runs, it seems to initially perform the following steps based on the code:

git fetch origin
git reset --hard origin/branch

and the second command is what fails as permission is denied when the read only files have changed. It seems as though the pre install script is running after these commands.

What might be the best solution here? Run the pre-install script earlier? Add an unconditional chmod u+w before the git fetch origin?

I think a code change is required but would like to hear from the experts.

AndrewAPAC avatar Apr 20 '17 05:04 AndrewAPAC

Maybe a server side hook would solve the question even without change of the code.

While the case seems common enough there are few options.

  • The file that needs to be read-only should be read only to group and not to owner (GAD is owner) and that would solve probably all your problems while making it uncomplicated and as it should be.
  • Second option is that some files are copied to "deployment" location. This is handy if you do not want ".git" folder in same context as what you are sharing (although I doubt anyone is just statically sharing the whole repo of static html files without a proxy nowdays).
  • I would avoid chmoding anything by default, just because this can bring problems further down the line.

Letme avatar Apr 20 '17 07:04 Letme

Hi,

I think that your first suggeston sounds reasonable; running the pre deploy scripts before git fetch. If you do the code change, please submit it as a PR. In any case, let's keep this issue open as a feature request until ir's resolved.

olipo186 avatar Apr 20 '17 07:04 olipo186

I have made a couple of changes and added a new option "prepull" which allows you to run any command. Tested and works fine. I'll try to create a merge request if I can get around our firewall.

Probably wise to add a postpull option too - which I'll do prior to the merge. Code looks like this - very easy

        if "prepull" in repo_config:
                commands.append(repo_config['prepull'])

AndrewAPAC avatar Apr 20 '17 07:04 AndrewAPAC

Submitted PR yesterday after battling with our firewall. Added postpull option as well.

Thanks for your work Oliver!

Andrew

AndrewAPAC avatar Apr 21 '17 01:04 AndrewAPAC

Is the PR OK? Have not heard anything for a couple of weeks. I know we're all busy and all that.....

AndrewAPAC avatar May 04 '17 05:05 AndrewAPAC