-
Notifications
You must be signed in to change notification settings - Fork 50
Stop destroying test output with automatic logging #569
Conversation
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.
Looks good, just one note on the GHA flow
.github/workflows/ci_cd.yml
Outdated
|
||
- name: Print API test failure logs | ||
if: {{ failure() }} | ||
run: just logs |
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 this stop as well, since the previous step failed?
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 was going to try debugging whether you have to explicitly exit 1
or something or if the if: {{ failure() }}
runs just the "failure" jobs and ignores the rest.
@@ -18,8 +18,7 @@ succeeded=$? | |||
if [[ $succeeded -eq 0 ]]; then | |||
printf "${green}:-) All tests passed${endcol}\n" | |||
else | |||
printf "Full system logs:\n" | |||
docker-compose logs |
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.
So apparently this has never worked for just api-test
because docker-compose
isn't available within the container 🙃
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.
Ahhh, I use api-testlocal
because it's easier to interface with pdb
than having to docker attach openverse-web-1
or whatever.
Just marking ready for review to test CI but it's still not confirmed to be working. |
Apparently printing the API test logs times out the GitHub actions 💀 I think it'd be best to pipe them to a file and then upload them as an artifact. |
Nope, I was wrong. The logs are automatically followed by the justfile. Removing the |
justfile
Outdated
@@ -44,7 +44,7 @@ recreate: | |||
@just up "--force-recreate --build" | |||
|
|||
# Show logs of all, or named, Docker services | |||
logs services="" args="-f": | |||
logs services="" args="": |
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 don't love this change, as it'll mean having to specify -f
every time I run this locally 😕
Could we perhaps have this function similar to the IS_PROD
flag, maybe with IS_CI
, and that automatically removes the -f
?
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.
Yeah, that'd be good! We could use the same IS_CI flag to automatically add -T
to the other docker-compose commands as well to avoid having to remember that when adding new actions 🎉
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.
That's a great point!
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.
@sarayourfriend if you're okay with it, I can work on adding IS_CI
to this branch 🙂
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.
It's up now, thanks though.
@obulat could you look at this PR this week? |
9fb2bcf
to
39cad50
Compare
Rebasing this so the actions actually run and we can verify they work 👍 |
cc4c242
to
de045ca
Compare
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.
Can we also export the logs as an artifact? Having the logs locally to scan through would be massively helpful because the GitHub Actions UI is not that good imo.
Also the PR says "[WIP]" in the title, confirming if that is still the case.
de045ca
to
1594292
Compare
@dhruvkb Sure, I actually did at one point upload them as an artifact. I've put it back now. Will remove the WIP once the actions are passing as expected. |
Feel free to use any code regarding logs from 0283304 (now removed from the other PR). |
@dhruvkb TIL you can download the raw output of actions: Uploading the logs as an artifact still makes sense though because the raw output includes control characters for color output and makes it very annoying to read 😒 |
This is ready for review now @AetherUnbound @dhruvkb @obulat |
@@ -44,7 +46,7 @@ recreate: | |||
@just up "--force-recreate --build" | |||
|
|||
# Show logs of all, or named, Docker services | |||
logs services="" args="-f": | |||
logs services="" args=(if IS_CI != "" { "" } else { "-f" }): |
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.
woah, TIL! Very cool
@@ -1,5 +1,7 @@ | |||
set dotenv-load := false | |||
|
|||
IS_CI := env_var_or_default("CI", "") |
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.
TIL here as well! This is great
@@ -1,5 +1,7 @@ | |||
set dotenv-load := false | |||
|
|||
IS_CI := env_var_or_default("CI", "") |
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.
TIL here as well! This is great
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 love it! ✨ 🚀
Small nit: for the API, the steps are print -> upload, but for the ingestion server they're upload -> print. It might be good for consistency to have these both be either one or the other.
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 have a few suggestions:
Fixes
Fixes #520 by @sarayourfriend
Description
Stops the destructive logging we were doing but maintains helpful-for-debugging logs in CI.
Testing Instructions
Run
just api-testlocal
with some tests that will fail (assert True is False
) and confirm that it does not log away the test output locally.I'll push a commit with a failing test to confirm that it does still log in CI
Checklist
Update index.md
).main
) or a parent feature branch.Developer Certificate of Origin
Developer Certificate of Origin