Tail or cat or add a message if compilation fails
Sometimes we are piping outputs of commands into files. If you do not know that, it is really hard to go see what is going on, e.g.: https://gitlab.com/gitlab-org/gitlab/-/jobs/673545511. As far as I understand we do that to keep the logs more readable and smaller (storage?)
$ run_timed_command "bin/rake gitlab:assets:compile > assets-compile.log 2>&1"
$ bin/rake gitlab:assets:compile > assets-compile.log 2>&1
Uploading artifacts for failed job
00:17
Uploading artifacts...
assets-compile.log: found 1 matching files and directories
public/assets/: found 834 matching files and directories
node_modules/@gitlab/svgs/dist/icons.json: found 1 matching files and directories
Uploading artifacts as "archive" to coordinator... ok id=673545511 responseStatus=201 Created token=hDzSRq3o
ERROR: Job failed: exit code 1
I think it would be helpful if we either:
-
cat
the log -
tail
the log + echo a message that the log can be found in the artifacts. We probably can even build the url to the artifacts page for convience. So for example the log above could have looks like this:
$ run_timed_command "bin/rake gitlab:assets:compile > assets-compile.log 2>&1"
$ bin/rake gitlab:assets:compile > assets-compile.log 2>&1
gitlab:assets:compile failed. Below you see the last 10 lines of the log:
warning Resolution field "ts-jest@24.0.0" is incompatible with requested version "ts-jest@^23.10.5"
error An unexpected error occurred: "https://registry.yarnpkg.com/@gitlab/svgs/-/svgs-1.156.0.tgz: Request failed \"404 Not Found\"".
warning sha.js@2.4.10: Invalid bin entry for "sha.js" (in "sha.js").
Error: You have unmet dependencies. (`yarn check` command failed)
Run `yarn install` to install missing modules.
For the full log go to: https://gitlab.com/gitlab-org/gitlab/-/jobs/673545511/artifacts/browse
00:17
Uploading artifacts...
assets-compile.log: found 1 matching files and directories
public/assets/: found 834 matching files and directories
node_modules/@gitlab/svgs/dist/icons.json: found 1 matching files and directories
Uploading artifacts as "archive" to coordinator... ok id=673545511 responseStatus=201 Created token=hDzSRq3o
ERROR: Job failed: exit code 1
Edited by Lukas 'ai-pi' Eipert