-
Notifications
You must be signed in to change notification settings - Fork 19
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
Allow rake to remove toolchaing, clean before testing #350
Conversation
I've hit two problems: 1. Running `rake` then `rake test` would fail[1]. To address this I run `codegen:clean` before test 2. Runig `rake codegen:clean` would fail[2]. To address this I add write permission to the toolchain dir before attemmpting to remove it. [1] ```bash $ rake test 2 go list ./... | grep -v vendor | xargs go test -v 3 pattern ./...: directory toolchains/pkg/mod/github.com/fatih/camelcase@v1.0.0 outside main module or its selected dependencies ``` [2] ```bash $ rake codegen:clean rm -rf /Users/joachim.bartosik/go/src/github.com/DataDog/agent-payload/toolchains/gogo rm -rf /Users/joachim.bartosik/go/src/github.com/DataDog/agent-payload/toolchains rm: cannot remove '/Users/joachim.bartosik/go/src/github.com/DataDog/agent-payload/toolchains/pkg/mod/github.com/envoyproxy/protoc-gen-validate@v0.10.1/main.go': Permission denied rake aborted! Command failed with status (1): [rm -rf /Users/joachim.bartosik/go/src/gith...] /Users/joachim.bartosik/go/src/github.com/DataDog/agent-payload/Rakefile:36:in `block (2 levels) in <top (required)>' Tasks: TOP => codegen:clean (See full trace by running task with --trace) ```
@@ -33,6 +33,9 @@ protoc_jsonschema_version="73d5723" | |||
namespace :codegen do | |||
task :clean do | |||
sh "rm -rf #{gogo_dir}" | |||
if Dir.exist?(toolchain_dir) | |||
sh "chmod u+w -R #{toolchain_dir}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Quetsion: Would it make more sense to add the permissions in the task that generates the proto files?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm new here but I think that this is a good way to go around this - in most cases we don't want to overwrite anything in the directory so it's readonly
/merge |
🚂 MergeQueue: pull request added to the queue The median merge time in Use |
I've hit two problems:
rake
thenrake test
would fail[1]. To address this I runcodegen:clean
before testrake codegen:clean
would fail[2]. To address this I add write permission to the toolchain dir before attemmpting to remove it.[1]
[2]
Motivation
I want to run
rake test
and have it work.Reviewers: please see the review guidelines.