Make travis wait on multi line script?

I modifying a travis.yml where command runs for long time, more than 10 minutes. The special in this script is that, it is a maven command where the ouput is redirected to a file, and the whole command runs more than 35.

I’ve implemented Travis doc suggest to use travis_wait , but I haven’t found any example or something how to use it with multiline scripts.

is there anyway my team can do this?

There are two reasons we want this:

  • not dealing with maven’s very long output
  • avoid hitting Travis 4MB ouput limit

My script looks like this and the mvn clean install part should be waited.

script:
  - |
    if [[ -z "$TRAVIS_TAG" ]]; then
      mvn clean install > output.txt
    fi

What I tried so far are below, without positive results. I have to mention that I’m pretty new in working with yaml files.

script:
  - |
    travis_wait 40
    if [[ -z "$TRAVIS_TAG" ]]; then
      mvn clean install > output.txt
    fi

And

script:
  - |
    if [[ -z "$TRAVIS_TAG" ]]; then
      travis_wait 40 mvn clean install > output.txt
    fi

ive seen similar help tickets but no answer, thank you! @montana any advice? sorry to tag you, you always seem to know the best :stuck_out_tongue_winking_eye:

Hey @SolarUltima,

In this scenario, using travis_wait will not do the specific job you want via the pipe is output.txt to a file. Travis will still see no output from the command.

Assuming the command itself produces enough output (which it should) and if not you can use verbose, the easy fix is:

mvn clean install | tee output.txt

This writes to output.txt and outputs to stdout so that Travis recognizes the call, and picks up on it.

2 Likes

as usual @montana, you got it on the head! :slight_smile:

Cool, I’m glad I could solve your issue, remember in short with Java 9 if you declare both the test-scoped dependency and the Java 9 modules the test doesn’t compile anymore, which in this case would be:

mvn clean install output
1 Like