login Signup

REST API Set PipelineRuntime Properties

Is there a way through the Electric Flow REST API to set pipeline runtime properties without the special '/my' property path? For an example use case, consider the following:

Using Electric Flow to initiate a Jenkins job from a pipeline, you want to have some results from that job (such as test results, app version that was built, etc) saved to the pipeline runtime. How can this be done?

This would be an extension of the following question asked and answered (instead of using '/myPipelineRuntime' could we use the specific UUID for the pipeline runtime and also is this available through the REST API instead of ec-perl or ectool): https://ask.electric-cloud.com/questions/7129/how-to-set-up-properties-on-the-pipeline-runtime.html

avatar image By mwalton.ihg 51 asked Jul 08 at 12:44 PM
more ▼
(comments are locked)
10|750 characters needed characters left

2 answers: sort voted first

Yes you can do that with any of the APIs (REST, ec-perl, ectool, ....). Except a very few exceptions (like findObjects), all API calls are available in all methods.

You simply have to pass enough information for the system to locate the object where you want to set properties. So in this case, at least:

  1. projectName

  2. pipelineId or pipelineName

  3. flowRuntimeId

  4. propertyName

the first 2 should be easily known, #3 would be returned from the runPipeline call in Jenkins for example the #4 is the name or path of the property on the pipelineRuntime

EDIT: here is a curl example

based on the pipelineRuntime at https://SERVER/flow/#pipeline-run/284be740-7d96-11e9-91c1-02425352dfc1/b3bf4872-9141-11e9-be60-02425352dfc1

the first part of the URL (284be740-7d96-11e9-91c1-02425352dfc1) is the pipelineId, the second (b3bf4872-9141-11e9-be60-02425352dfc1) is the flowRuntimeId

so let's set: level1/level2/prop1 property to "value1"

curl -X PUT "https://SERVER/rest/v1.0/properties/level1%2Flevel2%2Fprop1?flowRuntimeId=b3bf4872-9141-11e9-be60-02425352dfc1&value=value1" -H "accept: application/json" -d "{}"

if you have the pipelineId, you don't even need the project name or pipelineName.

See the result of my pipelineRuntime below

alt text

avatar image By lrochette 6k answered Jul 08 at 01:30 PM
more ▼
(comments are locked)
avatar image mwalton.ihg Jul 08 at 01:32 PM

Thank you, Laurent. Would you have a sample curl example you can pass along?

10|750 characters needed characters left

When you run a pipeline with the REST API, one of the return values is the flowRuntimeName. You can use /projects/<projectName>/flowRuntimes/<flowRuntimeName> instead of /myPipelineRuntime.

avatar image By gregm 2k answered Jul 08 at 01:54 PM
more ▼
(comments are locked)
10|750 characters needed characters left
Your answer
toggle preview:

Up to 8 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.