Batch together two steps

Is there anyway to watch batch together two steps → I want a trigger step and a command step to fire off asynchronously but the command step should wait on the trigger step to finish.

Is there any way to batch these two steps together?

The rest of the pipeline should continue without waiting on these.

Sorry @yeswecan95, I’m not sure what you’re trying to do. Could you help with an example?

You can have the command step depend on the trigger step and so wait for it to finish, or you can have them run at the same time. I’m not sure what waiting on another step to finish means if you also want them to run at the same time?

@sj26

Let’s say I have a pipeline running → I want to run an async command x somewhere in this pipeline. And, if x finishes, I want to run a command y. If x does not finish, I do not want to run command y. The remainder of the pipeline should work as normal. X is a trigger step and y is a command step. Is this possible without having to create a new pipeline for x and y?

Sounds like you might want step dependencies:

Something like this:

steps:
- command: will always run

- trigger: some-pipeline
  key: some-pipeline-trigger

- command: only-after-trigger
  depends_on: some-pipeline-trigger

- command: will also always run

The first and last command will always run immediately, and so will the trigger. The middle command will only run after the triggered build has passed. Is that kinda what you’re after?

@sj26! yes – but i want the trigger command to be async.

You can add async: true to the trigger if you like! The only difference that will make is whether the pipeline waits fo the triggered build to complete before running the subsequent command or if it proceeds immediately once the triggered build has been created.

@sj26 sorry let me explain –

lets say our pipeline is currently, x, y, z, w

i want z to only trigger after y but i want y, z together to be asynchronous. E.g. it goes x,
(async) y->z, w but z should only trigger if y completes.

is this possible?

I’m still not sure I’m following what you’re trying to do, but it sounds like you might want to use step dependencies:

You can explicitly say which steps should depend on other steps.

Something like:

steps:
- command: x
  key: x
- trigger: y
  key: y
- command: z
  key: z
  depends_on: y
- command: w
  key: w