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

misc: add save latest run script #11516

Merged
merged 4 commits into from
Oct 9, 2020
Merged

misc: add save latest run script #11516

merged 4 commits into from
Oct 9, 2020

Conversation

patrickhulce
Copy link
Collaborator

@patrickhulce patrickhulce commented Oct 5, 2020

Summary
Adds a script for stashing the default latest run artifacts in a subdirectory. I do this on a regular basis when investigating tracing issues and figured it'd be helpful for others too.

Example Usage

# writes the data to ./latest-run
$ yarn start https://example.com -GA

# stashes the latest run data to ./latest-run/no-lcp
$ yarn save-latest-run no-lcp

# writes the data to ./latest-run
$ yarn start https://example.com -GA

# stashes the latest run data to ./latest-run/yes-lcp
$ yarn save-latest-run yes-lcp

# restores the no LCP run data
$ cp latest-run/no-lcp/* latest-run/

# run lighthouse with artifacts from no LCP run
$ yarn start https://example.com -A

Related Issues/PRs
#10869 (comment) made me think of it

@patrickhulce patrickhulce requested a review from a team as a code owner October 5, 2020 16:21
@patrickhulce patrickhulce requested review from paulirish and removed request for a team October 5, 2020 16:21
lighthouse-core/scripts/save-latest-run.sh Show resolved Hide resolved
cd $LH_ROOT/latest-run

mkdir -p $TARGET_DIR
cp artifacts.json $TARGET_DIR/
Copy link
Collaborator

Choose a reason for hiding this comment

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

missing lhr..want to just copy every file?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

missing lhr.

that was somewhat intentional but I suppose it wouldn't hurt :)

want to just copy every file?

not really since I keep lots of other stuff in there 😆 , but now that you mention it I think we need to for runtimeError artifacts anyway. I'll move my stuff and copy all files 👍

Copy link
Collaborator

@connorjclark connorjclark left a comment

Choose a reason for hiding this comment

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

LGTM

cd "$LH_ROOT/latest-run"
mkdir -p "$TARGET_DIR"

for file in *.json ; do
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
for file in *.json ; do
for file in *.* ; do

i mean we dont have non-json now but figure it can be flexible for all non-directories..

Copy link
Collaborator Author

@patrickhulce patrickhulce Oct 8, 2020

Choose a reason for hiding this comment

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

wouldn't that pickup the default of .bak?

selfishly that also means it starts to pick up all the various *.zips when I need to upload these to issues 😬

can we only do this when we have a need for something other than json?

Copy link
Member

Choose a reason for hiding this comment

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

wouldn't that pickup the default of .bak?

lol right.. suggestion above for that.

can we only do this when we have a need for something other than json?

sure

lighthouse-core/scripts/save-latest-run.sh Outdated Show resolved Hide resolved
cd "$LH_ROOT/latest-run"
mkdir -p "$TARGET_DIR"

for file in *.json ; do
Copy link
Member

Choose a reason for hiding this comment

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

wouldn't that pickup the default of .bak?

lol right.. suggestion above for that.

can we only do this when we have a need for something other than json?

sure

Co-authored-by: Paul Irish <paulirish@google.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants