The below articles takes you through on how to run all the steps in the same POD when a pipeline step is run.
The process is simple , Create an output variable with hostname and use it as delegate selector in the following steps/stages
Sample Pipeline :
pipeline:
name: testpipeline
identifier: testpipeline
projectIdentifier: usheertest
orgIdentifier: usheernew
tags: {}
stages:
- stage:
name: shell
identifier: shell
description: ""
type: Custom
spec:
execution:
steps:
- step:
type: ShellScript
name: select_delegate
identifier: select_delegate
spec:
shell: Bash
onDelegate: true
source:
type: Inline
spec:
script: |
echo $HOSTNAME
HOST_SELECTOR=$HOSTNAME
environmentVariables: []
outputVariables:
- name: HOST_SELECTOR
type: String
value: HOST_SELECTOR
timeout: 10m
- step:
type: ShellScript
name: use delegate
identifier: use_delegate
spec:
shell: Bash
onDelegate: true
source:
type: Inline
spec:
script: echo <+execution.steps.select_delegate.output.outputVariables.HOST_SELECTOR>
environmentVariables: []
outputVariables: []
delegateSelectors:
- <+execution.steps.select_delegate.output.outputVariables.HOST_SELECTOR>
timeout: 10m
failureStrategies: []
tags: {}