{"action":"created","issue":{"url":"https://api.github.com/repos/drone/drone/issues/1356","repository_url":"https://api.github.com/repos/drone/drone","labels_url":"https://api.github.com/repos/drone/drone/issues/1356/labels{/name}","comments_url":"https://api.github.com/repos/drone/drone/issues/1356/comments","events_url":"https://api.github.com/repos/drone/drone/issues/1356/events","html_url":"https://github.com/drone/drone/issues/1356","id":119098332,"number":1356,"title":"multiple build steps, parallel option","user":{"login":"bradrydzewski","id":817538,"avatar_url":"https://avatars.githubusercontent.com/u/817538?v=3","gravatar_id":"","url":"https://api.github.com/users/bradrydzewski","html_url":"https://github.com/bradrydzewski","followers_url":"https://api.github.com/users/bradrydzewski/followers","following_url":"https://api.github.com/users/bradrydzewski/following{/other_user}","gists_url":"https://api.github.com/users/bradrydzewski/gists{/gist_id}","starred_url":"https://api.github.com/users/bradrydzewski/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bradrydzewski/subscriptions","organizations_url":"https://api.github.com/users/bradrydzewski/orgs","repos_url":"https://api.github.com/users/bradrydzewski/repos","events_url":"https://api.github.com/users/bradrydzewski/events{/privacy}","received_events_url":"https://api.github.com/users/bradrydzewski/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":{"url":"https://api.github.com/repos/drone/drone/milestones/8","html_url":"https://github.com/drone/drone/milestones/Unplanned","labels_url":"https://api.github.com/repos/drone/drone/milestones/8/labels","id":1261089,"number":8,"title":"Unplanned","description":"No plan to fix in any specific release. Note that this doesn't mean we `wontfix`, just that it isn't scheduled for an upcoming release.","creator":{"login":"bradrydzewski","id":817538,"avatar_url":"https://avatars.githubusercontent.com/u/817538?v=3","gravatar_id":"","url":"https://api.github.com/users/bradrydzewski","html_url":"https://github.com/bradrydzewski","followers_url":"https://api.github.com/users/bradrydzewski/followers","following_url":"https://api.github.com/users/bradrydzewski/following{/other_user}","gists_url":"https://api.github.com/users/bradrydzewski/gists{/gist_id}","starred_url":"https://api.github.com/users/bradrydzewski/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bradrydzewski/subscriptions","organizations_url":"https://api.github.com/users/bradrydzewski/orgs","repos_url":"https://api.github.com/users/bradrydzewski/repos","events_url":"https://api.github.com/users/bradrydzewski/events{/privacy}","received_events_url":"https://api.github.com/users/bradrydzewski/received_events","type":"User","site_admin":false},"open_issues":34,"closed_issues":44,"state":"open","created_at":"2015-08-18T17:49:47Z","updated_at":"2016-05-12T19:47:47Z","due_on":null,"closed_at":null},"comments":31,"created_at":"2015-11-26T20:12:17Z","updated_at":"2016-05-13T06:34:20Z","closed_at":null,"body":"I'm proposing the ability to have multiple sub-sections in the `build` section of the yaml like this:\r\n\r\n```\r\nbuild:\r\n  golang:\r\n    image: golang\r\n    commands:\r\n      - go get\r\n      - go build\r\n  node:\r\n    image: node\r\n    commands:\r\n      - npm install\r\n      - npm run test\r\n```\r\n\r\nwith the ability to specify that those sub-steps should run in parallel:\r\n\r\n```diff\r\nbuild:\r\n+  parallel: true\r\n  golang:\r\n    image: golang\r\n    commands:\r\n      - go get\r\n      - go build\r\n  node:\r\n    image: node\r\n    commands:\r\n      - npm install\r\n      - npm run test\r\n```\r\n\r\nwe should provide the ability to limit parallelization. The above example will fanout all steps in parallel. The below example will limit to N parallel steps:\r\n\r\n```diff\r\nbuild:\r\n+  parallel: 4\r\n```\r\n\r\nnote that as an added benefit, we could use the `where` clause to limit when steps are executed. For example, only execute certain builds steps for certain branches, or for certain events (ie not pull request):\r\n\r\n```diff\r\nbuild:\r\n  golang:\r\n    image: golang\r\n    commands:\r\n      - go get\r\n      - go build\r\n  node:\r\n    image: node\r\n    commands:\r\n      - npm install\r\n      - npm run test\r\n+  dist:\r\n+    image: golang\r\n+    commands:\r\n+      - make dist\r\n+      - make deb\r\n+    when:\r\n+      event: push\r\n```\r\n\r\nsome more use cases for the above build steps and `when` clause might be:\r\n\r\n* avoid running certain resource-intensive steps during pull requests\r\n* only run a subset of tests for pull requests, run full test suite on merge\r\n* execute deployment-related steps when not a pull request\r\n\r\n---\r\n\r\nuntil we have the ability to define multiple build sections, the recommended **workaround** is to execute any bash deployment steps inside your build section:\r\n\r\n```\r\nbuild:\r\n  image: golang\r\n  commands:\r\n    - go build\r\n    - go test\r\n    - ./deploy.sh\r\n```\r\n\r\nnote that you may not want to execute certain scripts for pull requests. If the build is a pull request you can look for this environment variable and value: `CI_EVENT=pull_request` "},"comment":{"url":"https://api.github.com/repos/drone/drone/issues/comments/218962966","html_url":"https://github.com/drone/drone/issues/1356#issuecomment-218962966","issue_url":"https://api.github.com/repos/drone/drone/issues/1356","id":218962966,"user":{"login":"tboerger","id":156964,"avatar_url":"https://avatars.githubusercontent.com/u/156964?v=3","gravatar_id":"","url":"https://api.github.com/users/tboerger","html_url":"https://github.com/tboerger","followers_url":"https://api.github.com/users/tboerger/followers","following_url":"https://api.github.com/users/tboerger/following{/other_user}","gists_url":"https://api.github.com/users/tboerger/gists{/gist_id}","starred_url":"https://api.github.com/users/tboerger/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tboerger/subscriptions","organizations_url":"https://api.github.com/users/tboerger/orgs","repos_url":"https://api.github.com/users/tboerger/repos","events_url":"https://api.github.com/users/tboerger/events{/privacy}","received_events_url":"https://api.github.com/users/tboerger/received_events","type":"User","site_admin":false},"created_at":"2016-05-13T06:34:19Z","updated_at":"2016-05-13T06:34:19Z","body":"I'm totally fine with the group attribute "}}