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

bk local run - support if conditions - currently ignoring them #79

Open
drnic opened this issue Mar 12, 2020 · 3 comments
Open

bk local run - support if conditions - currently ignoring them #79

drnic opened this issue Mar 12, 2020 · 3 comments
Labels

Comments

@drnic
Copy link

drnic commented Mar 12, 2020

https://buildkite.com/docs/pipelines/conditionals

steps:
  - command: "echo --- All good. Nice one."
    label: ":git:"
    if: build.branch == 'master'
  - command: "echo --- ERROR this shouldn't run; exit 1"
    label: ":git:"
    if: build.branch != 'master'

When I run this pipeline.yml it runs both steps; but it should only run one or the other.

@keithpitt is this something that should work, or one of those "its annoying to implement everything in ruby + golang" (my words not yours) gaps ;)

@gustavderdrache
Copy link

One follow-on issue with this is that bk run doesn't reject this invalid step definition, which tripped me up when I was trying to use it to double-check that I had my conditionals right:

steps:
   - label: Test PRs
     command: echo hello
     branches: "!main"
     if: build.pull_request.id != null

@pda
Copy link
Member

pda commented May 11, 2021

is this something that should work, or one of those "its annoying to implement everything in ruby + golang" (my words not yours) gaps

I think that is the truth.

Maybe worth noting that https://github.com/buildkite/conditional does exist as a Go implementation of Buildkite's server-side conditional evaluation, however it may not be complete, it's never been integrated, and may not always behave the same. Still, a good starting point.

@GMNGeoffrey
Copy link

This is a frustrating limitation, especially when it doesn't even say what is going on. I'm using the local runner to debug my pipelines. Being able to do that locally is super helpful, but if it's missing features like this, that's a major drawback. In this case it was especially annoying because I was trying to use the if condition to skip a step that fails when run locally because buildkite-agent pipeline upload --replace isn't implemented locally.

its annoying to implement everything in ruby + golang

😱 Dare I ask why things are implemented in Ruby...?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants