Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conditional build stages and job pruning #50

Closed
SamMousa opened this issue Apr 6, 2018 · 4 comments
Closed

Conditional build stages and job pruning #50

SamMousa opened this issue Apr 6, 2018 · 4 comments

Comments

@SamMousa
Copy link

SamMousa commented Apr 6, 2018

I'm trying to improve CI performance by pruning jobs.

Consider a situation where I have 30 jobs (5 php versions, 6 modules that need testing).
Based on the project setup I'm sure that if changes are limited to 1 module there is no need to test the other 5 modules.
I can easily identify what changes have been made (git diff --name-only ...).

I'd like to be able to run a prune stage that executes my code, then based on the outcome (re)evaluates job conditions.
My pruning stages could for example set environment variables, but the issue is that at that point the jobs have already been created / scheduled.

Currently the only solution is to do this check before each job, which is a small optimization but still requires Travis to prep VMs and clone the repository for each job...

@kenman345
Copy link

I dont know if this solves all the things you wish to fix, but have you considered perhaps making your different jobs/stages check whether it needs to run and have that as an if statement in the builds? If they dont need to be run, then it would skip over running the tests and just pass that job. this can easily be done with a bash script in your tests as well.

Right now I am not aware of anything that allows you to set a condition that checks the commits themselves to see what to run, but perhaps it could be possible in the future.

@SamMousa
Copy link
Author

I do that now but it wastes a lot of resources; 20 jobs which still take 2 minutes each for doing nothing..

@batter
Copy link

batter commented Jul 12, 2018

I think this could be done easily if we had the ability to set and share ENV variables across build stages. I made a comment on the build stages open PR saying as much.

Since build stages already has the ability to execute jobs or stages conditionally, you the idea is that you could set an ENV variable in your first stage, and then use it within the conditional evaluation as to whether or not to execute the subsequent job(s) or stage(s).

@joshk
Copy link
Contributor

joshk commented Aug 2, 2018

As Stages is now released and GA, I'm going to close this issue.

If you have any feedback on improvements we should consider, please feel free to add a discussion in our new Community forum: https://travis-ci.community/c/product

Happy building

Josh

@joshk joshk closed this as completed Aug 2, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants