Repository navigation
feat(atc): add set_pipeline step. - #4708
Conversation
bbf0e08 to
734211d
Compare
ee7d492 to
b730f8d
Compare
|
So far, I have made the feature functional and the existing unit tests pass. @Twiknight also has done UI part changes, unit tests not added yet. Highlights of the change:
The web UI looks like below. As you can see, pipeline diff is shown on the UI. Maybe we need a new icon for the @pivotal-jwinters and @vito Can you guys please take an initial review. If no significant comments, we'll start to add unit test cases. For this feature, maybe a testflight case is deserved. |
7a03af2 to
3ee994b
Compare
vito
left a comment
There was a problem hiding this comment.
Awesome! This is the first step on our v10 roadmap so this is a pretty momentous occasion. 🙂
FWIW, I also had started on this a while back - mainly as a test of our contributor experience with adding a new step type. I wanted to find all the 'gotcha' places that the compiler couldn't help me find in hopes of being able to refactor those areas in the future.
If my changes are of any use to you for comparison, you can find them on the feature/set-pipeline-step branch - here's the diff. I snuck in some refactors along the way. Selfishly I would like to see some of those refactors here too but I'm happy to submit those as separate PRs. (I probably should have done that in the first place.)
This wip commit message has a few breadcrumbs for what I was working on.
Here's a tl;dr of my feedback:
- We should avoid using
paramsfor core step types; I think it's important for that field to only ever be used as opaque schema-less config passed to resources/prototypes- use the
xinset_pipeline: xas the pipeline name - use step-level
file:(same field as task step) for specifying the pipeline config - use step-level
vars:(same field task step) for specifying pipeline vars - introduce step-level
vars_files:(instead ofload_vars_from) - but IMO only if necessary. Do you need it for your own pipelines?
- use the
- I'm +1 with handling
selfto set the current pipeline, but I wonder if thatselfsyntax can be resolved to a pipeline name before we're running the step. - I don't think we should have a
fail_when_no_diff; it should just succeed. - We can introduce generic initialize/start/finish events so we don't have to keep adding these 3 events for each step. It'd be nice if the web UI just had 3 events to handle for updating any step's progress in the UI.
- There are various refactorings I'd like to see from my fork, but I don't expect you to do them. They're there if you want to steal the code, or I can just submit PRs for them later (or maybe even to your fork).
Thanks again for starting on this! Super cool to see our roadmap being pushed forward by the community. 🎊
|
Also, since this started through the RFC process, we'll need to finish it through the RFC process as well: https://github.com/concourse/rfcs#resolution It's fine to start working on it ahead of time, we just need to make sure what we actually deliver lines up with what everyone agreed on through the RFC. I don't expect any trouble here, it's just due diligence. I'll try and finalize all of my v10 RFCs and start the resolution process soon, which will involve a blog post announcing it. I'll make note of this PR too. 🙂 |
|
Big +1 on generic step events - our consumers of those events care about the different step types really. Like fly does show the task config before a task step but that could be made generic, I think. |
ed4cc5b to
2ba2ab9
Compare
vito
left a comment
There was a problem hiding this comment.
thanks for porting over some of the refactors! 👍
|
@vito I just addressed all current review comments for backend. UI change is still ongoing. edit: UI part change has been done by @Twiknight. Most of UI changes are picked up from your commit. I have also added a testflight test for the edit: I also created a PR for |
9b20633 to
0c72889
Compare
| case planConfig.SetPipeline != "": | ||
| name := planConfig.SetPipeline | ||
| if name == "self" { | ||
| name = job.PipelineName() |
There was a problem hiding this comment.
Does the db.Job get threaded through everywhere just so we can do this?
There was a problem hiding this comment.
@pivotal-jwinters Sorry for my English. I don't quite get your point. Can you please explain more? And what's your suggestion?
There was a problem hiding this comment.
@evanchaoli sorry my fault, I should have been more clear. It just seems like there are a lot of changes that need to be made in order to pass the db.Job object all the way down to this low level. I just wanted to confirm that the db.Job object is only needed because of the pipeline name, and if it is, maybe there's a simpler way of getting that info here.
There was a problem hiding this comment.
@pivotal-jwinters Yeah, I wonder a simpler way too. Here the entry point is method buildFactory.Create. Obviously we cannot store a db.Job object in buildFactory because it is global and stateless. I initially thought to add pipelineName as an extra parameter to buildFactory.Create, but that would also need to thread the extra parameter through a lot of levels. So I decided to change the first parameter from JobConfig to Job, which at least keep count of parameters unchanged, and it make future change easier if some other info of job/pipeline is needed at any level.
There was a problem hiding this comment.
@pivotal-jwinters Yeah, I ultimately suggested this so that we don't have to deal with interpreting self at the plan/step-level. Using the job here feels OK to me since it's at the pipeline/job -> plan translation stage and keeps us from having to pass pipeline information down to the generic plan/step types.
I guess I didn't anticipate the impact this would have on the tests though (having to pluck .Config off everywhere). To be honest these tests are already super high-maintenance so I guess it's not too surprising. I remember wanting to find a way to get better value out of how we test this stuff at some point.
There was a problem hiding this comment.
@pivotal-jwinters The problem with waiting until everything is done perfectly is that we withold useful features in the short-term for the sake of having everything perfect in the long-term. In the meantime, users who try Concourse may be disappointed by the lack of basic functionality, and may just use something else. Remember, we're not here to just strive for a perfect design, we're working on software for people to use, and those users exist today. It doesn't help anyone if Concourse v10 finally ships but by then everyone has adopted other solutions that addressed their needs more quickly.
My point was that this could have been a useful MVP before we even came up with the idea for 'projects'. By getting that MVP out more quickly we would have at least met the basic needs of users already and collected useful feedback/information about how it's used. Maybe we would have even come up with a different idea. Maybe we would have come up with 'projects' and ultimately deprecated set_pipeline: self. Who knows?
We're lucky to have a pretty far view of the future plans right now - but I don't think we should let that long-term vision cheat us and our users out of short-term wins if we can also identify a transition from the short-term to the long-term. We need to balance our ideal roadmap with the time it takes to get there, and be conscious of the fact that not many of those features in the roadmap have been put in front of actual users yet.
At this point this discussion is more attached to ideology than technical details - in this case the basic functionality is still there, and at the end of the day we're debating a feature that's easy to replace with simple templating. I just think it's been a mistake of ours to continuously chase "perfect" at the expense of "good". We're going to have to be able to continuously iterate on, refactor, and deprecate Concourse functionality regardless. I think it's something to become good at, not something to avoid.
The problem with that approach is that it makes maintaining the code and making changes towards our actual roadmap much more difficult.
I agree in general but honestly this is a pretty simple thing to reason about and implement. The code diff is super inflated by the test setup, and those tests were already known to be a pain in the butt to maintain and of questionable value.
Especially when all we're doing is hazarding a guess at how users might use this feature.
It's not a guess, this is a user-requested feature that was made before this RFC was even known about. 😅 It was also a use case that has been discussed at length in #1200. If anything is guess right now, it's Projects.
To be honest, I don't really have a horse in this race. I don't think we should include it if no one's asking for it, but a user has asked for it, and I think it's justifiable.
I'm going to move this point under "open questions" so we can collect more feedback on it. Right now we seem to have 4 strongly opinionated people here and I'd rather wait until we can align on something before just making a snap decision one way or another. I would like to hear more from other people on this subject and just make sure everyone is aware of the trade-offs either way.
There was a problem hiding this comment.
@vito I'm not suggesting we wait for perfect, I'm suggesting we make small incremental changes and see how people use them.
I agree in general but honestly this is a pretty simple thing to reason about and implement.
I actually don't see it that way at all. We're taking what used to be static configuration and now saying that it can be updated at any point out from under us. That's breaking a very large boundary IMO.
Reading through #1200 it seems like the majority of people are asking for gitops. That seems like a much larger endorsement for projects than self-aware pipelines (at least to me anyway).
There was a problem hiding this comment.
I'm not suggesting we wait for perfect, I'm suggesting we make small incremental changes and see how people use them.
Fair.
I actually don't see it that way at all. We're taking what used to be static configuration and now saying that it can be updated at any point out from under us. That's breaking a very large boundary IMO.
I guess I just don't really see that boundary as being broken in a unique way by allowing self. Pipelines can always change at any point, whether it's user-initiated, initiated by a Project, initiated by a separate pipeline using set_pipeline, or initiated by the same pipeline, either by using self or by being given its own name. Concourse has had to support this since day 1 - it's why builds and their build plans are decoupled from pipelines.
There was a problem hiding this comment.
@evanchaoli implementing a feature with a plan to deprecate it down the road doesn't seem like a very sustainable approach to me.
@pivotal-jwinters I would predict that self will not be deprecated in a viewable long term. As I suggested in last comment, we can disable self in Projects, but keep self for standalone pipelines. Have anything been planed to deprecated standalone pipeline and enforce all pipelines to reside under projects?
Especially when all we're doing is hazarding a guess at how users might use this feature.
Why do you consider "self" as a guessed feature? This PR is contributed by a REAL user. I have stated clearly that, I, AS A USER, need self. My motivation was only set_pipeline: self rather than set_pipeline: other_pipeline. I'm not randomly picking up some issue and contribute, I implement something by myself because our users need it, and we cannot see when that can be done from Concourse side. I represent a large group of users behind me.
There was a problem hiding this comment.
I've added this under 'Open Questions' here: https://github.com/vito/rfcs/blob/set-pipeline-step/031-set-pipeline-step/proposal.md#open-questions
vito
left a comment
There was a problem hiding this comment.
Small things now. 🙂
Thanks for adding a testflight test! Are you waiting on concourse/mock-resource#3 before adding tests for the vars stuff? (I noticed nothing uses it yet.)
| case planConfig.SetPipeline != "": | ||
| name := planConfig.SetPipeline | ||
| if name == "self" { | ||
| name = job.PipelineName() |
There was a problem hiding this comment.
@pivotal-jwinters Yeah, I ultimately suggested this so that we don't have to deal with interpreting self at the plan/step-level. Using the job here feels OK to me since it's at the pipeline/job -> plan translation stage and keeps us from having to pass pipeline information down to the generic plan/step types.
I guess I didn't anticipate the impact this would have on the tests though (having to pluck .Config off everywhere). To be honest these tests are already super high-maintenance so I guess it's not too surprising. I remember wanting to find a way to get better value out of how we test this stuff at some point.
@vito Once the mock-resource PR is merged, I can add |
173958a to
149a8d5
Compare
commented
Nov 21, 2019
|
@vito @pivotal-jwinters @kcmannem Looks like it's hard to reach an agreement if or not "self" should be supported, while I believe we all agree that "set-pipeline" is very useful. To unblock this PR, I have removed "self". Please consider to include this PR in release 6.0.0. Once this PR is merged, I'll create a new PR to add "self" back, then you guys may take time to decide if or not accept that PR. |
a030e01 to
32ab00e
Compare
Signed-off-by: Chao Li <[email protected]>
Signed-off-by: Chao Li <[email protected]>
Signed-off-by: Chao Li <[email protected]>
Signed-off-by: Chao Li <[email protected]>
Signed-off-by: Chao Li <[email protected]>
…9/2019 Signed-off-by: Chao Li <[email protected]>
Signed-off-by: Jinpeng Li <[email protected]>
Signed-off-by: Chao Li <[email protected]>
Signed-off-by: Chao Li <[email protected]>
Signed-off-by: Chao Li <[email protected]>
Signed-off-by: Chao Li <[email protected]>
Signed-off-by: Twiknight <[email protected]>
Signed-off-by: Chao Li <[email protected]>
Signed-off-by: Chao Li <[email protected]>
32ab00e to
4b00001
Compare
left a comment
There was a problem hiding this comment.
@evanchaoli Sorry for the wait - this latest iteration looks good to me! Tried it out manually and didn't find any issues. I'm going to merge this in and submit a separate PR that adds a warning notice when the step runs, since I don't think we want to fully support it until the RFC process completes. I'll start adding documentation and label it 'experimental' there too.


Existing Issue
There is a RFC concourse/rfc#31.
Why do we need this PR?
This will enable to automatically reset a pipeline from itself.
Changes proposed in this pull request
set_pipelineas well as events of it.Test pipeline:
There are two jobs in this pipeline. The first job is used to self-reset the pipeline. The second job is a normal job.
The web UI should be updated also, my backend code has been able to successfully set-pipeline, but UI cannot display the entire build. @Twiknight is helping on the UI change.
Contributor Checklist
Reviewer Checklist
and Helm packaging; otherwise, ignored for the integration tests (for example, if they are Garden configs that are not displayed in the
--helptext).