0

I am attempting to play around with https://github.com/uber/prototool that i came across. I created a simple repo called protobufs and wrote a simple script to generate my proto files in a docker container that pulls the image uber-prototool. Code ingenerate.sh` file:

#!/bin/bash

rm -rf gen

echo Generating Go code for all repos...

docker run --rm -v "$(pwd):/work" "uber/prototool:1.8.0" prototool generate proto

and also have a prototool.yaml file that looks like

excludes:
  - node_modules

protoc:
  version: 3.8.0

lint:
  group: uber2

  file_header:
    content: |
      //
      //
      //
    is_commented: true

generate:
  plugins:
    - name: go
      output: ../gen/go
      flags: plugins=grpc

I successfully generate the proto files but i get a Permission Denied when attempting to cd into the generated folder called gen. It's a hidden file and only can have access when i use sudo. It fails to show the hidden folder in vscode as well. I don't want to have to sudo into the hidden folder all the time and rather want a non root user to have access. How can i solve this?

Here is a screenshot of the repo being generated as a root user: enter image description here

EI-01
  • 1,075
  • 3
  • 24
  • 42
  • *sigh* `sudo` is not the *NIX way of „I really mean what I am saying.“ It changes your euid to 0, making the process you start running as superuser. The docker image you are using obviously runs as root, hence the files generated by it belong to root (0==0 about everywhere ;)). Simply do a `sudo chown yourUser:yourGroup -r gen` – Markus W Mahlberg Oct 09 '19 at 08:17
  • @MarkusWMahlberg but it seems i will have to run this command `sudo chown yourUser:yourGroup -r gen` everytime i run the script which will override the user. – EI-01 Oct 10 '19 at 05:48
  • That is inherent by the use of Prototool from within a docker container. Simply add the chown part to your script or use one of the other installation methods. – Markus W Mahlberg Oct 10 '19 at 06:43
  • @MarkusWMahlberg what other installation methods are you referring to? – EI-01 Oct 19 '19 at 04:57
  • https://github.com/uber/prototool/blob/dev/docs/install.md – Markus W Mahlberg Oct 19 '19 at 12:10

0 Answers0