Skip to content

This is travis helper to run particular work only once in matrix

License

Notifications You must be signed in to change notification settings

nno/travis_after_all

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

38 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

travis_after_all

Build Status

This is Travis CI helper to run particular work only once in matrix.

This is workaround for: travis-ci/travis-ci#929

The main goal of this script to have a single publish when a build has several jobs. Currently the first job is a leader, meaning a node that will do the publishing.

An example .travis.yml shows how to ensure that all_succeeded or all_failed:

#...
script:
  - curl -Lo travis_after_all.py https://raw.github.com/dmakhno/travis_after_all/master/travis_after_all.py
after_success:
  - python travis_after_all.py https://api.travis-ci.com
  - export $(cat .to_export_back)
  - |
      if [ "$BUILD_LEADER" = "YES" ]; then
        if [ "$BUILD_AGGREGATE_STATUS" = "others_succeeded" ]; then
          echo "All jobs succeeded! PUBLISHING..."
        else
          echo "Some jobs failed"
        fi
      fi
after_failure:
  - python travis_after_all.py https://api.travis-ci.com
  - export $(cat .to_export_back)
  - |
      if [ "$BUILD_LEADER" = "YES" ]; then
        if [ "$BUILD_AGGREGATE_STATUS" = "others_failed" ]; then
          echo "All jobs failed"
        else
          echo "Some jobs failed"
        fi
      fi
after_script:
  - echo leader=$BUILD_LEADER status=$BUILD_AGGREGATE_STATUS

Limitations/Todo

  • If other jobs will start late, can be global build timeout (think of passing leader role to others, for example who started last is the leader).
  • More flexible leader definition (in matrix not all jobs can publish).
  • Have several leaders, according to flavours (e.g. if in matrix slices responsible for platform).

About

This is travis helper to run particular work only once in matrix

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%