Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RFC: set_pipeline step #31

Merged
merged 7 commits into from
Jun 24, 2020
Merged
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
120 changes: 120 additions & 0 deletions 031-set-pipeline-step/proposal.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
# Summary

This RFC proposes a new `set_pipeline` step type for configuring pipelines within a build plan.


# Motivation

## Short-term motivation

Lots of folks are already using the [`concourse-pipeline` resource](https://github.com/concourse/concourse-pipeline-resource), however the resource has two fatal flaws:

* Users have to configure a local auth user and pass it to the resource definition.
* The resource is versioned independently of the user's Concourse, meaning the `fly` version won't always be in sync. The resource makes an attempt to resolve this by doing a `sync` after logging in, but this is a pretty clunky problem regardless.

If we had native support for a `set_pipeline` step, both of these problems would go away.

## Long-term motivation

By having a `set_pipeline` step in the build plan, we can start to improve Concourse's story around automating the full CI stack for projects of all sizes. Users can start to trust that pipelines are always configured via CI, and they can go over the build history to see who changed what and when.

Later RFCs (namely, 'projects' and 'instanced pipelines') will build on this idea to provide a truly continuous workflow for automating pipelines - including their automatic archival when they're no longer needed, in the case of instanced pipelines.


# Proposal

Using the step would look something like this:

```yaml
plan:
- get: ci
- set_pipeline: concourse
file: ci/pipelines/concourse.yml
```

The `x` in `set_pipeline: x` is the pipeline name, and `file:` would be used to specify the pipeline config.

The pipeline would be configured within whichever team the build execution belongs to.

Upon first configuration pipeline will be automatically unpaused, as opposed to `fly set-pipeline` which puts newly configured pipelines in paused state by default. The assumption here is that if you're automating `set_pipeline` you're not just kicking the tires and can probably trust the pipelines that you're configuring are correct, at least enough to have made it into version control.

When configuring an existing pipeline, however, the pipeline's paused status will not be changed. In other words, the `set_pipeline` step will leave already-existing paused pipelines in the paused state. The assumption here is that the pipeline has been manually paused by a pipeline operator, possibly in response to an emergent situation, and it should be left alone.

## `((vars))` support

Additionally, we should support `vars` (as in `fly set-pipeline -y`) and `var_files` (i.e. `fly set-pipeline -l`):

```yaml
plan:
- get: ci
- set_pipeline: release
file: ci/pipelines/release.yml
vars: {release_version: 5.3}
var_files:
- ci/pipelines/vars/foo.yml
```

# Open Questions

* Should we prevent pipelines configured via a `set_pipeline` step from being
updated manually through `fly set-pipeline`?

Or should we emit a warning?

* Should we support glob expansion in `var_files`?

The `concourse-pipeline` resource supports this by just performing glob
expansion against its local filesystem. For the `set_pipeline` step, this is
a bit more challenging - there *is* no local filesystem. Would we have to
implement glob expansion in the Baggageclaim API or something? How easily
would this translate to other runtimes?

* `set_pipeline: self`

Currently, the `foo` in `set_pipeline: foo` is the name of a pipeline to set.
A pipeline could technically update itself by configuring its own name in the
step, but pipeline configs aren't meant to contain their own name, as doing
so prevents the config from being re-used as a 'pipeline template'.

Are self-updating pipelines a feature that we want to explicitly support by
allowing the keyword `self` in place of the pipeline name?

The [Projects RFC][projects-rfc] outlines a more 'git-ops' style flow for
configuring pipelines, where instead of having pipelines self-update they are
all configured in one central place (the project's `plan:`).

Pros:

* Fairly straightforward semantics which seem to support a natural follow-up
question after learning about the `set_pipeline` step.
* Keyword use has precedent in `version: every`/`version: latest`/`inputs: all`.

Cons:

* Supporting both self-updating pipelines and projects could cause confusion
and fragmentation; it doesn't seem wise to have two competing approaches to
the same goal.
* Given that `self` isn't *critical* (it's easy to work around through
templating, i.e. `set_pipeline: ((name))`), is it worth the
risk/maintenance?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have multiple teams and 100s of pipelines coming from multiple git repos. We are addressing fly sp workflow for all changes to pipelines ymls with pipeline_resource and/or a custom built resource with fly binaries listening on these pipelines files/folders.
Even though we do not have strong preference for using either pipeline name or self as set_pipeline values( Good that we support both :) ), we are really excited for the set_pipeline plan. We also go through lot of compliance/audit related activities periodically and pipeline config changes being tracked in the same git repo as the pipeline definitions will help a lot.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have a relatively small set of pipelines, so both ways are ok for us. Honestly, I like the self build in reference it is clean, straightforward, and easy to deal with.



# Answered Questions

none


# New Implications

## Deprecating `concourse-pipeline` resource

Deprecating the `concourse-pipeline` resource should be the primary goal.
vito marked this conversation as resolved.
Show resolved Hide resolved

Some of the extended functionality of the resource will not be supported in the name of keeping the `set_pipeline` step design simple and easy to reason about.

For example, the step should only ever configure one pipeline at a time - it should not support the `pipelines:` functionality for configuring a bunch at once.
vito marked this conversation as resolved.
Show resolved Hide resolved

Similarly, the step should not support fully dynamic configuration (`pipelines_file:`).
vito marked this conversation as resolved.
Show resolved Hide resolved
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi !
I'd like to to know which part of 'concourse-pipeline-resource' dynamic configuration do you plan to implement ? It could be great to have all "keys" (var_files, team, config_file, vars, unpaused and exposed) except as you said pipelines.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So far, vars and var_files are implemented, config_file is the same as file:, unpaused is just forced as true, team is experimentally supported (collecting feedback here: concourse/concourse#5731), and exposed has just been proposed (https://github.com/concourse/rfcs/discussions/75).

Copy link

@o-orand o-orand Sep 15, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for answering!
I should have miss something about dynamic configuration of set_pipeline. For me, dynamic config was like file for task (https://concourse-ci.org/config-basics.html#schema.file-path), or https://github.com/concourse/concourse-pipeline-resource#dynamic for a single pipeline. So, is it possible to generate set_pipeline config using previously executed task, for instance to select var_files to apply ?



[projects-rfc]: https://github.com/concourse/rfcs/pull/32