<p>Min Zhang, Software Engineer, Verizon Media</p>
<p>Tiffany Kyi, Software Engineer, Verizon Media</p>
<p>Previously you were limited having one screwdriver.yaml at root per SCM repository. This prevented users from running workflows based on subdirectories in a <a href="https://developer.atlassian.com/blog/2015/10/monorepos-in-git">monorepo</a>. Now, you can specify a custom source directory for your pipeline, which means you can create multiple pipelines on a single repository!</p>
<h2>Usage</h2>
<p>The directory path is relative to the root of the repository. You must have a <code>screwdriver.yaml</code> under your source directory.</p>
<h2>Example</h2>
<p>Given a repository with the file structure depicted below:</p>
<pre><code>┌── README.md
├── screwdriver.yaml
├── myapp1/
│ └──test.js ...
├── myapp2/
│ ├── app/
│ │ ├── main.js
│ │ ├── ...
│ │ └── package.json
│ └── screwdriver.yaml
│
...
</code></pre>
<p><b>Create pipeline with source directory</b></p>
<figure class="tmblr-full" data-orig-height="732" data-orig-width="1522" style=""><img src="https://66.media.tumblr.com/1ea6999f72bf6ec56504ebfed9453b81/tumblr_inline_ps0u4pn0bh1uwpze1_540.png" data-orig-height="732" data-orig-width="1522"/></figure><p><b>Update pipeline with source directory</b></p>
<figure class="tmblr-full" data-orig-height="550" data-orig-width="1624" style=""><img src="https://66.media.tumblr.com/f01d1c6bfbe29007deb49e7a93b36d14/tumblr_inline_ps0u4yQZtX1uwpze1_540.png" data-orig-height="550" data-orig-width="1624"/></figure><p>In this example, jobs that <code>requires: [~commit, ~pr]</code> will be triggered if there are any changes to files under <code>myapp2</code>.</p>
<h2>Caveats</h2>
<ul><li>This feature is only available for the <a href="https://github.com/screwdriver-cd/scm-github">Github SCM</a> right now.</li>
<li>If you use <code>sourcePaths</code> together with custom source directory, the scope of the <code>sourcePaths</code> is limited to your source directory. You can not listen on changes that are outside your source directory. <b><i>Note</i></b> the path for your <code>sourcePaths</code> is relative to the root of the repository not your source directory.</li>
</ul><p>For example, if you want to add sourcePaths to listen on changes to <code>main.js</code> and <code>screwdriver.yaml</code>, you should set:</p>
<pre><code>sourcePaths: [myapp2/app/main.js, myapp2/screwdriver.yaml]
</code></pre>
<p>If you try to set <code>sourcePaths: [app/main.js]</code>, it will not work, as it is missing the source dir <code>myapp2</code> and you cannot set a relative source path. If you try to set <code>sourcePaths: [myapp1/test.js]</code>, it will not work, as it is outside the scope of your source directory, <code>myapp2</code>.</p>
<ul><li>The <code>screwdriver.yaml</code> must be located at the root of your custom source directory.</li>
</ul><h2>Compatibility List</h2>
<p>In order to use this feature, you will need these minimum versions (please read the note above):</p>
<ul><li>[API] (<a href="https://hub.docker.com/r/screwdrivercd/screwdriver">https://hub.docker.com/r/screwdrivercd/screwdriver</a>) - v0.5.692</li>
<li>[UI] (<a href="https://hub.docker.com/r/screwdrivercd/ui">https://hub.docker.com/r/screwdrivercd/ui</a>) - v1.0.425</li>
<li>[Launcher] (<a href="https://hub.docker.com/r/screwdrivercd/launcher">https://hub.docker.com/r/screwdrivercd/launcher</a>) - v6.0.4</li>
</ul><h2>Contributors</h2>
<p>Thanks to the following contributors for making this feature possible:</p>
<ul><li><a href="https://github.com/minz1027">minz1027</a></li>
<li><a href="https://github.com/tkyi">tkyi</a></li>
</ul><p>Questions & Suggestions
We’d love to hear from you. If you have any questions, please feel free to reach out <a href="https://docs.screwdriver.cd/about/support">here</a>. You can also visit us on <a href="https://github.com/screwdriver-cd">Github</a> and <a href="https://slack.screwdriver.cd">Slack</a>.</p>