Freeze Windows and Collapsed Builds
<p><a href="https://www.linkedin.com/in/minzhang0898/">Min Zhang</a>, Software Dev Engineer, Verizon Media</p>
<p><a href="https://www.linkedin.com/in/pranavrc/">Pranav Ravichandran</a>, Software Dev Engineer, Verizon Media</p>
<h2>Freeze Windows</h2>
<p>Want to prevent your deployment jobs from running on weekends? You can now freeze your <a href="https://screwdriver.cd/">Screwdriver</a> jobs and prevent them from running during specific time windows using the <code>freezeWindows</code> feature. Screwdriver will collapse all the frozen jobs inside the window to a single job and run it as soon as the window expires. The job will be run from the last commit within the window.</p>
<!-- more -->
<p><b>Screwdriver Users</b></p><p>
The <code>freezeWindows</code> setting takes a cron expression or a list of them as the value.
Caveats:</p>
<ul><li>Unlike <code>buildPeriodically</code>, <code>freezeWindows</code> should not use <a href="https://en.wikipedia.org/wiki/Cron#Non-standard_characters">hashed time</a> therefore the symbol <code>H</code> for hash is disabled.</li><li>The combinations of day of week and day of month are invalid. Therefore only one out of day of week and day of month can be specified. The other field should be set to <code>?</code>.</li><li>All times are in UTC.</li></ul><p>In the following example, <code>job1</code> will be frozen during the month of March, <code>job2</code> will be frozen on weekends, and <code>job3</code> will be frozen from 10 PM to 10 AM.</p>
<pre><code>shared:
image: node:6
jobs:
job1:
freezeWindows: ['* * ? 3 *']
requires: [~commit]
steps:
- build: echo "build"
job2:
freezeWindows: ['* * ? * 0,6,7']
requires: [~job1]
steps:
- build: echo "build"
job3:
freezeWindows: ['* 0-10,22-23 ? * *']
requires: [~job2]
steps:
- build: echo "build"
</code></pre>
<p>In the UI, jobs within the freeze window appear as below (deploy and auxiliary):</p>
<figure data-orig-width="1114" data-orig-height="598" class="tmblr-full"><img src="https://66.media.tumblr.com/5fe090bd39c8f0dede3eb40462372d51/tumblr_inline_pnhyq2qMVO1uwpze1_540.png" alt="image" data-orig-width="1114" data-orig-height="598"/></figure><h2>Collapsed Builds</h2>
<p>Screwdriver now supports collapsing all <code>BLOCKED</code> builds of the same job into a single build (the latest one). With this feature, users with concurrent builds no longer need to wait until all of them finish in the series to get the latest release out.</p>
<p><b>Screwdriver Users</b></p>
<p>To opt in for <code>collapseBuilds</code>, Screwdriver users can configure their <code>screwdriver.yaml</code> using annotations as shown below:</p>
<pre><code>jobs:
main:
annotations:
screwdriver.cd/collapseBuilds: true
image: node:8
steps:
- hello: echo hello
requires: [~pr, ~commit]
</code></pre>
<p>In the UI, collapsed build appears as below:</p>
<figure data-orig-width="1116" data-orig-height="462" class="tmblr-full"><img src="https://66.media.tumblr.com/9b1aecffe3264229ec7e537c92c3496c/tumblr_inline_pnhyqjOF5o1uwpze1_540.png" alt="image" data-orig-width="1116" data-orig-height="462"/></figure><p><b>Cluster Admin</b></p>
<p>Cluster admin can configure the default behavior as collapsed or not in <a href="https://github.com/screwdriver-cd/queue-worker/blob/master/config/custom-environment-variables.yaml#L182">queue-worker configuration</a>.</p>
<h2>Compatibility List</h2>
<p>In order to use freeze windows and collapsed builds, you will need these minimum versions:</p>
<ul><li><a href="https://hub.docker.com/r/screwdrivercd/screwdriver">API</a> - v0.5.578</li>
<li><a href="https://hub.docker.com/r/screwdrivercd/queue-worker">Queue-worker</a> - v2.5.2</li>
<li><a href="https://hub.docker.com/r/screwdrivercd/buildcluster-queue-worker">Buildcluster-queue-worker</a>:v1.1.8</li>
</ul><h2>Contributors</h2>
<p>Thank you 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/pranavrc">pranavrc</a></li>
</ul><h2>Questions & Suggestions</h2>
<p>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>