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
add trace to rake seed on test #20689
Conversation
…oked via rake ci --> rake build
@@ -81,7 +81,7 @@ namespace :build do | |||
else | |||
ChatClient.log 'Seeding <b>dashboard</b>...' | |||
ChatClient.log 'consider setting "skip_seed_all" in locals.yml if this is taking too long' if rack_env?(:development) | |||
RakeUtils.rake 'seed:all' | |||
RakeUtils.rake 'seed:all', (rack_env?(:test) ? '--trace' : nil) |
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.
should I include ENV['CI']
as well? My understanding is that would detect the CircleCI environments
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.
RACK_ENV
is test
in our CircleCI builds as well:
code-dot-org/.circleci/config.yml
Lines 14 to 16 in cf86dfa
environment: | |
RAILS_ENV: test | |
RACK_ENV: test |
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.
thanks!
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.
LGTM, though I don't know about the ENV['CI']
question - @wjordan may be better to ask about that one
Am I correct in assuming that this line ensures the output of the pegasus and dashboard seed tasks will be logged to Slack? Line 43 in 23bf872
|
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.
👍 from me on trying this out. I'm not 100% confident that this will actually fix the underlying issue, but this is safe enough to try. Testing/verifying any attempted fix in our CI process is going to be the tricky part here.
To give a bit more details/context on this underlying issue (I'll update the Trello card with this added info as well):
The underlying issue that we hope adding --trace
will solve is that in the event that one of the Rake tasks in our CI build (of which a failure within rake seed:all
is one example) fails, we would like the error message (and associated backtraces, log statements, etc) to be captured by our CI-build process and either reported in Slack or included in the log file stored on S3. Currently, the only way to debug errors if this sort is to log into the host and re-run the command manually. As a first step in fixing this general problem, adding --trace
to seed:all
(and ensuring the rake-task trace gets forwarded to Slack and/or S3 correctly) would give a bit more debugging info to help track down this type of issue.
The Here's a dig through the chain of events (with the help of GitHub's code linking), starting with that Lines 38 to 45 in ee3735f
which invokes the code-dot-org/lib/rake/build.rake Lines 154 to 157 in 3c7bca1
which invokes code-dot-org/lib/rake/build.rake Lines 145 to 151 in 3c7bca1
which invokes code-dot-org/lib/rake/build.rake Line 84 in 3c7bca1
Which is done by code-dot-org/lib/cdo/rake_utils.rb Lines 278 to 280 in cf86dfa
code-dot-org/lib/cdo/rake_utils.rb Lines 143 to 145 in cf86dfa
code-dot-org/lib/cdo/rake_utils.rb Lines 87 to 97 in cf86dfa
The error-case in this |
A little higher up the call chain, the code-dot-org/lib/cdo/rake_utils.rb Lines 331 to 361 in 673e657
|
Yeah, I added A bigger project would be to figure out a way to start adding unit-test coverage to parts of these scripts so we can test/verify bugs quicker and with more confidence. That be quite tricky to set up though, which is why we haven't done it yet 😅 |
Possibly the cases where a rake task is being invoked with |
add trace to rake seed on test and send output to Slack
https://trello.com/c/6V3kp5mW/28-add-trace-to-seed-commands-on-test