Hi Chris,
I made an example that works in the following way: 1) from the docker ps
command you will select the container id position in an option job (starting from 2, the first position it’s just the “CONTAINER ID” string). 2) The first step takes that and generates a ${data.container}
data value. 3) You can use that data value ${data.container}
in any workflow step.
I left the job definition example:
- defaultTab: nodes
description: ''
executionEnabled: true
id: 030801bc-6933-472f-ae61-cae11121ca6e
loglevel: INFO
name: ContainerID
nodeFilterEditable: false
options:
- name: position
value: '2'
plugins:
ExecutionLifecycle: null
scheduleEnabled: true
sequence:
commands:
- fileExtension: .sh
interpreterArgsQuoted: false
plugins:
LogFilter:
- config:
invalidKeyPattern: \s|\$|\{|\}|\\
logData: 'true'
name: container
regex: (.*)
type: key-value-data
script: docker ps | awk 'NR==@option.position@ {print $1}'
scriptInterpreter: /bin/bash
- configuration:
container: ${data.container}
debug: 'false'
nodeStep: true
type: docker-container-inspect-workflow-step
keepgoing: false
strategy: node-first
uuid: 030801bc-6933-472f-ae61-cae11121ca6e
The example just shows the container status using the Docker plugin but you can use the data value on any Docker/non-Docker step.
Feel free to modify it :-)
Hope it helps!