-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
Matrix Builds / Sub-Builds / Parallel Builds #6
Comments
good question. what do you think the Here are the use cases I'd like to cover with sub builds:
Here are some design questions:
Although I think we can draw some inspiration from Travis I do not want to just copy their approach as I think it would limit our capabilities. With Travis your build is heavily tied to a language:
With Drone your build is tied to a Docker image. The image defines the environment. This may seem like a nuance, but this is really important. Drone doesn't care about language. Drone will never dictate which languages you can or cannot use. We need a yaml file that is re-imaged for Docker. I consider this a high priority feature. Hopefully we can get a discussion started here and come up with some options. |
@bradrydzewski great use cases here. Wasn't even thinking about those. One thing that comes to mind is having Docker images that contain all possible versions. For example, A Python Docker image that contains 2.6-3.3 and pypy. User could reference which version to use: script:
- pip2.7 install -r requirements.txt
- python2.7 setup.py test
- pip3.3 install -r requirements.txt
- python3.3 setup.py test I'm pretty sure this isn't the best way. You mentioned sub builds and that got me thinking about: image: base-image
env:
- DEBUG=true
builds:
build:
image: python
env:
- SECRET_KEY=123
script:
- pip install -r requirements.txt
- python setup.py test
services:
- redis
notify:
email:
recipients:
- brad@drone.io
- burke@drone.io But building matrixes, like on Travis, with this will possibly end up with a massive .drone.yml. Travis makes that pretty cool, I just set the versions of the language and additional environment variables. Every environment variable items in the env array trigger individual builds. I think we might be able to find a way to do that with Drone's philosophy. image:
name: python
config:
versions:
- 2.7
- 3.3
env:
- DEBUG=true SECRET_KEY=123
script:
- pip install -r requirements.txt
- python setup.py test
services:
- redis
config:
versions:
- 2.6
- 2.8
notify:
email:
recipients:
- brad@drone.io
- burke@drone.io This example would trigger 4 sub builds one for each version of python with each version of the redis service. Hope this is somewhat useful. |
I really like your suggestion. Instead of "versions" we could call them "tags" which is consistent with the docker terminology:
Do you have any suggestions for a notation that would split a build into parallel tasks? For example, I only want to test against Python2.7, but my tests take a long time, so I want to break them up into suites and run in parallel. We anticipated this change, so our database already supports sub-builds / matrix builds. The real challenge here is the yaml :) |
Good discussion. Just a suggestion though: perhaps, rename the issue because this problem isn't exclusively a python concern. This issue is pertinent to other environments such as NodeJS, Ruby, Erlang/Elixir, etc. Also, 👍 - with Travis (as much as I love it), trying to build https://github.com/exercism/exercism.io/blob/master/.travis.yml is difficult. You have to circumvent the magic with multiple By leaning on docker images (or dockerfiles), seems like single-language builds would be less magical in general and multi-language builds would be less obtuse. |
Hi all. Got directed to this thread by @bradrydzewski giving my £ 0.02 Most important parts i think are :
For deployments its hard to choose when its allowed to do it ( when a certain test passed or all of them ) That's all i can think of at the moment. |
For another example of a tool that is thinking along these lines, check out Test Kitchen's platforms and suites: http://kitchen.ci/docs/getting-started/adding-platform While Kitchen is really thinking in terms of OS versions, the issue here in terms of Rubies or Pythons is really the same thing a level up the stack. |
I don't think the ability to paralellize one build is linked to this issue. As if you want to do that, you need to define (independant) sub-units of your build, which is pretty orthogonal to the idea of running the build multiple time on different environments ... Try not to bloat this issue to much by adding every possible future feature to it. I think it's better to keep busy on one aspect at a time. I think you came up pretty far there by defining to more aspect there: We need the ability to select different 'tags' of an image, and/or the ability to select different version of a service, and/or the ability to run the build with a different set of environments variables, and so on ... I believe all of them could be implemented independently from each other ... |
@benallard I definitely agree I had a great discussion with an Ops lead that suggested adding a matrix section, where the axis could be defined. What does everything this of this proposal?
this would end up producing 8 different sub builds. I think it is probably the most flexible design, but I'd love to hear what others think. note that the matrix parameters should be handled in a similar manner to private environment variables. They can be injected directly in the script (using find / replace) using the |
Looks good to me @bradrydzewski :-) i would go for that. |
@bradrydzewski that's pretty interesting right there. It took me a moment to figure out that the matrix defines the variables and its values, but I think it definitely covers all the cases we previously discussed. |
Looks perfect to me. This is the only features keeping me from using drone right now!
|
An other important addition is to be able to tell which combo's are allowed to fail. I was thinking of the following: Allow all ruby 2.0.0 cases to fail: allowed_fail:
ruby:
- 2.0.0 Allow Ruby 2.0.0 with Puppet 2.7.0 or 3.0.0 to fail allow_fail:
ruby_version:
- 2.0.0
puppet_version:
- 2.7.0
- 3.0.0 Any thoughts about it? |
You should pay attention not mixing a notification issue with a fundamental architecture one ... Do you don't want those test to run, or do you just don't care about their result ? If the former, this should be analysed there, if the later, we should figure out later about the right way to perform this. Anyway, to extend on your idea, it should be possible to define sub-matrices where the build should not be performed. I suggest the following syntax:
This would run all the builds except the 6 excluded ones ... |
This was merged with #159, so I'm continuing discussion here. My use case is as follows:
It seems like the proposals so far don't solve the problem of having multiple projects per git repository. They do deal with the problem of multiple builds per project. Personally I'm skeptical the ideal solution involves sticking purely with
Once again, this does not solve the multiple-projects-per-repository problem (maybe we should continue that discussion in #159), but hopefully it helps with the discussion at hand. |
@gonzojive I don't think this works too well because then you are just picking a scripting language (looks like Python) which creates two problems:
As a side note, if this were a viable solution then something other than nested for-loops would be more readable: python_version = (2.7, 3.2)
redis_version = (2.6, 2.8)
django_version = (3.0, 4.0)
for python, redis, django in itertools.product(python_version, redis_version, django_version):
add_build(python, redis, django) |
I think you can stick with a configuration language, but it'd be good to allow scripting if desired. You can do it in a way that leaves the choice of programming language up to the user. Perhaps the .drone.yml file can include a line like
|
@gonzojive this is definitely a more advanced use case you are proposing. This project is still very young (0.1 alpha release) and the immediate focus is on the more simple use cases that serve 80+% of users. I'm happy to revisit this request in a few months once the project is further along. |
How about the use case of builds with separate deployments? For instance, it might be convenient to keep a project's source and website in the same repo. Then, when the build happens, the website is built and deployed to its server and the source is compiled and that result is uploaded to s3. |
@justone If both of the source and the website sit on the same branch you can use |
@fudanchii Interesting idea. I didn't realize you could have a If multiple builds can be specified, I think it would be good for there to be an environment variable injected into the build so that any deploy or publish can know which one it's working on. |
Wanted to add my +1 to this. I'd like to have a situation where I can define multiple images (Ubuntu versions) to test my software. Something like this makes sense to me:
|
@justone yes you can have multiple deployment entries in the yaml (ie ssh and git). We loop through each entry and execute. |
@bradrydzewski Adding my +1 to this. I'd also like to see this support parallelization. I think it would be a subsection to 'script', where you define which container to run a test in. I've modified your example above to illustrate it: image: python:{{ python_version }} env: - DEBUG=true - SECRET_KEY=123 - DJANGO={{ django_version }} script: container1: - pip install -r requirements.txt - python setup.py test container2: - pip install -r requirements.txt - python setup.py test services: - redis:{{ redis_version }} matrix: python_version: - 2.7 - 3.2 redis_version: - 2.6 - 2.8 django_version: - 3.0 - 4.0 Love to hear other's thoughts on this too. |
I was speaking with someone yesterday about this, and he suggested we might approach this with multiple YAML docs in a single .drone.yml Something like this:
Obviously, all the options could be different between the two docs, and it would probably be easier to implement a second build using the existing code rather than restructure into a matrix style. |
@Linuturk I like that duplicating gives you more flexibility, but I feel 90% of use cases would just be duplicate configuration. For instance, if I wanted to run the build in 5 containers, I now have 5 portions of the YAML file where only the script section changes. |
@davidak there are no restrictions as to how or where matrix parameters get injected into the yaml file. You could test multiple distros by doing something like this:
The ability to inject parameters with |
@os12 you will be able to invoke distinct scripts using the following notation:
and you could inject environment variables like this:
I'm pretty confident that all use cases are supported with the proposed yaml format and injection strategy proposed in #6 (comment). |
Both look good. Thanks Brad!
|
quick screencast of Drone running matrix builds from the command line: https://twitter.com/droneio/status/577496429242912769 |
@bradrydzewski that's great to see, great work! |
Any update on when this is going to land? |
yes, I expect to have a working |
@bradrydzewski Will this pull request also allow for dependant builds (i.e. project b should be built after project a)? I think this is a bit different than a matrix build if I understand correctly. |
@stevenpall we are launching a new plugin model (included with the matrix feature) that would allow you to augment builds. I think this dependant builds could probably be added as a plugin. |
+1 Refreshing approach to the build matrix. It's nice to see that they can be include in the configuration file and injected into the build environment. |
@bradrydzewski, any plans (dates) for release of this feature ? |
@romani the 0.4 branch includes matrix builds, but it is still a bit too unstable and undocumented for people to start using. The 0.4 release, however, is still planned for this month |
👍 |
1 similar comment
+1 |
just wanted to give a quick update here.... I gave an implementation overview and live demo in last week's Rancher meetup of upcoming matrix build functionality. Link to the youtube recording: |
WOW. This looks pretty cool (not only the matrix build, everything). Can't wait for the release :) |
@bradrydzewski I haven't had the chance to watch the video but is there a doc specifying a build env/commands to build and try 0.4? Once I get that far I'll be able to help as much as possible but figuring it out on my own is too much time for me. |
@mjschultz as far as I know the only documentation is in this issue |
Merged into master. Note that this is the initial implementation of matrix builds. Now everyone can start following the open issue for parallal matrix builds (#1254) targeted for the 0.4.1 release 😄 You can find the matrix documentation here: Enjoy! |
I'm wondering how would a .drone.yml would look if you'd want to test with multiple versions of Python, like for example, using Tox?
The text was updated successfully, but these errors were encountered: