springernature / halfpipe

CLI for interacting with halfpipe
BSD 3-Clause "New" or "Revised" License
12 stars 3 forks source link

simplify update-pipeline feature #9

Closed robwhitby closed 5 years ago

robwhitby commented 5 years ago

At the moment the update-pipeline job does the following:

This means that if the pipeline has changed, only the new version is left enabled. This prevents new jobs running against old versions (e.g. if you add a deploy to live stage it won't run against an old version).

If the pipeline has not changed, we re-enable old versions because otherwise a previous version "in progress" will not continue to the next jobs.

Now that Concourse has the concept of 'pinning' resources, we can instead pin the version to the latest and then un-pin if the pipeline has not changed.

Update job runs this script: https://github.com/springernature/halfpipe-update/blob/master/halfpipe-update-docker/update-pipeline

robwhitby commented 5 years ago

new behaviour:

For now the new behaviour is only enabled for pipelines in team engineering-enablement for testing.

robwhitby commented 5 years ago

I am pausing this for a bit because concourse team are working on more improvements to pinning.

robwhitby commented 5 years ago

ok I have ditched using pinning completely because it wasn't quite the right fit. Pinning means only one version is active at a time. We don't really want this, because it means every time we pin we would stop an older run from proceeding, and unpinning is risky because it might cause an old build to trigger.

Instead of pinning I have gone back to using the enable/disable feature of versions, but have simplified how it works so we make less api calls and never enable old versions like it did before.

  1. Pause the pipeline. We might be about to change the pipeline, so stop new builds triggering until we're finished.

  2. Run halfpipe upload

  3. If we just changed the pipeline, disable all older versions. This prevents any new jobs triggering immediately with a previous version.

  4. Unpause the pipeline.

Currently this is enabled for pipelines in the engineering-enablement team

robwhitby commented 5 years ago

A simpler beta version is now running for engineering-enablement pipelines. No more pausing/unpausing on every run.

  1. Check if pipeline has changed. Exit (success) if there are no changes.

If the pipeline has changed:

  1. Disable all versions except the current version. This prevents any new jobs we are about to create from triggering immediately with a previous version.

  2. Update the pipeline.