| This could be done one of 3 ways: 1. The Electric flow REST API function could be changed into a `Step` rather than implementing a `SimpleBuildStep` since the Simple build step does not allow for return values. This would mean writing a custom step which will send out the API call and then return the response from the Electric Flow server into a groovy variable 2. This REST API could be converted into a block-scoped Step (or SimpleBuildWrapper) and then the response could be captured inside of an Environment variable which is able to be used later inside of the pipeline. 3. https://issues.jenkins-ci.org/browse/JENKINS-29144 could be fixed and a SimpleBuildStep could be used to create the same environment variable in #2 For 1 this would look like:
def returnOut = step([$class: 'ElectricFlowGenericRestApi',
configuration: 'CBFConfiguration',
urlPath : '/projects',
httpMethod : 'POST',
body : '',
parameters : [
[$class: 'Pair',
key: 'projectName',
value: 'EC-TEST-Jenkins-1.00.00.01'
],
[$class: 'Pair',
key: 'description',
value: 'Native Jenkins Test Project'
]
]
])
and that returnOut would be a groovy variable and able to be used anywhere else For 2 and 3 there would be a general ENV variable called something like `REST_API_OUPUT` which is set on the return and then that can be used in the pipeline with `$env.REST_API_OUTPUT` |