Pipeline pagination on the Search page
<p>We’ve recently added pagination to the pipelines on the Search page!</p><figure class="tmblr-full" data-orig-height="434" data-orig-width="1152"><img src="https://66.media.tumblr.com/09bf11608449fc6b6214a86519a4b34e/tumblr_inline_pfdh14eDiF1uvhog4_540.gif" data-orig-height="434" data-orig-width="1152"/></figure><p>Before pipeline pagination, when a user visited the Search page (e.g. /search), all pipelines were fetched from the API and sorted alphabetically in the UI. In order to improve the total page load time, we moved the burden of pagination from the UI to the API. Now, when a user visits the Search page, only the first page of pipelines is fetched by default. Clicking the Show More button triggers the fetching of the next page of pipelines.</p><p>All the pagination and search logic is moved to the datastore, so the overall load time for fetching a page of search results is under 2 seconds now as compared to before where some search queries could take more than 10 seconds.</p><h2>Screwdriver Cluster Admins</h2><p>In order to use these latest changes fully, Screwdriver cluster admins will need to do some SQL queries to migrate data from <code>scmRepo</code> to the new <code>name</code> field. This <code>name</code> field will be used for sorting and searching in the Search UI.</p><p><b>Without migrating</b></p><p>If no migration is done, pipelines will show up sorted by <code>id</code> in the Search page. Pipelines will not be returned in search results until a <code>sync</code> or <code>update</code> is done on them (either directly from the UI or by interacting with the pipeline in some way in the UI).</p><p><b>Steps to migrate</b></p><p>1. Pull in the new API (<b>v0.5.466</b>). This is necessary for the <code>name</code> column to be created in the DB.</p><p>2. Take a snapshot or backup your DB.</p><p>3. Set pipeline <code>name</code>. This requires two calls in postgres: one to extract the pipeline name data, the second to remove the curly braces (<code>{</code> and <code>}</code>) injected by the regexp call.</p><p>In postgresql, run:<br/></p><pre><code>UPDATE public.pipelines
SET name = regexp_matches("scmRepo", '.*name":"(.*)",.*')
</code></pre><pre><code>UPDATE public.pipelines
SET name = btrim(name, '{}')</code></pre><p>4. Pull in the new UI (<b>v1.0.331</b>).</p><p>5. <i>Optionally, you can post a banner at to let users know they might need to sync their pipelines if it is not showing up in search results. Make an <a href="https://api.screwdriver.cd/v4/documentation">API call</a> to <code>POST /banners</code> with proper auth and body like:</i></p><pre><code>{
"message": "If your pipeline is not showing up in Search results, go to the pipeline Options tab and Sync the pipeline.",
"isActive": true,
"type": "info"
}
</code></pre><p><b>Compatibility List</b></p><p>The Search page pipeline pagination requires the following minimum versions of Screwdriver:</p><ul><li><a href="https://hub.docker.com/r/screwdrivercd/screwdriver/tags/">API</a>: v0.5.466</li>
<li><a href="https://hub.docker.com/r/screwdrivercd/ui/tags/">UI</a>: v1.0.331</li>
</ul><p><b>Contributors</b></p><p>Thanks to the following people who made this feature possible:</p><ul><li><a href="https://github.com/screwdriver-cd/screwdriver/commits?author=tkyi">tkyi</a></li>
</ul><p><i>Screwdriver is an open-source build automation platform designed for Continuous Delivery. It is built (and used) by Yahoo. Don’t hesitate to reach out if you have questions or would like to contribute: <a href="http://docs.screwdriver.cd/about/support.">http://docs.screwdriver.cd/about/support.</a></i></p>