travis-ci / travis-ci

Free continuous integration platform for GitHub projects.
https://travis-ci.org
8.41k stars 722 forks source link

Folding bug when `travis_fold` directive appears in `.travis.yml` #2798

Open rneatherway opened 9 years ago

rneatherway commented 9 years ago

Please see my test repository at https://github.com/rneatherway/travis_folding/.

My .travis.yml first calls a Makefile with a single target that runs

echo -e "travis_fold:start:make1\nline1\nline2\ntravis_fold:end:make1\n\nbetween\n\ntravis_fold:start:make2\nline3\nline4\ntravis_fold:end:make2\n"

This is correctly folded into make1 and then make2. I then run the same command (with incremented task numbers) directly from .travis.yml. The output is strange in a few ways:

  1. The "lineX" output is duplicated instead of the executed command being output.
  2. The command is referred to as "" when its exit code is reported.
  3. The second fold (make4) is not closed, and so absorbs the following script steps incorrectly.

The output can be seen at https://travis-ci.org/rneatherway/travis_folding/builds/35718401

BanzaiMan commented 9 years ago

I don't think travis_fold expects to have \n within the name. I don't think travis-web can handle such markers. I don't know how difficult it is to make this pretty, but I tend to think this is a feature with little benefit for whatever work that's necessary.

rneatherway commented 9 years ago

@BanzaiMan, I'm not sure what you mean. Isn't travis just interpreting what is output to standard output? The \n characters will all appear as literal newlines in the output.

BanzaiMan commented 9 years ago

On the web page, travis-web interprets what is in the log file, and marks up appropriately so that it can be displayed the way the users expect. Having multiple newlines breaks travis-web. I am not sure what benefit having multiple newlines would bring the users.

rneatherway commented 9 years ago

I think we're talking at cross-purposes here. I am not attempting to have a folding name that contains newlines. My echo command, both within the makefile and in travis.yml, just wraps a bit of output in folds named makeX for X from 1 to 4.

If you look at the raw logfile then you can see that when the post-command output of the form:

Command 'XXXXXXXX' exited with 0

is printed, it is not being properly escaped, so the \n characters are converted to newlines. This means that what should be:

The command "echo -e "travis_fold:start:make3\nline5\nline6\ntravis_fold:end:make3\n\nbetween\n\ntravis_fold:start:make4\nline7\nline8\ntravis_fold:end:make4\n"" exited with 0.

becomes:

The command "echo -e "travis_fold:start:make3
line5
line6
travis_fold:end:make3

between

travis_fold:start:make4
line7
line8
travis_fold:end:make4
"" exited with 0.

As a result there appear to be multiple instance of fold commands for 3/4 in the output and travis-web gets understandably confused.

rneatherway commented 9 years ago

Hi, any thoughts on this one? Do you see what I mean now?

rneatherway commented 9 years ago

Ping

BanzaiMan commented 9 years ago

Sorry for the delay. Does travis_fold work as expected in .travis.yml if you didn't put \n within?

rneatherway commented 9 years ago

Yes

backspace commented 7 years ago

I’ve recently adjusted the log code so that folds with the same name are assigned unique internal names. Is it okay to close this issue now, @rneatherway?

rneatherway commented 7 years ago

The commands are still not escaped when output to the logfile, so most of the problem persists (see my comment above https://github.com/travis-ci/travis-ci/issues/2798#issuecomment-56534039). In my test repo there should only be one fold with each name.

stale[bot] commented 6 years ago

Thanks for contributing to this issue. As it has been 90 days since the last activity, we are automatically closing the issue. This is often because the request was already solved in some way and it just wasn't updated or it's no longer applicable. If that's not the case, please do feel free to either reopen this issue or open a new one. We'll gladly take a look again! You can read more here: https://blog.travis-ci.com/2018-03-09-closing-old-issues

rneatherway commented 6 years ago

It seems that I don't actually have permission to reopen this issue, although it is still relevant. I just reran a build on my test repo to confirm the issue still exists: https://travis-ci.org/rneatherway/travis_folding/builds/171956623?utm_source=github_status&utm_medium=notification

backspace commented 6 years ago

Thanks for the update, I’ll open the issue. I’m quite occupied with major changes elsewhere, I’m not sure when I’ll be able to get back to this, sorry.

rneatherway commented 6 years ago

Understood :-)

stale[bot] commented 6 years ago

Thanks for contributing to this issue. As it has been 90 days since the last activity, we are automatically closing the issue in 24 hours. This is often because the request was already solved in some way and it just wasn't updated or it's no longer applicable. If that's not the case, please do feel free to either reopen this issue or open a new one. We'll gladly take a look again! You can read more here: https://blog.travis-ci.com/2018-03-09-closing-old-issues

rneatherway commented 6 years ago

:-(