How can I make a block step optional?

Hi folks,
I am not sure if Buildkite can do this or this is answered before.

I have a block step to do the deployment, but I don’t want the following steps like tagging the commit to be dependent on it. I mean I want the deployment to be optional – it is up to the maintainer to do it or not.

I cannot make the block step the last step, because we have multiple deployment (frontend, backend and etc) we want to make optional

How can I make a block step optional? Or is there another way to solve this problem.

Thanks

Hi @haohaolee

First of all welcome to Buildkite community and thank you for reaching out to us with your question.

Please can you share more details on your pipeline setup ? Is that you have a block step followed by tagging and a deployment step which depends on this block step ?

Now you want only the deployment step to be blocked by the block step but all other steps below block to proceed even if block step is not unblocked ?

If above usecase is what you are looking for then you can define something like this

steps:
  - command: echo hello
    key: "hello"
  - block: ":rocket: Deployment!"
    key: "block"
  - command: deployment.sh
  - command: tagging.sh
    depends_on: hello

As you can see we have defined depends_on for tagging step on the steps above block and because we defined an explicit dependency it wont be blocked by the block step and will execute if the step defined in depends_on is completed.

But note that in order for the build to be marked as complete you would need to unblock that block step but with this approach at least all the remaining steps can complete which does not need to depend on the block step.

Please let us know if you have any follow up questions.

Thank you!
This is exactly what I want. I may misunderstand how Buildkite works.