-
Notifications
You must be signed in to change notification settings - Fork 24
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
Support global/project/step env even if buildkite trigger step is used #84
Conversation
Hey @bradbarrow, Overall this PR seems reasonable to me, but I'm not an expert at Go so I'm going to ask for a second pair of eyes to review this changeset. As far as your outstanding question is concerned, could you perhaps clarify in what scenarios a per-project trigger step is useful? I believe there are other steps that currently don't support a top-level Note that if we wanted to release this, we would also have to add an entry to the changelog and increment version numbers in a few places (similar to #85). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the contribution.
I'm not very familiar with trigger steps, but this change itself looks good to me.
build, foundBuild := stepMap["build"].(map[interface{}]interface{}) | ||
|
||
if (!foundBuild) { | ||
build = make(map[interface{}]interface{}) // TODO allow nesting |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you please clarify this TODO?
This will help other people pick this up.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Apologies, I think it's errant. I'll remove.
|
||
if (!foundBuildEnv) { | ||
buildEnv = make(map[interface{}]interface{}) | ||
build["env"] = buildEnv // env TODO add to build |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please clarify this TODO as well.
It seems like the line adds env
to build
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ditto, errant comments. Apologies, will remove.
|
||
if !foundBlockStep { | ||
if foundTriggerStep { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be helpful to add a short comment describing the transformation that is being done in this block.
Thanks both for the feedback. I'll update this PR shortly. I've since updated our fork to support I'll take a look at the other step types you mention and how that scales. Our use case for a per project trigger step is as follows: We have 3 projects:
They share some steps: They have nuanced approaches to deployment:
In the case that someone has only changed the docs - we don't want to trigger a build on the We can try get around this using all kinds of conditionals, but it feels just like any other project-scoped step. If it were trivial to have a CLI command that triggered it, we'd be fine:
But the only clean way to trigger builds is with a trigger step, so it's nice to be able to make them conditional even though nesting it under |
That's an interesting use-case. That definitely helps to make me understand why it might be useful to have the ability to conditionally trigger pipelines.
I wonder if this could be solved through That way we should have to do fewer gymnastics with regards to supporting top-level Either way, happy to consider any concrete proposals. |
FWIW we've been using this patch for a couple months now. Would love to know the next steps :) |
Hi all 👋 I created this issue (#90) without knowing there was already a PR for it. I tested this patch and it is working as I would expect (i.e. I'm able to use Buildkite Similar to #84 (comment), are there any plans to have these changes applied? Cheers 🙏 |
Overview
This PR addresses what appears to be a regression of behaviour introduced in: #41
Buildkite
trigger
steps don't support a top levelenv
property, but the new global/project env var injection means that all steps, even trigger steps, will at least always haveenv: {}
, causing them to fail:This PR introduces the same env vars to each step but for trigger steps, nests it under
build
,env
:Input
Output
Before
After
It handles the existence / non-existence of build and its nested env property.
Outstanding Questions
Since
trigger
steps don't support top levelenv
, presumably they also can't support:Does this mean trigger steps can't be run / skipped /etc per project?